1 /*
2 *
3 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
4 *
5 */
6
7 #include "LETypes.h"
8 #include "OpenTypeTables.h"
9 #include "Lookups.h"
10 #include "CoverageTables.h"
11 #include "LESwaps.h"
12
13 U_NAMESPACE_BEGIN
14
getLookupTable(const LEReferenceTo<LookupListTable> & base,le_uint16 lookupTableIndex,LEErrorCode & success) const15 const LEReferenceTo<LookupTable> LookupListTable::getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const
16 {
17 LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount));
18
19 if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) {
20 return LEReferenceTo<LookupTable>();
21 } else {
22 return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success)));
23 }
24 }
25
getLookupSubtable(const LEReferenceTo<LookupTable> & base,le_uint16 subtableIndex,LEErrorCode & success) const26 const LEReferenceTo<LookupSubtable> LookupTable::getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const
27 {
28 LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount));
29
30 if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) {
31 return LEReferenceTo<LookupSubtable>();
32 } else {
33 return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success)));
34 }
35 }
36
getGlyphCoverage(const LEReferenceTo<LookupSubtable> & base,Offset tableOffset,LEGlyphID glyphID,LEErrorCode & success) const37 le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const
38 {
39 const LEReferenceTo<CoverageTable> coverageTable(base, success, SWAPW(tableOffset));
40
41 if(LE_FAILURE(success)) return 0;
42
43 return coverageTable->getGlyphCoverage(glyphID);
44 }
45
46 U_NAMESPACE_END
47