mirror of
https://github.com/harfbuzz/harfbuzz.git
synced 2025-04-06 22:15:04 +00:00
[aat] Add (unused) SubtableGlyphCoverage
This commit is contained in:
parent
d8d2a98b8d
commit
d137d55799
3 changed files with 51 additions and 2 deletions
|
@ -703,6 +703,38 @@ struct ClassTable
|
|||
DEFINE_SIZE_ARRAY (4, classArray);
|
||||
};
|
||||
|
||||
struct SubtableGlyphCoverage
|
||||
{
|
||||
bool sanitize (hb_sanitize_context_t *c, unsigned subtable_count) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
|
||||
if (unlikely (!subtableOffsets.sanitize (c, subtable_count)))
|
||||
return_trace (false);
|
||||
|
||||
unsigned bytes = (c->get_num_glyphs () + CHAR_BIT - 1) / CHAR_BIT;
|
||||
for (unsigned i = 0; i < subtable_count; i++)
|
||||
{
|
||||
uint32_t offset = subtableOffsets[i];
|
||||
if (offset == 0 || offset == 0xFFFFFFFF)
|
||||
continue;
|
||||
if (unlikely (!c->check_range (this, offset) ||
|
||||
!c->check_range (this, offset + bytes)))
|
||||
return_trace (false);
|
||||
}
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
protected:
|
||||
UnsizedArrayOf<HBUINT32> subtableOffsets; /* Array of offsets from the beginning of the
|
||||
* subtable glyph coverage table to the glyph
|
||||
* coverage bitfield for a given subtable; there
|
||||
* is one offset for each subtable in the chain */
|
||||
/* UnsizedArrayOf<HBUINT8> coverageBitfields; *//* The individual coverage bitfields. */
|
||||
public:
|
||||
DEFINE_SIZE_ARRAY (0, subtableOffsets);
|
||||
};
|
||||
|
||||
struct ObsoleteTypes
|
||||
{
|
||||
static constexpr bool extended = false;
|
||||
|
|
|
@ -977,6 +977,16 @@ struct KerxTable
|
|||
st = &StructAfter<SubTable> (*st);
|
||||
}
|
||||
|
||||
unsigned majorVersion = thiz()->version;
|
||||
if (sizeof (thiz()->version) == 4)
|
||||
majorVersion = majorVersion >> 16;
|
||||
if (majorVersion >= 3)
|
||||
{
|
||||
const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) st;
|
||||
if (!coverage->sanitize (c, count))
|
||||
return_trace (false);
|
||||
}
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1100,7 +1100,7 @@ struct Chain
|
|||
|
||||
unsigned int get_size () const { return length; }
|
||||
|
||||
bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const
|
||||
bool sanitize (hb_sanitize_context_t *c, unsigned int version) const
|
||||
{
|
||||
TRACE_SANITIZE (this);
|
||||
if (!(length.sanitize (c) &&
|
||||
|
@ -1122,6 +1122,13 @@ struct Chain
|
|||
subtable = &StructAfter<ChainSubtable<Types>> (*subtable);
|
||||
}
|
||||
|
||||
if (version >= 3)
|
||||
{
|
||||
const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) subtable;
|
||||
if (!coverage->sanitize (c, count))
|
||||
return_trace (false);
|
||||
}
|
||||
|
||||
return_trace (true);
|
||||
}
|
||||
|
||||
|
@ -1133,7 +1140,7 @@ struct Chain
|
|||
|
||||
UnsizedArrayOf<Feature> featureZ; /* Features. */
|
||||
/*ChainSubtable firstSubtable;*//* Subtables. */
|
||||
/*subtableGlyphCoverageArray*/ /* Only if version >= 3. We don't use. */
|
||||
/*SubtableGlyphCoverage coverages*//* Only if version >= 3. */
|
||||
|
||||
public:
|
||||
DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT));
|
||||
|
|
Loading…
Add table
Reference in a new issue