]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/Lookups.cpp
ICU-551.24.tar.gz
[apple/icu.git] / icuSources / layout / Lookups.cpp
CommitLineData
b75a7d8f 1/*
b75a7d8f 2 *
57a6839d 3 * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved
b75a7d8f
A
4 *
5 */
6
7#include "LETypes.h"
8#include "OpenTypeTables.h"
9#include "Lookups.h"
10#include "CoverageTables.h"
11#include "LESwaps.h"
12
13U_NAMESPACE_BEGIN
14
57a6839d 15const LEReferenceTo<LookupTable> LookupListTable::getLookupTable(const LEReferenceTo<LookupListTable> &base, le_uint16 lookupTableIndex, LEErrorCode &success) const
b75a7d8f 16{
57a6839d 17 LEReferenceToArrayOf<Offset> lookupTableOffsetArrayRef(base, success, (const Offset*)&lookupTableOffsetArray, SWAPW(lookupCount));
b75a7d8f 18
57a6839d
A
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 }
b75a7d8f
A
24}
25
57a6839d 26const LEReferenceTo<LookupSubtable> LookupTable::getLookupSubtable(const LEReferenceTo<LookupTable> &base, le_uint16 subtableIndex, LEErrorCode &success) const
b75a7d8f 27{
57a6839d 28 LEReferenceToArrayOf<Offset> subTableOffsetArrayRef(base, success, (const Offset*)&subTableOffsetArray, SWAPW(subTableCount));
b75a7d8f 29
57a6839d
A
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 }
b75a7d8f
A
35}
36
57a6839d 37le_int32 LookupSubtable::getGlyphCoverage(const LEReferenceTo<LookupSubtable> &base, Offset tableOffset, LEGlyphID glyphID, LEErrorCode &success) const
b75a7d8f 38{
57a6839d
A
39 const LEReferenceTo<CoverageTable> coverageTable(base, success, SWAPW(tableOffset));
40
41 if(LE_FAILURE(success)) return 0;
b75a7d8f 42
57a6839d 43 return coverageTable->getGlyphCoverage(glyphID);
b75a7d8f
A
44}
45
46U_NAMESPACE_END