Fix null accelerator's

Fixes all except for cmap.  To be done separately.

Part of https://github.com/harfbuzz/harfbuzz/issues/1146
This commit is contained in:
Behdad Esfahbod 2018-11-03 16:15:30 -04:00
parent db889c182e
commit 0b0b38ec1e
8 changed files with 17 additions and 29 deletions

View File

@ -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<const CBLC> cblc;
hb_nonnull_ptr_t<const CBDT> cbdt;
unsigned int cbdt_len;
unsigned int upem;

View File

@ -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<const sbix> table;
unsigned int num_glyphs;
};

View File

@ -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<SVG> (face);
svg_len = hb_blob_get_length (svg_blob);
table = svg_blob->as<SVG> ();
}
@ -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<const SVG> table;
};
inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const

View File

@ -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<const loca> loca_table;
hb_nonnull_ptr_t<const glyf> glyf_table;
hb_blob_t *loca_blob;
hb_blob_t *glyf_blob;
unsigned int glyf_len;

View File

@ -418,7 +418,7 @@ struct GDEF
}
hb_blob_t *blob;
const GDEF *table;
hb_nonnull_ptr_t<const GDEF> table;
};
inline unsigned int get_size (void) const

View File

@ -2774,7 +2774,7 @@ struct GSUBGPOS
}
hb_blob_t *blob;
const T *table;
hb_nonnull_ptr_t<const T> table;
unsigned int lookup_count;
hb_ot_layout_lookup_accelerator_t *accels;
};

View File

@ -257,7 +257,7 @@ struct name
const void *pool;
unsigned int pool_len;
public:
const name *table;
hb_nonnull_ptr_t<const name> table;
hb_vector_t<hb_ot_name_entry_t> names;
};

View File

@ -254,7 +254,7 @@ struct post
private:
hb_blob_t *blob;
uint32_t version;
const ArrayOf<HBUINT16> *glyphNameIndex;
hb_nonnull_ptr_t<const ArrayOf<HBUINT16>> glyphNameIndex;
hb_vector_t<uint32_t, 1> index_to_offset;
const uint8_t *pool;
hb_atomic_ptr_t<uint16_t *> gids_sorted_by_name;