[svg] Minor

This commit is contained in:
Behdad Esfahbod 2018-10-28 18:26:49 -07:00
parent 4876c938a2
commit 18dd6363a5
1 changed files with 11 additions and 12 deletions

View File

@ -87,7 +87,7 @@ struct SVG
{ {
svg_blob = hb_sanitize_context_t().reference_table<SVG> (face); svg_blob = hb_sanitize_context_t().reference_table<SVG> (face);
svg_len = hb_blob_get_length (svg_blob); svg_len = hb_blob_get_length (svg_blob);
svg = svg_blob->as<SVG> (); table = svg_blob->as<SVG> ();
} }
inline void fini (void) inline void fini (void)
@ -97,25 +97,24 @@ struct SVG
inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const inline hb_blob_t *reference_blob_for_glyph (hb_codepoint_t glyph_id) const
{ {
if (unlikely (svg_len == 0)) if (unlikely (!svg_len))
return hb_blob_get_empty (); return hb_blob_get_empty ();
return svg->get_glyph_entry (glyph_id).reference_blob (svg_blob, svg->svgDocEntries); return table->get_glyph_entry (glyph_id).reference_blob (svg_blob, table->svgDocEntries);
} }
inline bool has_data () const inline bool has_data () const { return svg_len; }
{ return svg_len; }
private: private:
hb_blob_t *svg_blob; hb_blob_t *svg_blob;
const SVG *svg; const SVG *table;
unsigned int svg_len; unsigned int svg_len;
}; };
inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const inline const SVGDocumentIndexEntry &get_glyph_entry (hb_codepoint_t glyph_id) const
{ {
const SVGDocumentIndexEntry *rec; const SVGDocumentIndexEntry *rec = (SVGDocumentIndexEntry *)
rec = (SVGDocumentIndexEntry *) bsearch (&glyph_id, bsearch (&glyph_id,
&(this+svgDocEntries).arrayZ, &(this+svgDocEntries).arrayZ,
(this+svgDocEntries).len, (this+svgDocEntries).len,
sizeof (SVGDocumentIndexEntry), sizeof (SVGDocumentIndexEntry),