[ot-face] Add 'head' table

This commit is contained in:
Behdad Esfahbod 2018-11-13 11:41:29 -05:00
parent 56f541d000
commit c52d5bcd94
3 changed files with 5 additions and 12 deletions

View File

@ -40,6 +40,7 @@
#define HB_OT_TABLES \ #define HB_OT_TABLES \
/* OpenType fundamentals. */ \ /* OpenType fundamentals. */ \
HB_OT_TABLE(OT, head) \
HB_OT_ACCELERATOR(OT, cmap) \ HB_OT_ACCELERATOR(OT, cmap) \
HB_OT_ACCELERATOR(OT, hmtx) \ HB_OT_ACCELERATOR(OT, hmtx) \
HB_OT_ACCELERATOR(OT, vmtx) \ HB_OT_ACCELERATOR(OT, vmtx) \

View File

@ -235,16 +235,11 @@ struct glyf
{ {
memset (this, 0, sizeof (accelerator_t)); memset (this, 0, sizeof (accelerator_t));
hb_blob_t *head_blob = hb_sanitize_context_t().reference_table<head> (face); const OT::head &head = *face->table.head;
const head *head_table = head_blob->as<head> (); if (head.indexToLocFormat > 1 || head.glyphDataFormat != 0)
if (head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0)
{
/* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */ /* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */
hb_blob_destroy (head_blob);
return; return;
} short_offset = 0 == head.indexToLocFormat;
short_offset = 0 == head_table->indexToLocFormat;
hb_blob_destroy (head_blob);
loca_table = hb_sanitize_context_t().reference_table<loca> (face); loca_table = hb_sanitize_context_t().reference_table<loca> (face);
glyf_table = hb_sanitize_context_t().reference_table<glyf> (face); glyf_table = hb_sanitize_context_t().reference_table<glyf> (face);

View File

@ -60,10 +60,7 @@ hb_face_t::load_num_glyphs (void) const
void void
hb_face_t::load_upem (void) const hb_face_t::load_upem (void) const
{ {
hb_blob_t *head_blob = hb_sanitize_context_t ().reference_table<OT::head> (this); upem = table.head->get_upem ();
const OT::head *head_table = head_blob->as<OT::head> ();
upem = head_table->get_upem ();
hb_blob_destroy (head_blob);
} }
#endif #endif