From 4f21703f225b6977196ef180e8d7300ea86d2cc3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 25 Nov 2018 15:59:18 -0500 Subject: [PATCH] [GDEF] Move code around --- src/hb-ot-layout-gdef-table.hh | 3 +++ src/hb-ot-layout.cc | 16 +++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 2c4cbea85..a7ba9511d 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -408,6 +408,9 @@ struct GDEF } } + HB_INTERNAL bool is_blacklisted (hb_blob_t *blob, + hb_face_t *face) const; + struct accelerator_t { HB_INTERNAL void init (hb_face_t *face); diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 3cc1ef137..bb87b5e5f 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -95,10 +95,9 @@ hb_ot_layout_kern (const hb_ot_shape_plan_t *plan, * GDEF */ -static bool -_hb_ot_blacklist_gdef (unsigned int gdef_len, - unsigned int gsub_len, - unsigned int gpos_len) +bool +OT::GDEF::is_blacklisted (hb_blob_t *blob, + hb_face_t *face) const { /* The ugly business of blacklisting individual fonts' tables happen here! * See this thread for why we finally had to bend in and do this: @@ -118,7 +117,9 @@ _hb_ot_blacklist_gdef (unsigned int gdef_len, * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 */ #define ENCODE(x,y,z) (((uint64_t) (x) << 48) | ((uint64_t) (y) << 24) | (uint64_t) (z)) - switch ENCODE(gdef_len, gsub_len, gpos_len) + switch ENCODE(blob->length, + face->table.GSUB->table.get_length (), + face->table.GPOS->table.get_length ()) { /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */ case ENCODE (442, 2874, 42038): @@ -201,10 +202,7 @@ void OT::GDEF::accelerator_t::init (hb_face_t *face) { this->table = hb_sanitize_context_t().reference_table (face); - - if (unlikely (_hb_ot_blacklist_gdef (this->table.get_length (), - face->table.GSUB->table.get_length (), - face->table.GPOS->table.get_length ()))) + if (unlikely (this->table->is_blacklisted (this->table.get_blob (), face))) { hb_blob_destroy (this->table.get_blob ()); this->table = hb_blob_get_empty ();