[colr/feat/trak] minor

This commit is contained in:
Ebrahim Byagowi 2018-11-10 18:08:11 +03:30
parent 3a9fa8c026
commit 1d82b4761d
3 changed files with 32 additions and 35 deletions

View File

@ -54,13 +54,6 @@ struct SettingName
struct FeatureName
{
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
(base+settingTable).sanitize (c, nSettings)));
}
enum {
Exclusive = 0x8000, /* If set, the feature settings are mutually exclusive. */
NotDefault = 0x4000, /* If clear, then the setting with an index of 0 in
@ -75,6 +68,13 @@ struct FeatureName
* as the default. */
};
inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
(base+settingTable).sanitize (c, nSettings)));
}
protected:
HBUINT16 feature; /* Feature type. */
HBUINT16 nSettings; /* The number of records in the setting name array. */

View File

@ -171,15 +171,6 @@ struct trak
inline bool has_data (void) const { return version.to_int () != 0; }
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
horizData.sanitize (c, this, this) &&
vertData.sanitize (c, this, this)));
}
inline bool apply (hb_aat_apply_context_t *c) const
{
TRACE_APPLY (this);
@ -221,15 +212,27 @@ struct trak
return_trace (true);
}
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) &&
version.major == 1 &&
horizData.sanitize (c, this, this) &&
vertData.sanitize (c, this, this)));
}
protected:
FixedVersion<> version; /* Version of the tracking table
FixedVersion<>version; /* Version of the tracking table
* (0x00010000u for version 1.0). */
HBUINT16 format; /* Format of the tracking table (set to 0). */
OffsetTo<TrackData> horizData; /* Offset from start of tracking table to TrackData
* for horizontal text (or 0 if none). */
OffsetTo<TrackData> vertData; /* Offset from start of tracking table to TrackData
* for vertical text (or 0 if none). */
HBUINT16 reserved; /* Reserved. Set to 0. */
HBUINT16 format; /* Format of the tracking table (set to 0). */
OffsetTo<TrackData>
horizData; /* Offset from start of tracking table to TrackData
* for horizontal text (or 0 if none). */
OffsetTo<TrackData>
vertData; /* Offset from start of tracking table to TrackData
* for vertical text (or 0 if none). */
HBUINT16 reserved; /* Reserved. Set to 0. */
public:
DEFINE_SIZE_STATIC (12);

View File

@ -103,7 +103,12 @@ struct COLR
unsigned int *count, /* IN/OUT. May be NULL. */
hb_ot_color_layer_t *layers /* OUT. May be NULL. */) const
{
const BaseGlyphRecord &record = get_glyph_record (glyph);
const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (&glyph,
&(this+baseGlyphsZ),
numBaseGlyphs,
sizeof (BaseGlyphRecord),
BaseGlyphRecord::cmp);
const BaseGlyphRecord &record = rec ? *rec : Null (BaseGlyphRecord);
hb_array_t<const LayerRecord> all_layers ((this+layersZ).arrayZ, numLayers);
hb_array_t<const LayerRecord> glyph_layers = all_layers.sub_array (record.firstLayerIdx,
@ -129,17 +134,6 @@ struct COLR
(this+layersZ).sanitize (c, numLayers)));
}
private:
inline const BaseGlyphRecord &get_glyph_record (hb_codepoint_t glyph_id) const
{
const BaseGlyphRecord *rec = (BaseGlyphRecord *) bsearch (&glyph_id,
&(this+baseGlyphsZ),
numBaseGlyphs,
sizeof (BaseGlyphRecord),
BaseGlyphRecord::cmp);
return rec ? *rec : Null(BaseGlyphRecord);
}
protected:
HBUINT16 version; /* Table version number (starts at 0). */
HBUINT16 numBaseGlyphs; /* Number of Base Glyph Records. */