]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/ExtensionSubtables.cpp
ICU-461.18.tar.gz
[apple/icu.git] / icuSources / layout / ExtensionSubtables.cpp
CommitLineData
b75a7d8f
A
1/*
2 * %W% %E%
3 *
729e4ab9 4 * (C) Copyright IBM Corp. 2008-2010 - All Rights Reserved
b75a7d8f
A
5 *
6 */
7
8#include "LETypes.h"
9#include "OpenTypeTables.h"
10#include "GlyphSubstitutionTables.h"
11#include "LookupProcessor.h"
12#include "ExtensionSubtables.h"
13#include "GlyphIterator.h"
14#include "LESwaps.h"
15
16U_NAMESPACE_BEGIN
17
729e4ab9
A
18// read a 32-bit value that might only be 16-bit-aligned in memory
19#define READ_LONG(code) (le_uint32)((SWAPW(*(le_uint16*)&code) << 16) + SWAPW(*(((le_uint16*)&code) + 1)))
b75a7d8f
A
20
21// FIXME: should look at the format too... maybe have a sub-class for it?
22le_uint32 ExtensionSubtable::process(const LookupProcessor *lookupProcessor, le_uint16 lookupType,
729e4ab9 23 GlyphIterator *glyphIterator, const LEFontInstance *fontInstance, LEErrorCode& success) const
b75a7d8f 24{
729e4ab9
A
25 if (LE_FAILURE(success)) {
26 return 0;
27 }
28
b75a7d8f
A
29 le_uint16 elt = SWAPW(extensionLookupType);
30
31 if (elt != lookupType) {
729e4ab9 32 le_uint32 extOffset = READ_LONG(extensionOffset);
b75a7d8f
A
33 LookupSubtable *subtable = (LookupSubtable *) ((char *) this + extOffset);
34
729e4ab9 35 return lookupProcessor->applySubtable(subtable, elt, glyphIterator, fontInstance, success);
b75a7d8f
A
36 }
37
38 return 0;
39}
40
41U_NAMESPACE_END