2 * @(#)Features.cpp 1.4 00/03/15
4 * (C) Copyright IBM Corp. 1998-2010 - All Rights Reserved
9 #include "OpenTypeUtilities.h"
10 #include "OpenTypeTables.h"
11 #include "ICUFeatures.h"
16 const FeatureTable
*FeatureListTable::getFeatureTable(le_uint16 featureIndex
, LETag
*featureTag
) const
18 if (featureIndex
>= SWAPW(featureCount
)) {
22 Offset featureTableOffset
= featureRecordArray
[featureIndex
].featureTableOffset
;
24 *featureTag
= SWAPT(featureRecordArray
[featureIndex
].featureTag
);
26 return (const FeatureTable
*) ((char *) this + SWAPW(featureTableOffset
));
30 * Note: according to the OpenType Spec. v 1.4, the entries in the Feature
31 * List Table are sorted alphabetically by feature tag; however, there seem
32 * to be some fonts which have an unsorted list; that's why the binary search
33 * is #if 0'd out and replaced by a linear search.
35 * Also note: as of ICU 2.6, this method isn't called anyhow...
37 const FeatureTable
*FeatureListTable::getFeatureTable(LETag featureTag
) const
40 Offset featureTableOffset
=
41 OpenTypeUtilities::getTagOffset(featureTag
, (TagAndOffsetRecord
*) featureRecordArray
, SWAPW(featureCount
));
43 if (featureTableOffset
== 0) {
47 return (const FeatureTable
*) ((char *) this + SWAPW(featureTableOffset
));
49 int count
= SWAPW(featureCount
);
51 for (int i
= 0; i
< count
; i
+= 1) {
52 if (SWAPT(featureRecordArray
[i
].featureTag
) == featureTag
) {
53 return (const FeatureTable
*) ((char *) this + SWAPW(featureRecordArray
[i
].featureTableOffset
));