From c5dffd0dfcf569bcc034f50e8b252adacfbe54d3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 24 Feb 2026 16:32:34 -0300 Subject: [PATCH] [vector] Store glyph span cache as pair --- src/hb-vector-svg-subset.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/hb-vector-svg-subset.cc b/src/hb-vector-svg-subset.cc index 4ba316116..78037d26d 100644 --- a/src/hb-vector-svg-subset.cc +++ b/src/hb-vector-svg-subset.cc @@ -53,7 +53,7 @@ struct hb_svg_doc_cache_t const char *svg = nullptr; unsigned len = 0; hb_vector_t defs_entries; - hb_hashmap_t glyph_spans; + hb_hashmap_t> glyph_spans; }; using hb_svg_doc_t = hb_atomic_t; @@ -435,7 +435,7 @@ static bool hb_svg_parse_cache_entries_linear (const char *svg, unsigned len, hb_vector_t *defs_entries, - hb_hashmap_t *glyph_spans) + hb_hashmap_t> *glyph_spans) { hb_svg_open_elem_t stack[HB_SVG_PARSE_MAX_DEPTH]; unsigned depth = 0; @@ -534,7 +534,8 @@ hb_svg_parse_cache_entries_linear (const char *svg, hb_codepoint_t gid; if (hb_svg_parse_glyph_id_span (e.id, &gid)) - glyph_spans->set (gid, ((uint64_t) e.start << 32) | (uint64_t) end); + glyph_spans->set (gid, hb_pair_t ((uint32_t) e.start, + (uint32_t) end)); } if (e.is_defs && defs_depth) @@ -570,7 +571,8 @@ hb_svg_parse_cache_entries_linear (const char *svg, hb_codepoint_t gid; if (hb_svg_parse_glyph_id_span (e.id, &gid)) - glyph_spans->set (gid, ((uint64_t) e.start << 32) | (uint64_t) end); + glyph_spans->set (gid, hb_pair_t ((uint32_t) e.start, + (uint32_t) end)); } } else @@ -734,11 +736,11 @@ hb_svg_subset_glyph_image (hb_face_t *face, unsigned glyph_start = 0, glyph_end = 0; if (doc_cache) { - uint64_t *span = nullptr; + hb_pair_t *span = nullptr; if (!doc_cache->glyph_spans.has (glyph, &span) || !span) return false; - glyph_start = (unsigned) (*span >> 32); - glyph_end = (unsigned) *span; + glyph_start = span->first; + glyph_end = span->second; } else {