[ot] Move code around

This commit is contained in:
Behdad Esfahbod 2018-08-02 23:13:19 -07:00
parent 5e718a751e
commit 6a0a298aab
1 changed files with 106 additions and 105 deletions

View File

@ -47,28 +47,10 @@
#include "hb-map-private.hh" #include "hb-map-private.hh"
hb_ot_layout_t * static bool
_hb_ot_layout_create (hb_face_t *face) _hb_ot_blacklist_gdef (unsigned int gdef_len,
{ unsigned int gsub_len,
hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t)); unsigned int gpos_len)
if (unlikely (!layout))
return nullptr;
layout->gdef_blob = hb_sanitize_context_t ().reference_table<OT::GDEF> (face);
layout->gdef = layout->gdef_blob->as<OT::GDEF> ();
layout->gsub_blob = hb_sanitize_context_t ().reference_table<OT::GSUB> (face);
layout->gsub = layout->gsub_blob->as<OT::GSUB> ();
layout->gpos_blob = hb_sanitize_context_t ().reference_table<OT::GPOS> (face);
layout->gpos = layout->gpos_blob->as<OT::GPOS> ();
layout->face = face;
layout->math.init ();
layout->fvar.init ();
layout->avar.init ();
layout->morx.init ();
{ {
/* 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:
@ -87,9 +69,6 @@ _hb_ot_layout_create (hb_face_t *face)
* https://bugzilla.mozilla.org/show_bug.cgi?id=1279693 * https://bugzilla.mozilla.org/show_bug.cgi?id=1279693
* https://bugzilla.mozilla.org/show_bug.cgi?id=1279875 * https://bugzilla.mozilla.org/show_bug.cgi?id=1279875
*/ */
unsigned int gdef_len = layout->gdef_blob->length;
unsigned int gsub_len = layout->gsub_blob->length;
unsigned int gpos_len = layout->gpos_blob->length;
#define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z)) #define ENCODE(x,y,z) ((int64_t) (x) << 32 | (int64_t) (y) << 16 | (z))
switch ENCODE(gdef_len, gsub_len, gpos_len) switch ENCODE(gdef_len, gsub_len, gpos_len)
{ {
@ -164,16 +143,38 @@ _hb_ot_layout_create (hb_face_t *face)
/* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf
* "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */ * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */
case ENCODE (1004, 59092, 14836): case ENCODE (1004, 59092, 14836):
{ return true;
layout->gdef = &Null(OT::GDEF);
break;
}
#undef ENCODE #undef ENCODE
}
return false;
}
default: hb_ot_layout_t *
break; _hb_ot_layout_create (hb_face_t *face)
} {
} hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
if (unlikely (!layout))
return nullptr;
layout->gdef_blob = hb_sanitize_context_t ().reference_table<OT::GDEF> (face);
layout->gdef = layout->gdef_blob->as<OT::GDEF> ();
layout->gsub_blob = hb_sanitize_context_t ().reference_table<OT::GSUB> (face);
layout->gsub = layout->gsub_blob->as<OT::GSUB> ();
layout->gpos_blob = hb_sanitize_context_t ().reference_table<OT::GPOS> (face);
layout->gpos = layout->gpos_blob->as<OT::GPOS> ();
layout->face = face;
layout->math.init ();
layout->fvar.init ();
layout->avar.init ();
layout->morx.init ();
if (_hb_ot_blacklist_gdef (layout->gdef_blob->length,
layout->gsub_blob->length,
layout->gpos_blob->length))
layout->gdef = &Null(OT::GDEF);
layout->gsub_lookup_count = layout->gsub->get_lookup_count (); layout->gsub_lookup_count = layout->gsub->get_lookup_count ();
layout->gpos_lookup_count = layout->gpos->get_lookup_count (); layout->gpos_lookup_count = layout->gpos->get_lookup_count ();