]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/GlyphSubstLookupProc.cpp
ICU-6.2.21.tar.gz
[apple/icu.git] / icuSources / layout / GlyphSubstLookupProc.cpp
CommitLineData
b75a7d8f 1/*
b75a7d8f 2 *
374ca955 3 * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved
b75a7d8f
A
4 *
5 */
6
7#include "LETypes.h"
8#include "LEGlyphFilter.h"
9#include "LEFontInstance.h"
10#include "OpenTypeTables.h"
11#include "Features.h"
12#include "Lookups.h"
13#include "ScriptAndLanguage.h"
14#include "GlyphDefinitionTables.h"
15#include "GlyphSubstitutionTables.h"
16#include "SingleSubstitutionSubtables.h"
17#include "MultipleSubstSubtables.h"
18#include "AlternateSubstSubtables.h"
19#include "LigatureSubstSubtables.h"
20#include "ContextualSubstSubtables.h"
21#include "ExtensionSubtables.h"
22#include "LookupProcessor.h"
23#include "GlyphSubstLookupProc.h"
24#include "LESwaps.h"
25
26U_NAMESPACE_BEGIN
27
28GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor(
29 const GlyphSubstitutionTableHeader *glyphSubstitutionTableHeader,
30 LETag scriptTag, LETag languageTag, const LEGlyphFilter *filter, const LETag *featureOrder)
31 : LookupProcessor(
32 (char *) glyphSubstitutionTableHeader,
33 SWAPW(glyphSubstitutionTableHeader->scriptListOffset),
34 SWAPW(glyphSubstitutionTableHeader->featureListOffset),
35 SWAPW(glyphSubstitutionTableHeader->lookupListOffset),
36 scriptTag, languageTag, featureOrder), fFilter(filter)
37{
38 // anything?
39}
40
41GlyphSubstitutionLookupProcessor::GlyphSubstitutionLookupProcessor()
42{
43}
44
45le_uint32 GlyphSubstitutionLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
46 GlyphIterator *glyphIterator, const LEFontInstance *fontInstance) const
47{
48 le_uint32 delta = 0;
49
50 switch(lookupType)
51 {
52 case 0:
53 break;
54
55 case gsstSingle:
56 {
57 const SingleSubstitutionSubtable *subtable = (const SingleSubstitutionSubtable *) lookupSubtable;
58
59 delta = subtable->process(glyphIterator, fFilter);
60 break;
61 }
62
63 case gsstMultiple:
64 {
65 const MultipleSubstitutionSubtable *subtable = (const MultipleSubstitutionSubtable *) lookupSubtable;
66
67 delta = subtable->process(glyphIterator, fFilter);
68 break;
69 }
70
71 case gsstAlternate:
72 {
73 const AlternateSubstitutionSubtable *subtable = (const AlternateSubstitutionSubtable *) lookupSubtable;
74
75 delta = subtable->process(glyphIterator, fFilter);
76 break;
77 }
78
79 case gsstLigature:
80 {
81 const LigatureSubstitutionSubtable *subtable = (const LigatureSubstitutionSubtable *) lookupSubtable;
82
83 delta = subtable->process(glyphIterator, fFilter);
84 break;
85 }
86
87 case gsstContext:
88 {
89 const ContextualSubstitutionSubtable *subtable = (const ContextualSubstitutionSubtable *) lookupSubtable;
90
91 delta = subtable->process(this, glyphIterator, fontInstance);
92 break;
93 }
94
95 case gsstChainingContext:
96 {
97 const ChainingContextualSubstitutionSubtable *subtable = (const ChainingContextualSubstitutionSubtable *) lookupSubtable;
98
99 delta = subtable->process(this, glyphIterator, fontInstance);
100 break;
101 }
102
103 case gsstExtension:
104 {
105 const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
106
107 delta = subtable->process(this, lookupType, glyphIterator, fontInstance);
108 break;
109 }
110
111 default:
112 break;
113 }
114
115 return delta;
116}
117
118GlyphSubstitutionLookupProcessor::~GlyphSubstitutionLookupProcessor()
119{
120}
121
122U_NAMESPACE_END