Add SortedArray{16,32}Of<>
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 6220501..ab25e96 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -891,7 +891,7 @@
};
/* An array with sorted elements. Supports binary searching. */
-template <typename Type, typename LenType=HBUINT16>
+template <typename Type, typename LenType>
struct SortedArrayOf : ArrayOf<Type, LenType>
{
hb_sorted_array_t< Type> as_array () { return hb_sorted_array (this->arrayZ, this->len); }
@@ -942,6 +942,9 @@
{ 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
*/
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index aaad14d..1e2f98f 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -672,7 +672,7 @@
HBUINT16 reserved; /* Reserved; set to 0. */
HBUINT32 length; /* Byte length of this subtable. */
HBUINT32 language; /* Ignore. */
- SortedArrayOf<CmapSubtableLongGroup, HBUINT32>
+ SortedArray32Of<CmapSubtableLongGroup>
groups; /* Groupings. */
public:
DEFINE_SIZE_ARRAY (16, groups);
@@ -786,7 +786,7 @@
DEFINE_SIZE_STATIC (4);
};
-struct DefaultUVS : SortedArrayOf<UnicodeValueRange, HBUINT32>
+struct DefaultUVS : SortedArray32Of<UnicodeValueRange>
{
void collect_unicodes (hb_set_t *out) const
{
@@ -880,7 +880,7 @@
DEFINE_SIZE_STATIC (5);
};
-struct NonDefaultUVS : SortedArrayOf<UVSMapping, HBUINT32>
+struct NonDefaultUVS : SortedArray32Of<UVSMapping>
{
void collect_unicodes (hb_set_t *out) const
{
@@ -1186,7 +1186,7 @@
protected:
HBUINT16 format; /* Format number is set to 14. */
HBUINT32 length; /* Byte length of this subtable. */
- SortedArrayOf<VariationSelectorRecord, HBUINT32>
+ SortedArray32Of<VariationSelectorRecord>
record; /* Variation selector records; sorted
* in increasing order of `varSelector'. */
public:
@@ -1705,7 +1705,7 @@
protected:
HBUINT16 version; /* Table version number (0). */
- SortedArrayOf<EncodingRecord>
+ SortedArray16Of<EncodingRecord>
encodingRecord; /* Encoding tables. */
public:
DEFINE_SIZE_ARRAY (4, encodingRecord);
diff --git a/src/hb-ot-color-svg-table.hh b/src/hb-ot-color-svg-table.hh
index 04fbf89..e022ef4 100644
--- a/src/hb-ot-color-svg-table.hh
+++ b/src/hb-ot-color-svg-table.hh
@@ -107,7 +107,7 @@
protected:
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
* SVG Documents Index. Must be non-zero. */
/* Array of SVG Document Index Entries. */
diff --git a/src/hb-ot-layout-base-table.hh b/src/hb-ot-layout-base-table.hh
index 47eafa3..4929477 100644
--- a/src/hb-ot-layout-base-table.hh
+++ b/src/hb-ot-layout-base-table.hh
@@ -220,7 +220,7 @@
maxCoord; /* Offset to BaseCoord table that defines
* maximum extent value, from the beginning
* of MinMax table (may be NULL) */
- SortedArrayOf<FeatMinMaxRecord>
+ SortedArray16Of<FeatMinMaxRecord>
featMinMaxRecords;
/* Array of FeatMinMaxRecords, in alphabetical
* order by featureTableTag */
@@ -311,7 +311,7 @@
Offset16To<MinMax>
defaultMinMax; /* Offset to MinMax table, from beginning of
* BaseScript table (may be NULL) */
- SortedArrayOf<BaseLangSysRecord>
+ SortedArray16Of<BaseLangSysRecord>
baseLangSysRecords;
/* Number of BaseLangSysRecords
* defined — may be zero (0) */
@@ -364,7 +364,7 @@
}
protected:
- SortedArrayOf<BaseScriptRecord>
+ SortedArray16Of<BaseScriptRecord>
baseScriptRecords;
public:
@@ -426,7 +426,7 @@
}
protected:
- Offset16To<SortedArrayOf<Tag>>
+ Offset16To<SortedArray16Of<Tag>>
baseTagList; /* Offset to BaseTagList table, from beginning
* of Axis table (may be NULL)
* Array of 4-byte baseline identification tags — must
diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh
index 05889ef..60da808 100644
--- a/src/hb-ot-layout-common.hh
+++ b/src/hb-ot-layout-common.hh
@@ -392,7 +392,7 @@
};
template <typename Type>
-struct RecordArrayOf : SortedArrayOf<Record<Type>>
+struct RecordArrayOf : SortedArray16Of<Record<Type>>
{
const Offset16To<Type>& get_offset (unsigned int i) const
{ return (*this)[i].offset; }
@@ -1447,7 +1447,7 @@
protected:
HBUINT16 coverageFormat; /* Format identifier--format = 1 */
- SortedArrayOf<HBGlyphID>
+ SortedArray16Of<HBGlyphID>
glyphArray; /* Array of GlyphIDs--in numerical order */
public:
DEFINE_SIZE_ARRAY (4, glyphArray);
@@ -1623,7 +1623,7 @@
protected:
HBUINT16 coverageFormat; /* Format identifier--format = 2 */
- SortedArrayOf<RangeRecord>
+ SortedArray16Of<RangeRecord>
rangeRecord; /* Array of glyph ranges--ordered by
* Start GlyphID. rangeCount entries
* long */
@@ -2274,7 +2274,7 @@
protected:
HBUINT16 classFormat; /* Format identifier--format = 2 */
- SortedArrayOf<RangeRecord>
+ SortedArray16Of<RangeRecord>
rangeRecord; /* Array of glyph ranges--ordered by
* Start GlyphID */
public:
diff --git a/src/hb-ot-layout-jstf-table.hh b/src/hb-ot-layout-jstf-table.hh
index 92e684b..3b2293d 100644
--- a/src/hb-ot-layout-jstf-table.hh
+++ b/src/hb-ot-layout-jstf-table.hh
@@ -136,7 +136,7 @@
* ExtenderGlyphs -- Extender Glyph Table
*/
-typedef SortedArrayOf<HBGlyphID> ExtenderGlyphs;
+typedef SortedArray16Of<HBGlyphID> ExtenderGlyphs;
/*
diff --git a/src/hb-ot-vorg-table.hh b/src/hb-ot-vorg-table.hh
index c680320..efa7737 100644
--- a/src/hb-ot-vorg-table.hh
+++ b/src/hb-ot-vorg-table.hh
@@ -125,7 +125,7 @@
FixedVersion<>version; /* Version of VORG table. Set to 0x00010000u. */
FWORD defaultVertOriginY;
/* The default vertical origin. */
- SortedArrayOf<VertOriginMetric>
+ SortedArray16Of<VertOriginMetric>
vertYOrigins; /* The array of vertical origins. */
public: