]> git.saurik.com Git - apple/icu.git/blame - icuSources/layout/GlyphPosnLookupProc.cpp
ICU-6.2.16.tar.gz
[apple/icu.git] / icuSources / layout / GlyphPosnLookupProc.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 "LEFontInstance.h"
9#include "OpenTypeTables.h"
10#include "Features.h"
11#include "Lookups.h"
12#include "ScriptAndLanguage.h"
13#include "GlyphDefinitionTables.h"
14#include "GlyphPositioningTables.h"
15#include "SinglePositioningSubtables.h"
16#include "PairPositioningSubtables.h"
17#include "CursiveAttachmentSubtables.h"
18#include "MarkToBasePosnSubtables.h"
19#include "MarkToLigaturePosnSubtables.h"
20#include "MarkToMarkPosnSubtables.h"
21//#include "ContextualPositioningSubtables.h"
22#include "ContextualSubstSubtables.h"
23#include "ExtensionSubtables.h"
24#include "LookupProcessor.h"
25#include "GlyphPosnLookupProc.h"
26#include "LESwaps.h"
27
28U_NAMESPACE_BEGIN
29
30// Aside from the names, the contextual positioning subtables are
31// the same as the contextual substitution subtables.
32typedef ContextualSubstitutionSubtable ContextualPositioningSubtable;
33typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable;
34
35GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
36 const GlyphPositioningTableHeader *glyphPositioningTableHeader,
37 LETag scriptTag, LETag languageTag, const LETag *featureOrder)
38 : LookupProcessor(
39 (char *) glyphPositioningTableHeader,
40 SWAPW(glyphPositioningTableHeader->scriptListOffset),
41 SWAPW(glyphPositioningTableHeader->featureListOffset),
42 SWAPW(glyphPositioningTableHeader->lookupListOffset),
43 scriptTag, languageTag, featureOrder)
44{
45 // anything?
46}
47
48GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor()
49{
50}
51
52le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
53 GlyphIterator *glyphIterator,
54 const LEFontInstance *fontInstance) const
55{
56 le_uint32 delta = 0;
57
58 switch(lookupType)
59 {
60 case 0:
61 break;
62
63 case gpstSingle:
64 {
65 const SinglePositioningSubtable *subtable = (const SinglePositioningSubtable *) lookupSubtable;
66
67 delta = subtable->process(glyphIterator, fontInstance);
68 break;
69 }
70
71 case gpstPair:
72 {
73 const PairPositioningSubtable *subtable = (const PairPositioningSubtable *) lookupSubtable;
74
75 delta = subtable->process(glyphIterator, fontInstance);
76 break;
77 }
78
79 case gpstCursive:
80 {
81 const CursiveAttachmentSubtable *subtable = (const CursiveAttachmentSubtable *) lookupSubtable;
82
83 delta = subtable->process(glyphIterator, fontInstance);
84 break;
85 }
86
87 case gpstMarkToBase:
88 {
89 const MarkToBasePositioningSubtable *subtable = (const MarkToBasePositioningSubtable *) lookupSubtable;
90
91 delta = subtable->process(glyphIterator, fontInstance);
92 break;
93 }
94
95 case gpstMarkToLigature:
96 {
97 const MarkToLigaturePositioningSubtable *subtable = (const MarkToLigaturePositioningSubtable *) lookupSubtable;
98
99 delta = subtable->process(glyphIterator, fontInstance);
100 break;
101 }
102
103 case gpstMarkToMark:
104 {
105 const MarkToMarkPositioningSubtable *subtable = (const MarkToMarkPositioningSubtable *) lookupSubtable;
106
107 delta = subtable->process(glyphIterator, fontInstance);
108 break;
109 }
110
111 case gpstContext:
112 {
113 const ContextualPositioningSubtable *subtable = (const ContextualPositioningSubtable *) lookupSubtable;
114
115 delta = subtable->process(this, glyphIterator, fontInstance);
116 break;
117 }
118
119 case gpstChainedContext:
120 {
121 const ChainingContextualPositioningSubtable *subtable = (const ChainingContextualPositioningSubtable *) lookupSubtable;
122
123 delta = subtable->process(this, glyphIterator, fontInstance);
124 break;
125 }
126
127 case gpstExtension:
128 {
129 const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
130
131 delta = subtable->process(this, lookupType, glyphIterator, fontInstance);
132 break;
133 }
134
135 default:
136 break;
137 }
138
139 return delta;
140}
141
142GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor()
143{
144}
145
146U_NAMESPACE_END