diff --git a/src/hb-ot-color-cbdt-table.hh b/src/hb-ot-color-cbdt-table.hh index 614cc80ce..580dc3769 100644 --- a/src/hb-ot-color-cbdt-table.hh +++ b/src/hb-ot-color-cbdt-table.hh @@ -409,9 +409,6 @@ struct CBDT inline bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const { - if (!cblc) - return false; - const void *base; const BitmapSizeTable &strike = this->cblc->choose_strike (font); const IndexSubtableRecord *subtable_record = strike.find_table (glyph, cblc, &base); @@ -467,9 +464,6 @@ struct CBDT inline hb_blob_t* reference_png (hb_font_t *font, hb_codepoint_t glyph) const { - if (!cblc) - return hb_blob_get_empty (); - const void *base; const BitmapSizeTable &strike = this->cblc->choose_strike (font); const IndexSubtableRecord *subtable_record = strike.find_table (glyph, cblc, &base); @@ -525,8 +519,8 @@ struct CBDT private: hb_blob_t *cblc_blob; hb_blob_t *cbdt_blob; - const CBLC *cblc; - const CBDT *cbdt; + hb_nonnull_ptr_t cblc; + hb_nonnull_ptr_t cbdt; unsigned int cbdt_len; unsigned int upem; diff --git a/src/hb-ot-color-sbix-table.hh b/src/hb-ot-color-sbix-table.hh index 065c0dd18..7a01d14ae 100644 --- a/src/hb-ot-color-sbix-table.hh +++ b/src/hb-ot-color-sbix-table.hh @@ -152,9 +152,6 @@ struct sbix inline bool has_data () const { - /* XXX Fix somehow and remove next line. - * https://github.com/harfbuzz/harfbuzz/issues/1146 */ - if (!num_glyphs) return false; return table->has_data (); } @@ -234,8 +231,8 @@ struct sbix hb_codepoint_t glyph, hb_glyph_extents_t *extents) const { - /* Following code is safe to call even without data (XXX currently - * isn't. See has_data()), but faster to short-circuit. */ + /* Following code is safe to call even without data. + * But faster to short-circuit. */ if (!has_data ()) return false; @@ -262,12 +259,12 @@ struct sbix hb_blob_destroy (blob); - return true; + return strike_ppem; } private: hb_blob_t *sbix_blob; - const sbix *table; + hb_nonnull_ptr_t table; unsigned int num_glyphs; }; diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh index bb4c4f757..069c54788 100644 --- a/src/hb-ot-color-svg-table.hh +++ b/src/hb-ot-color-svg-table.hh @@ -75,12 +75,13 @@ struct SVG { static const hb_tag_t tableTag = HB_OT_TAG_SVG; + inline bool has_data (void) const { return svgDocEntries; } + struct accelerator_t { inline void init (hb_face_t *face) { svg_blob = hb_sanitize_context_t().reference_table (face); - svg_len = hb_blob_get_length (svg_blob); table = svg_blob->as (); } @@ -91,18 +92,14 @@ struct SVG inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const { - if (unlikely (!svg_len)) - return hb_blob_get_empty (); return table->get_glyph_entry (glyph_id).reference_blob (svg_blob, table->svgDocEntries); } - inline bool has_data () const { return svg_len; } + inline bool has_data () const { return table->has_data (); } private: hb_blob_t *svg_blob; - const SVG *table; - - unsigned int svg_len; + hb_nonnull_ptr_t table; }; inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 7bd175e39..d2a39f230 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -276,7 +276,7 @@ struct glyf if (!get_offsets (glyph, &start_offset, &end_offset)) return false; /* glyph not found */ - return CompositeGlyphHeader::get_iterator ((const char*) this->glyf_table + start_offset, + return CompositeGlyphHeader::get_iterator ((const char *) this->glyf_table + start_offset, end_offset - start_offset, composite); } @@ -476,8 +476,8 @@ struct glyf private: bool short_offset; unsigned int num_glyphs; - const loca *loca_table; - const glyf *glyf_table; + hb_nonnull_ptr_t loca_table; + hb_nonnull_ptr_t glyf_table; hb_blob_t *loca_blob; hb_blob_t *glyf_blob; unsigned int glyf_len; diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index 757090861..5847953d3 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -418,7 +418,7 @@ struct GDEF } hb_blob_t *blob; - const GDEF *table; + hb_nonnull_ptr_t table; }; inline unsigned int get_size (void) const diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 54ae429b1..0d9eeae58 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -2774,7 +2774,7 @@ struct GSUBGPOS } hb_blob_t *blob; - const T *table; + hb_nonnull_ptr_t table; unsigned int lookup_count; hb_ot_layout_lookup_accelerator_t *accels; }; diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 9f67b5745..f1e785f19 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -257,7 +257,7 @@ struct name const void *pool; unsigned int pool_len; public: - const name *table; + hb_nonnull_ptr_t table; hb_vector_t names; }; diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh index bd049f9ab..6432f3f15 100644 --- a/src/hb-ot-post-table.hh +++ b/src/hb-ot-post-table.hh @@ -254,7 +254,7 @@ struct post private: hb_blob_t *blob; uint32_t version; - const ArrayOf *glyphNameIndex; + hb_nonnull_ptr_t> glyphNameIndex; hb_vector_t index_to_offset; const uint8_t *pool; hb_atomic_ptr_t gids_sorted_by_name;