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