35 #include "CoverageTables.h" |
35 #include "CoverageTables.h" |
36 #include "LESwaps.h" |
36 #include "LESwaps.h" |
37 |
37 |
38 U_NAMESPACE_BEGIN |
38 U_NAMESPACE_BEGIN |
39 |
39 |
40 const LookupTable *LookupListTable::getLookupTable(le_uint16 lookupTableIndex) const |
40 const LEReferenceTo<LookupTable> LookupListTable::getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const |
41 { |
41 { |
42 if (lookupTableIndex >= SWAPW(lookupCount)) { |
42 LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount)); |
43 return 0; |
|
44 } |
|
45 |
43 |
46 Offset lookupTableOffset = lookupTableOffsetArray[lookupTableIndex]; |
44 if(LE_FAILURE(success) || lookupTableIndex>lookupTableOffsetArrayRef.getCount()) { |
47 |
45 return LEReferenceTo<LookupTable>(); |
48 return (const LookupTable *) ((char *) this + SWAPW(lookupTableOffset)); |
46 } else { |
|
47 return LEReferenceTo<LookupTable>(base, success, SWAPW(lookupTableOffsetArrayRef.getObject(lookupTableIndex, success))); |
|
48 } |
49 } |
49 } |
50 |
50 |
51 const LookupSubtable *LookupTable::getLookupSubtable(le_uint16 subtableIndex) const |
51 const LEReferenceTo<LookupSubtable> LookupTable::getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const |
52 { |
52 { |
53 if (subtableIndex >= SWAPW(subTableCount)) { |
53 LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount)); |
54 return 0; |
|
55 } |
|
56 |
54 |
57 Offset subtableOffset = subTableOffsetArray[subtableIndex]; |
55 if(LE_FAILURE(success) || subtableIndex>subTableOffsetArrayRef.getCount()) { |
58 |
56 return LEReferenceTo<LookupSubtable>(); |
59 return (const LookupSubtable *) ((char *) this + SWAPW(subtableOffset)); |
57 } else { |
|
58 return LEReferenceTo<LookupSubtable>(base, success, SWAPW(subTableOffsetArrayRef.getObject(subtableIndex, success))); |
|
59 } |
60 } |
60 } |
61 |
61 |
62 le_int32 LookupSubtable::getGlyphCoverage(Offset tableOffset, LEGlyphID glyphID) const |
62 le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const |
63 { |
63 { |
64 const CoverageTable *coverageTable = (const CoverageTable *) ((char *) this + SWAPW(tableOffset)); |
64 const LEReferenceTo<CoverageTable> coverageTable(base, success, SWAPW(tableOffset)); |
65 |
65 |
66 return coverageTable->getGlyphCoverage(glyphID); |
66 if(LE_FAILURE(success)) return 0; |
|
67 |
|
68 return coverageTable->getGlyphCoverage(glyphID); |
67 } |
69 } |
68 |
70 |
69 U_NAMESPACE_END |
71 U_NAMESPACE_END |