1 --- ./src/hb-ot-font.cc 2023-11-11 09:08:45
2 +++ ./src/hb-ot-font.cc 2024-02-20 18:53:55
4 const hb_ot_face_t *ot_face = ot_font->ot_face;
6 #if !defined(HB_NO_OT_FONT_BITMAP) && !defined(HB_NO_COLOR)
7 - if (ot_face->sbix->get_extents (font, glyph, extents)) return true;
8 + /* tdf#159529 clear the hb_ot_face_t's data after fetching 'sbix' table
9 + * The 'sbix' table can be very large for color emoji fonts so clear any
10 + * cached data in hb_ot_face_t after fetching that table's extents. */
11 + bool sbixResult = ot_face->sbix->get_extents (font, glyph, extents);
12 + const_cast<hb_ot_face_t*>(ot_face)->sbix.fini ();
13 + if (sbixResult) return true;
14 if (ot_face->CBDT->get_extents (font, glyph, extents)) return true;
16 #if !defined(HB_NO_COLOR) && !defined(HB_NO_PAINT)
17 if (ot_face->COLR->get_extents (font, glyph, extents)) return true;
19 - if (ot_face->glyf->get_extents (font, glyph, extents)) return true;
20 + /* tdf#159529 clear the hb_ot_face_t's data after fetching 'glyf' table
21 + * The 'glyf' table can be very large for color emoji fonts so clear any
22 + * cached data in hb_ot_face_t after fetching that table's extents. */
23 + bool glyfResult = ot_face->glyf->get_extents (font, glyph, extents);
24 + const_cast<hb_ot_face_t*>(ot_face)->glyf.fini ();
25 + if (glyfResult) return true;
26 #ifndef HB_NO_OT_FONT_CFF
27 if (ot_face->cff2->get_extents (font, glyph, extents)) return true;
28 if (ot_face->cff1->get_extents (font, glyph, extents)) return true;