Add SortedArray{16,32}Of<>
This commit is contained in:
parent
5639e253f9
commit
4dba749d83
|
@ -891,7 +891,7 @@ struct ArrayOfM1
|
||||||
};
|
};
|
||||||
|
|
||||||
/* An array with sorted elements. Supports binary searching. */
|
/* An array with sorted elements. Supports binary searching. */
|
||||||
template <typename Type, typename LenType=HBUINT16>
|
template <typename Type, typename LenType>
|
||||||
struct SortedArrayOf : ArrayOf<Type, LenType>
|
struct SortedArrayOf : ArrayOf<Type, LenType>
|
||||||
{
|
{
|
||||||
hb_sorted_array_t< Type> as_array () { return hb_sorted_array (this->arrayZ, this->len); }
|
hb_sorted_array_t< Type> as_array () { return hb_sorted_array (this->arrayZ, this->len); }
|
||||||
|
@ -942,6 +942,9 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
|
||||||
{ return as_array ().bfind (x, i, not_found, to_store); }
|
{ return as_array ().bfind (x, i, not_found, to_store); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename Type> using SortedArray16Of = SortedArrayOf<Type, HBUINT16>;
|
||||||
|
template <typename Type> using SortedArray32Of = SortedArrayOf<Type, HBUINT32>;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Binary-search arrays
|
* Binary-search arrays
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -672,7 +672,7 @@ struct CmapSubtableLongSegmented
|
||||||
HBUINT16 reserved; /* Reserved; set to 0. */
|
HBUINT16 reserved; /* Reserved; set to 0. */
|
||||||
HBUINT32 length; /* Byte length of this subtable. */
|
HBUINT32 length; /* Byte length of this subtable. */
|
||||||
HBUINT32 language; /* Ignore. */
|
HBUINT32 language; /* Ignore. */
|
||||||
SortedArrayOf<CmapSubtableLongGroup, HBUINT32>
|
SortedArray32Of<CmapSubtableLongGroup>
|
||||||
groups; /* Groupings. */
|
groups; /* Groupings. */
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_ARRAY (16, groups);
|
DEFINE_SIZE_ARRAY (16, groups);
|
||||||
|
@ -786,7 +786,7 @@ struct UnicodeValueRange
|
||||||
DEFINE_SIZE_STATIC (4);
|
DEFINE_SIZE_STATIC (4);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
|
struct DefaultUVS : SortedArray32Of<UnicodeValueRange>
|
||||||
{
|
{
|
||||||
void collect_unicodes (hb_set_t *out) const
|
void collect_unicodes (hb_set_t *out) const
|
||||||
{
|
{
|
||||||
|
@ -880,7 +880,7 @@ struct UVSMapping
|
||||||
DEFINE_SIZE_STATIC (5);
|
DEFINE_SIZE_STATIC (5);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
|
struct NonDefaultUVS : SortedArray32Of<UVSMapping>
|
||||||
{
|
{
|
||||||
void collect_unicodes (hb_set_t *out) const
|
void collect_unicodes (hb_set_t *out) const
|
||||||
{
|
{
|
||||||
|
@ -1186,7 +1186,7 @@ struct CmapSubtableFormat14
|
||||||
protected:
|
protected:
|
||||||
HBUINT16 format; /* Format number is set to 14. */
|
HBUINT16 format; /* Format number is set to 14. */
|
||||||
HBUINT32 length; /* Byte length of this subtable. */
|
HBUINT32 length; /* Byte length of this subtable. */
|
||||||
SortedArrayOf<VariationSelectorRecord, HBUINT32>
|
SortedArray32Of<VariationSelectorRecord>
|
||||||
record; /* Variation selector records; sorted
|
record; /* Variation selector records; sorted
|
||||||
* in increasing order of `varSelector'. */
|
* in increasing order of `varSelector'. */
|
||||||
public:
|
public:
|
||||||
|
@ -1705,7 +1705,7 @@ struct cmap
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HBUINT16 version; /* Table version number (0). */
|
HBUINT16 version; /* Table version number (0). */
|
||||||
SortedArrayOf<EncodingRecord>
|
SortedArray16Of<EncodingRecord>
|
||||||
encodingRecord; /* Encoding tables. */
|
encodingRecord; /* Encoding tables. */
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_ARRAY (4, encodingRecord);
|
DEFINE_SIZE_ARRAY (4, encodingRecord);
|
||||||
|
|
|
@ -107,7 +107,7 @@ struct SVG
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HBUINT16 version; /* Table version (starting at 0). */
|
HBUINT16 version; /* Table version (starting at 0). */
|
||||||
Offset32To<SortedArrayOf<SVGDocumentIndexEntry>>
|
Offset32To<SortedArray16Of<SVGDocumentIndexEntry>>
|
||||||
svgDocEntries; /* Offset (relative to the start of the SVG table) to the
|
svgDocEntries; /* Offset (relative to the start of the SVG table) to the
|
||||||
* SVG Documents Index. Must be non-zero. */
|
* SVG Documents Index. Must be non-zero. */
|
||||||
/* Array of SVG Document Index Entries. */
|
/* Array of SVG Document Index Entries. */
|
||||||
|
|
|
@ -220,7 +220,7 @@ struct MinMax
|
||||||
maxCoord; /* Offset to BaseCoord table that defines
|
maxCoord; /* Offset to BaseCoord table that defines
|
||||||
* maximum extent value, from the beginning
|
* maximum extent value, from the beginning
|
||||||
* of MinMax table (may be NULL) */
|
* of MinMax table (may be NULL) */
|
||||||
SortedArrayOf<FeatMinMaxRecord>
|
SortedArray16Of<FeatMinMaxRecord>
|
||||||
featMinMaxRecords;
|
featMinMaxRecords;
|
||||||
/* Array of FeatMinMaxRecords, in alphabetical
|
/* Array of FeatMinMaxRecords, in alphabetical
|
||||||
* order by featureTableTag */
|
* order by featureTableTag */
|
||||||
|
@ -311,7 +311,7 @@ struct BaseScript
|
||||||
Offset16To<MinMax>
|
Offset16To<MinMax>
|
||||||
defaultMinMax; /* Offset to MinMax table, from beginning of
|
defaultMinMax; /* Offset to MinMax table, from beginning of
|
||||||
* BaseScript table (may be NULL) */
|
* BaseScript table (may be NULL) */
|
||||||
SortedArrayOf<BaseLangSysRecord>
|
SortedArray16Of<BaseLangSysRecord>
|
||||||
baseLangSysRecords;
|
baseLangSysRecords;
|
||||||
/* Number of BaseLangSysRecords
|
/* Number of BaseLangSysRecords
|
||||||
* defined — may be zero (0) */
|
* defined — may be zero (0) */
|
||||||
|
@ -364,7 +364,7 @@ struct BaseScriptList
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SortedArrayOf<BaseScriptRecord>
|
SortedArray16Of<BaseScriptRecord>
|
||||||
baseScriptRecords;
|
baseScriptRecords;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -426,7 +426,7 @@ struct Axis
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Offset16To<SortedArrayOf<Tag>>
|
Offset16To<SortedArray16Of<Tag>>
|
||||||
baseTagList; /* Offset to BaseTagList table, from beginning
|
baseTagList; /* Offset to BaseTagList table, from beginning
|
||||||
* of Axis table (may be NULL)
|
* of Axis table (may be NULL)
|
||||||
* Array of 4-byte baseline identification tags — must
|
* Array of 4-byte baseline identification tags — must
|
||||||
|
|
|
@ -392,7 +392,7 @@ struct Record
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
struct RecordArrayOf : SortedArrayOf<Record<Type>>
|
struct RecordArrayOf : SortedArray16Of<Record<Type>>
|
||||||
{
|
{
|
||||||
const Offset16To<Type>& get_offset (unsigned int i) const
|
const Offset16To<Type>& get_offset (unsigned int i) const
|
||||||
{ return (*this)[i].offset; }
|
{ return (*this)[i].offset; }
|
||||||
|
@ -1447,7 +1447,7 @@ struct CoverageFormat1
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HBUINT16 coverageFormat; /* Format identifier--format = 1 */
|
HBUINT16 coverageFormat; /* Format identifier--format = 1 */
|
||||||
SortedArrayOf<HBGlyphID>
|
SortedArray16Of<HBGlyphID>
|
||||||
glyphArray; /* Array of GlyphIDs--in numerical order */
|
glyphArray; /* Array of GlyphIDs--in numerical order */
|
||||||
public:
|
public:
|
||||||
DEFINE_SIZE_ARRAY (4, glyphArray);
|
DEFINE_SIZE_ARRAY (4, glyphArray);
|
||||||
|
@ -1623,7 +1623,7 @@ struct CoverageFormat2
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HBUINT16 coverageFormat; /* Format identifier--format = 2 */
|
HBUINT16 coverageFormat; /* Format identifier--format = 2 */
|
||||||
SortedArrayOf<RangeRecord>
|
SortedArray16Of<RangeRecord>
|
||||||
rangeRecord; /* Array of glyph ranges--ordered by
|
rangeRecord; /* Array of glyph ranges--ordered by
|
||||||
* Start GlyphID. rangeCount entries
|
* Start GlyphID. rangeCount entries
|
||||||
* long */
|
* long */
|
||||||
|
@ -2274,7 +2274,7 @@ struct ClassDefFormat2
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HBUINT16 classFormat; /* Format identifier--format = 2 */
|
HBUINT16 classFormat; /* Format identifier--format = 2 */
|
||||||
SortedArrayOf<RangeRecord>
|
SortedArray16Of<RangeRecord>
|
||||||
rangeRecord; /* Array of glyph ranges--ordered by
|
rangeRecord; /* Array of glyph ranges--ordered by
|
||||||
* Start GlyphID */
|
* Start GlyphID */
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -136,7 +136,7 @@ struct JstfLangSys : List16OfOffset16To<JstfPriority>
|
||||||
* ExtenderGlyphs -- Extender Glyph Table
|
* ExtenderGlyphs -- Extender Glyph Table
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef SortedArrayOf<HBGlyphID> ExtenderGlyphs;
|
typedef SortedArray16Of<HBGlyphID> ExtenderGlyphs;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -125,7 +125,7 @@ struct VORG
|
||||||
FixedVersion<>version; /* Version of VORG table. Set to 0x00010000u. */
|
FixedVersion<>version; /* Version of VORG table. Set to 0x00010000u. */
|
||||||
FWORD defaultVertOriginY;
|
FWORD defaultVertOriginY;
|
||||||
/* The default vertical origin. */
|
/* The default vertical origin. */
|
||||||
SortedArrayOf<VertOriginMetric>
|
SortedArray16Of<VertOriginMetric>
|
||||||
vertYOrigins; /* The array of vertical origins. */
|
vertYOrigins; /* The array of vertical origins. */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue