[GDEF] Move code around

This commit is contained in:
Behdad Esfahbod 2018-11-25 15:59:18 -05:00
parent 4ed9fb1a00
commit 4f21703f22
2 changed files with 10 additions and 9 deletions

View File

@ -408,6 +408,9 @@ struct GDEF
} }
} }
HB_INTERNAL bool is_blacklisted (hb_blob_t *blob,
hb_face_t *face) const;
struct accelerator_t struct accelerator_t
{ {
HB_INTERNAL void init (hb_face_t *face); HB_INTERNAL void init (hb_face_t *face);

View File

@ -95,10 +95,9 @@ hb_ot_layout_kern (const hb_ot_shape_plan_t *plan,
* GDEF * GDEF
*/ */
static bool bool
_hb_ot_blacklist_gdef (unsigned int gdef_len, OT::GDEF::is_blacklisted (hb_blob_t *blob,
unsigned int gsub_len, hb_face_t *face) const
unsigned int gpos_len)
{ {
/* The ugly business of blacklisting individual fonts' tables happen here! /* The ugly business of blacklisting individual fonts' tables happen here!
* See this thread for why we finally had to bend in and do this: * 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 * 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)) #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 */ /* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */
case ENCODE (442, 2874, 42038): case ENCODE (442, 2874, 42038):
@ -201,10 +202,7 @@ void
OT::GDEF::accelerator_t::init (hb_face_t *face) OT::GDEF::accelerator_t::init (hb_face_t *face)
{ {
this->table = hb_sanitize_context_t().reference_table<GDEF> (face); this->table = hb_sanitize_context_t().reference_table<GDEF> (face);
if (unlikely (this->table->is_blacklisted (this->table.get_blob (), face)))
if (unlikely (_hb_ot_blacklist_gdef (this->table.get_length (),
face->table.GSUB->table.get_length (),
face->table.GPOS->table.get_length ())))
{ {
hb_blob_destroy (this->table.get_blob ()); hb_blob_destroy (this->table.get_blob ());
this->table = hb_blob_get_empty (); this->table = hb_blob_get_empty ();