diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index ce6ee1e22..bcf89e462 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -238,9 +238,9 @@ struct glyf hb_blob_t *head_blob = hb_sanitize_context_t().reference_table
(face); const head *head_table = head_blob->as (); - if (head_table == &Null(head) || (unsigned int) head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0) + if (head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0) { - /* head table is not present, or in an 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; } @@ -270,7 +270,7 @@ struct glyf inline bool get_composite (hb_codepoint_t glyph, CompositeGlyphHeader::Iterator *composite /* OUT */) const { - if (this->glyf_table == &Null(glyf) || !num_glyphs) + if (unlikely (!num_glyphs)) return false; unsigned int start_offset, end_offset; diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh index 965e30a08..fded120be 100644 --- a/src/hb-ot-head-table.hh +++ b/src/hb-ot-head-table.hh @@ -141,8 +141,8 @@ struct head * -1: Only strongly right to left; * -2: Like -1 but also contains neutrals. */ public: - HBINT16 indexToLocFormat; /* 0 for short offsets, 1 for long. */ - HBINT16 glyphDataFormat; /* 0 for current format. */ + HBUINT16 indexToLocFormat; /* 0 for short offsets, 1 for long. */ + HBUINT16 glyphDataFormat; /* 0 for current format. */ DEFINE_SIZE_STATIC (54); }; diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 60a8d3adf..d2b41a8ef 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -349,6 +349,7 @@ struct GDEF ComponentGlyph = 4 }; + inline bool has_data (void) const { return version.to_int () != 0; } inline bool has_glyph_classes (void) const { return glyphClassDef != 0; } inline unsigned int get_glyph_class (hb_codepoint_t glyph) const { return (this+glyphClassDef).get_class (glyph); } diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index f3566ab19..40a2fc4cc 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -2320,6 +2320,7 @@ struct Extension struct GSUBGPOS { + inline bool has_data (void) const { return version.to_int () != 0; } inline unsigned int get_script_count (void) const { return (this+scriptList).len; } inline const Tag& get_script_tag (unsigned int i) const diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index bfde063d7..09ff0e6c0 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -904,7 +904,7 @@ hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face, hb_bool_t hb_ot_layout_has_substitution (hb_face_t *face) { - return &_get_gsub (face) != &Null(OT::GSUB); + return _get_gsub (face).has_data (); } /** @@ -1006,7 +1006,7 @@ hb_ot_layout_lookups_substitute_closure (hb_face_t *face, hb_bool_t hb_ot_layout_has_positioning (hb_face_t *face) { - return &_get_gpos (face) != &Null(OT::GPOS); + return _get_gpos (face).has_data (); } void @@ -1341,5 +1341,5 @@ hb_ot_layout_substitute_lookup (OT::hb_ot_apply_context_t *c, // hb_bool_t // hb_ot_base_has_data (hb_face_t *face) // { -// return &_get_base (face) != &Null(OT::BASE); +// return _get_base (face).has_data (); // } diff --git a/src/hb-ot-math-table.hh b/src/hb-ot-math-table.hh index 5fef2d28f..2dd714580 100644 --- a/src/hb-ot-math-table.hh +++ b/src/hb-ot-math-table.hh @@ -686,6 +686,8 @@ struct MATH { static const hb_tag_t tableTag = HB_OT_TAG_MATH; + inline bool has_data (void) const { return version.to_int () != 0; } + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); diff --git a/src/hb-ot-math.cc b/src/hb-ot-math.cc index e7cb46524..66ce207a7 100644 --- a/src/hb-ot-math.cc +++ b/src/hb-ot-math.cc @@ -55,7 +55,7 @@ _get_math (hb_face_t *face) hb_bool_t hb_ot_math_has_data (hb_face_t *face) { - return &_get_math (face) != &Null(OT::MATH); + return _get_math (face).has_data (); } /** diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh index 2803febbf..a55511aa0 100644 --- a/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/src/hb-ot-shape-complex-arabic-fallback.hh @@ -313,6 +313,7 @@ arabic_fallback_plan_create (const hb_ot_shape_plan_t *plan, if (arabic_fallback_plan_init_win1256 (fallback_plan, plan, font)) return fallback_plan; + assert (fallback_plan->num_lookups == 0); free (fallback_plan); return const_cast