[ot-face] Use core tables
diff --git a/src/hb-ot-face-table-list.hh b/src/hb-ot-face-table-list.hh
index 99a9c22..c05034b 100644
--- a/src/hb-ot-face-table-list.hh
+++ b/src/hb-ot-face-table-list.hh
@@ -80,6 +80,7 @@
#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 87a7d80..0f0db47 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -936,7 +936,7 @@
return;
short_offset = 0 == head.indexToLocFormat;
- loca_table = hb_sanitize_context_t ().reference_table<loca> (face);
+ loca_table = face->table.loca.get_blob (); // Needs no destruct!
glyf_table = hb_sanitize_context_t ().reference_table<glyf> (face);
#ifndef HB_NO_VAR
gvar = face->table.gvar;
@@ -951,7 +951,6 @@
}
~accelerator_t ()
{
- loca_table.destroy ();
glyf_table.destroy ();
}
diff --git a/src/hb-static.cc b/src/hb-static.cc
index 0fd8fe9..4d48624 100644
--- a/src/hb-static.cc
+++ b/src/hb-static.cc
@@ -60,23 +60,14 @@
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<OT::head> (face);
- const OT::head *head_table = head_blob->as<OT::head> ();
- 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<OT::loca> (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 @@
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<OT::maxp> (face);
- const OT::maxp *maxp_table = maxp_blob->as<OT::maxp> ();
- ret = maxp_table->get_num_glyphs ();
- hb_blob_destroy (maxp_blob);
-
- return ret;
+ return face->table.maxp->get_num_glyphs ();
}
unsigned int