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