From c52d5bcd9405dbaa9289d720d9f0853aeac6b244 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 13 Nov 2018 11:41:29 -0500 Subject: [PATCH] [ot-face] Add 'head' table --- src/hb-ot-face.hh | 1 + src/hb-ot-glyf-table.hh | 11 +++-------- src/hb-static.cc | 5 +---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/hb-ot-face.hh b/src/hb-ot-face.hh index 4a36a4dcb..13c3a96da 100644 --- a/src/hb-ot-face.hh +++ b/src/hb-ot-face.hh @@ -40,6 +40,7 @@ #define HB_OT_TABLES \ /* OpenType fundamentals. */ \ + HB_OT_TABLE(OT, head) \ HB_OT_ACCELERATOR(OT, cmap) \ HB_OT_ACCELERATOR(OT, hmtx) \ HB_OT_ACCELERATOR(OT, vmtx) \ diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 42bb03ff8..4fdbced4a 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -235,16 +235,11 @@ struct glyf { memset (this, 0, sizeof (accelerator_t)); - hb_blob_t *head_blob = hb_sanitize_context_t().reference_table (face); - const head *head_table = head_blob->as (); - if (head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0) - { + const OT::head &head = *face->table.head; + if (head.indexToLocFormat > 1 || head.glyphDataFormat != 0) /* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */ - hb_blob_destroy (head_blob); return; - } - short_offset = 0 == head_table->indexToLocFormat; - hb_blob_destroy (head_blob); + short_offset = 0 == head.indexToLocFormat; loca_table = hb_sanitize_context_t().reference_table (face); glyf_table = hb_sanitize_context_t().reference_table (face); diff --git a/src/hb-static.cc b/src/hb-static.cc index 3669e08b7..461b08be5 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -60,10 +60,7 @@ hb_face_t::load_num_glyphs (void) const void hb_face_t::load_upem (void) const { - hb_blob_t *head_blob = hb_sanitize_context_t ().reference_table (this); - const OT::head *head_table = head_blob->as (); - upem = head_table->get_upem (); - hb_blob_destroy (head_blob); + upem = table.head->get_upem (); } #endif