diff --git a/src/hb-ot-face-table-list.hh b/src/hb-ot-face-table-list.hh index 99a9c22fa..c05034b3b 100644 --- a/src/hb-ot-face-table-list.hh +++ b/src/hb-ot-face-table-list.hh @@ -80,6 +80,7 @@ HB_OT_TABLE (OT, VORG) #endif /* TrueType outlines. */ +HB_OT_CORE_TABLE (OT, loca) // Also used to determine number of glyphs HB_OT_ACCELERATOR (OT, glyf) /* CFF outlines. */ diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 87a7d800c..0f0db4791 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -936,7 +936,7 @@ struct glyf return; short_offset = 0 == head.indexToLocFormat; - loca_table = hb_sanitize_context_t ().reference_table (face); + loca_table = face->table.loca.get_blob (); // Needs no destruct! glyf_table = hb_sanitize_context_t ().reference_table (face); #ifndef HB_NO_VAR gvar = face->table.gvar; @@ -951,7 +951,6 @@ struct glyf } ~accelerator_t () { - loca_table.destroy (); glyf_table.destroy (); } diff --git a/src/hb-static.cc b/src/hb-static.cc index 0fd8fe9e8..4d486241a 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -60,23 +60,14 @@ static inline unsigned load_num_glyphs_from_loca (const hb_face_t *face) { unsigned ret = 0; - hb_sanitize_context_t c = hb_sanitize_context_t (); - c.set_num_glyphs (0); /* So we don't recurse ad infinitum. */ - /* We cannot use table.head because that would use sanitizer, - * which would try accessing face.num_glyphs, which would - * recurse here again... */ - hb_blob_t *head_blob = c.reference_table (face); - const OT::head *head_table = head_blob->as (); - unsigned indexToLocFormat = head_table->indexToLocFormat; - hb_blob_destroy (head_blob); + unsigned indexToLocFormat = face->table.head->indexToLocFormat; if (indexToLocFormat <= 1) { bool short_offset = 0 == indexToLocFormat; - hb_blob_t *loca_blob = c.reference_table (face); + hb_blob_t *loca_blob = face->table.loca.get_blob (); ret = hb_max (1u, loca_blob->length / (short_offset ? 2 : 4)) - 1; - hb_blob_destroy (loca_blob); } return ret; @@ -85,16 +76,7 @@ load_num_glyphs_from_loca (const hb_face_t *face) static inline unsigned load_num_glyphs_from_maxp (const hb_face_t *face) { - unsigned ret = 0; - hb_sanitize_context_t c = hb_sanitize_context_t (); - c.set_num_glyphs (0); /* So we don't recurse ad infinitum. */ - - hb_blob_t *maxp_blob = c.reference_table (face); - const OT::maxp *maxp_table = maxp_blob->as (); - ret = maxp_table->get_num_glyphs (); - hb_blob_destroy (maxp_blob); - - return ret; + return face->table.maxp->get_num_glyphs (); } unsigned int