2
|
1 |
/*
|
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
3 |
*
|
|
4 |
* This code is free software; you can redistribute it and/or modify it
|
|
5 |
* under the terms of the GNU General Public License version 2 only, as
|
|
6 |
* published by the Free Software Foundation. Sun designates this
|
|
7 |
* particular file as subject to the "Classpath" exception as provided
|
|
8 |
* by Sun in the LICENSE file that accompanied this code.
|
|
9 |
*
|
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
14 |
* accompanied this code).
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License version
|
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
19 |
*
|
|
20 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
21 |
* CA 95054 USA or visit www.sun.com if you need additional information or
|
|
22 |
* have any questions.
|
|
23 |
*
|
|
24 |
*/
|
|
25 |
|
|
26 |
/*
|
|
27 |
*
|
|
28 |
* (C) Copyright IBM Corp. 1998 - 2005 - All Rights Reserved
|
|
29 |
*
|
|
30 |
*/
|
|
31 |
|
|
32 |
#include "LETypes.h"
|
|
33 |
#include "LEFontInstance.h"
|
|
34 |
#include "OpenTypeTables.h"
|
|
35 |
#include "Features.h"
|
|
36 |
#include "Lookups.h"
|
|
37 |
#include "ScriptAndLanguage.h"
|
|
38 |
#include "GlyphDefinitionTables.h"
|
|
39 |
#include "GlyphPositioningTables.h"
|
|
40 |
#include "SinglePositioningSubtables.h"
|
|
41 |
#include "PairPositioningSubtables.h"
|
|
42 |
#include "CursiveAttachmentSubtables.h"
|
|
43 |
#include "MarkToBasePosnSubtables.h"
|
|
44 |
#include "MarkToLigaturePosnSubtables.h"
|
|
45 |
#include "MarkToMarkPosnSubtables.h"
|
|
46 |
//#include "ContextualPositioningSubtables.h"
|
|
47 |
#include "ContextualSubstSubtables.h"
|
|
48 |
#include "ExtensionSubtables.h"
|
|
49 |
#include "LookupProcessor.h"
|
|
50 |
#include "GlyphPosnLookupProc.h"
|
|
51 |
#include "LESwaps.h"
|
|
52 |
|
|
53 |
// Aside from the names, the contextual positioning subtables are
|
|
54 |
// the same as the contextual substitution subtables.
|
|
55 |
typedef ContextualSubstitutionSubtable ContextualPositioningSubtable;
|
|
56 |
typedef ChainingContextualSubstitutionSubtable ChainingContextualPositioningSubtable;
|
|
57 |
|
|
58 |
GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor(
|
|
59 |
const GlyphPositioningTableHeader *glyphPositioningTableHeader,
|
|
60 |
LETag scriptTag, LETag languageTag,
|
|
61 |
const FeatureMap *featureMap, le_int32 featureMapCount, le_bool featureOrder)
|
|
62 |
: LookupProcessor(
|
|
63 |
(char *) glyphPositioningTableHeader,
|
|
64 |
SWAPW(glyphPositioningTableHeader->scriptListOffset),
|
|
65 |
SWAPW(glyphPositioningTableHeader->featureListOffset),
|
|
66 |
SWAPW(glyphPositioningTableHeader->lookupListOffset),
|
|
67 |
scriptTag, languageTag, featureMap, featureMapCount, featureOrder)
|
|
68 |
{
|
|
69 |
// anything?
|
|
70 |
}
|
|
71 |
|
|
72 |
GlyphPositioningLookupProcessor::GlyphPositioningLookupProcessor()
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
|
76 |
le_uint32 GlyphPositioningLookupProcessor::applySubtable(const LookupSubtable *lookupSubtable, le_uint16 lookupType,
|
|
77 |
GlyphIterator *glyphIterator,
|
|
78 |
const LEFontInstance *fontInstance) const
|
|
79 |
{
|
|
80 |
le_uint32 delta = 0;
|
|
81 |
|
|
82 |
switch(lookupType)
|
|
83 |
{
|
|
84 |
case 0:
|
|
85 |
break;
|
|
86 |
|
|
87 |
case gpstSingle:
|
|
88 |
{
|
|
89 |
const SinglePositioningSubtable *subtable = (const SinglePositioningSubtable *) lookupSubtable;
|
|
90 |
|
|
91 |
delta = subtable->process(glyphIterator, fontInstance);
|
|
92 |
break;
|
|
93 |
}
|
|
94 |
|
|
95 |
case gpstPair:
|
|
96 |
{
|
|
97 |
const PairPositioningSubtable *subtable = (const PairPositioningSubtable *) lookupSubtable;
|
|
98 |
|
|
99 |
delta = subtable->process(glyphIterator, fontInstance);
|
|
100 |
break;
|
|
101 |
}
|
|
102 |
|
|
103 |
case gpstCursive:
|
|
104 |
{
|
|
105 |
const CursiveAttachmentSubtable *subtable = (const CursiveAttachmentSubtable *) lookupSubtable;
|
|
106 |
|
|
107 |
delta = subtable->process(glyphIterator, fontInstance);
|
|
108 |
break;
|
|
109 |
}
|
|
110 |
|
|
111 |
case gpstMarkToBase:
|
|
112 |
{
|
|
113 |
const MarkToBasePositioningSubtable *subtable = (const MarkToBasePositioningSubtable *) lookupSubtable;
|
|
114 |
|
|
115 |
delta = subtable->process(glyphIterator, fontInstance);
|
|
116 |
break;
|
|
117 |
}
|
|
118 |
|
|
119 |
case gpstMarkToLigature:
|
|
120 |
{
|
|
121 |
const MarkToLigaturePositioningSubtable *subtable = (const MarkToLigaturePositioningSubtable *) lookupSubtable;
|
|
122 |
|
|
123 |
delta = subtable->process(glyphIterator, fontInstance);
|
|
124 |
break;
|
|
125 |
}
|
|
126 |
|
|
127 |
case gpstMarkToMark:
|
|
128 |
{
|
|
129 |
const MarkToMarkPositioningSubtable *subtable = (const MarkToMarkPositioningSubtable *) lookupSubtable;
|
|
130 |
|
|
131 |
delta = subtable->process(glyphIterator, fontInstance);
|
|
132 |
break;
|
|
133 |
}
|
|
134 |
|
|
135 |
case gpstContext:
|
|
136 |
{
|
|
137 |
const ContextualPositioningSubtable *subtable = (const ContextualPositioningSubtable *) lookupSubtable;
|
|
138 |
|
|
139 |
delta = subtable->process(this, glyphIterator, fontInstance);
|
|
140 |
break;
|
|
141 |
}
|
|
142 |
|
|
143 |
case gpstChainedContext:
|
|
144 |
{
|
|
145 |
const ChainingContextualPositioningSubtable *subtable = (const ChainingContextualPositioningSubtable *) lookupSubtable;
|
|
146 |
|
|
147 |
delta = subtable->process(this, glyphIterator, fontInstance);
|
|
148 |
break;
|
|
149 |
}
|
|
150 |
|
|
151 |
case gpstExtension:
|
|
152 |
{
|
|
153 |
const ExtensionSubtable *subtable = (const ExtensionSubtable *) lookupSubtable;
|
|
154 |
|
|
155 |
delta = subtable->process(this, lookupType, glyphIterator, fontInstance);
|
|
156 |
break;
|
|
157 |
}
|
|
158 |
|
|
159 |
default:
|
|
160 |
break;
|
|
161 |
}
|
|
162 |
|
|
163 |
return delta;
|
|
164 |
}
|
|
165 |
|
|
166 |
GlyphPositioningLookupProcessor::~GlyphPositioningLookupProcessor()
|
|
167 |
{
|
|
168 |
}
|