• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * (C) Copyright IBM Corp. and others 1998-2013 - All Rights Reserved
4  *
5  */
6 
7 #ifndef __MORPHTABLES_H
8 #define __MORPHTABLES_H
9 
10 /**
11  * \file
12  * \internal
13  */
14 
15 #include "LETypes.h"
16 #include "LayoutTables.h"
17 
18 U_NAMESPACE_BEGIN
19 
20 class LEGlyphStorage;
21 
22 typedef le_uint32 FeatureFlags;
23 
24 typedef le_int16 FeatureType;
25 typedef le_int16 FeatureSetting;
26 
27 struct FeatureTableEntry
28 {
29     FeatureType     featureType;
30     FeatureSetting  featureSetting;
31     FeatureFlags    enableFlags;
32     FeatureFlags    disableFlags;
33 };
34 
35 struct ChainHeader
36 {
37     FeatureFlags        defaultFlags;
38     le_uint32           chainLength;
39     le_int16           nFeatureEntries;
40     le_int16           nSubtables;
41     FeatureTableEntry   featureTable[ANY_NUMBER];
42 };
43 
44 struct MorphTableHeader
45 {
46     le_int32    version;
47     le_uint32   nChains;
48     ChainHeader chains[ANY_NUMBER];
49 
50     void process(LEGlyphStorage &glyphStorage) const;
51 };
52 
53 typedef le_int16 SubtableCoverage;
54 typedef le_uint32 SubtableCoverage2;
55 
56 enum SubtableCoverageFlags
57 {
58     scfVertical = 0x8000,
59     scfReverse  = 0x4000,
60     scfIgnoreVt = 0x2000,
61     scfReserved = 0x1FF8,
62     scfTypeMask = 0x0007
63 };
64 
65 enum MorphSubtableType
66 {
67     mstIndicRearrangement               = 0,
68     mstContextualGlyphSubstitution      = 1,
69     mstLigatureSubstitution             = 2,
70     mstReservedUnused                   = 3,
71     mstNonContextualGlyphSubstitution   = 4,
72     mstContextualGlyphInsertion         = 5
73 };
74 
75 struct MorphSubtableHeader
76 {
77     le_int16           length;
78     SubtableCoverage    coverage;
79     FeatureFlags        subtableFeatures;
80 
81     void process(LEGlyphStorage &glyphStorage) const;
82 };
83 
84 enum SubtableCoverageFlags2
85 {
86     scfVertical2 = 0x80000000,
87     scfReverse2  = 0x40000000,
88     scfIgnoreVt2 = 0x20000000,
89     scfReserved2 = 0x1FFFFF00,
90     scfTypeMask2 = 0x000000FF
91 };
92 
93 struct MorphSubtableHeader2
94 {
95     le_uint32           length;
96     SubtableCoverage2    coverage;
97     FeatureFlags        subtableFeatures;
98 
99     void process(LEGlyphStorage &glyphStorage) const;
100 };
101 
102 struct ChainHeader2
103 {
104     FeatureFlags        defaultFlags;
105     le_uint32           chainLength;
106     le_uint32           nFeatureEntries;
107     le_uint32           nSubtables;
108     FeatureTableEntry   featureTable[ANY_NUMBER];
109 };
110 
111 struct MorphTableHeader2
112 {
113     le_int32    version;
114     le_uint32   nChains;
115     ChainHeader2 chains[ANY_NUMBER];
116 
117     void process(LEGlyphStorage &glyphStorage, le_int32 typoFlags) const;
118 };
119 
120 /*
121  * AAT Font Features
122  * source: https://developer.apple.com/fonts/registry/
123  * (plus addition from ATS/SFNTLayoutTypes.h)
124  */
125 
126 enum {
127 
128    allTypographicFeaturesType = 0,
129 
130       allTypeFeaturesOnSelector            = 0,
131       allTypeFeaturesOffSelector           = 1,
132 
133    ligaturesType = 1,
134 
135       requiredLigaturesOnSelector          = 0,
136       requiredLigaturesOffSelector         = 1,
137       commonLigaturesOnSelector            = 2,
138       commonLigaturesOffSelector           = 3,
139       rareLigaturesOnSelector              = 4,
140       rareLigaturesOffSelector             = 5,
141       logosOnSelector                      = 6,
142       logosOffSelector                     = 7,
143       rebusPicturesOnSelector              = 8,
144       rebusPicturesOffSelector             = 9,
145       diphthongLigaturesOnSelector         = 10,
146       diphthongLigaturesOffSelector        = 11,
147       squaredLigaturesOnSelector           = 12,
148       squaredLigaturesOffSelector          = 13,
149       abbrevSquaredLigaturesOnSelector     = 14,
150       abbrevSquaredLigaturesOffSelector    = 15,
151       symbolLigaturesOnSelector            = 16,
152       symbolLigaturesOffSelector           = 17,
153       contextualLigaturesOnSelector        = 18,
154       contextualLigaturesOffSelector       = 19,
155       historicalLigaturesOnSelector        = 20,
156       historicalLigaturesOffSelector       = 21,
157 
158    cursiveConnectionType = 2,
159 
160       unconnectedSelector                  = 0,
161       partiallyConnectedSelector           = 1,
162       cursiveSelector                      = 2,
163 
164    letterCaseType = 3,
165 
166       upperAndLowerCaseSelector            = 0,
167       allCapsSelector                      = 1,
168       allLowerCaseSelector                 = 2,
169       smallCapsSelector                    = 3,
170       initialCapsSelector                  = 4,
171       initialCapsAndSmallCapsSelector      = 5,
172 
173    verticalSubstitutionType = 4,
174 
175       substituteVerticalFormsOnSelector    = 0,
176       substituteVerticalFormsOffSelector   = 1,
177 
178    linguisticRearrangementType = 5,
179 
180       linguisticRearrangementOnSelector    = 0,
181       linguisticRearrangementOffSelector   = 1,
182 
183    numberSpacingType = 6,
184 
185       monospacedNumbersSelector            = 0,
186       proportionalNumbersSelector          = 1,
187 
188    /*
189    appleReserved1Type = 7,
190    */
191 
192    smartSwashType = 8,
193 
194       wordInitialSwashesOnSelector         = 0,
195       wordInitialSwashesOffSelector        = 1,
196       wordFinalSwashesOnSelector           = 2,
197       wordFinalSwashesOffSelector          = 3,
198       lineInitialSwashesOnSelector         = 4,
199       lineInitialSwashesOffSelector        = 5,
200       lineFinalSwashesOnSelector           = 6,
201       lineFinalSwashesOffSelector          = 7,
202       nonFinalSwashesOnSelector            = 8,
203       nonFinalSwashesOffSelector           = 9,
204 
205    diacriticsType = 9,
206 
207       showDiacriticsSelector               = 0,
208       hideDiacriticsSelector               = 1,
209       decomposeDiacriticsSelector          = 2,
210 
211    verticalPositionType = 10,
212 
213       normalPositionSelector               = 0,
214       superiorsSelector                    = 1,
215       inferiorsSelector                    = 2,
216       ordinalsSelector                     = 3,
217 
218    fractionsType = 11,
219 
220       noFractionsSelector                  = 0,
221       verticalFractionsSelector            = 1,
222       diagonalFractionsSelector            = 2,
223 
224    /*
225    appleReserved2Type = 12,
226    */
227 
228    overlappingCharactersType = 13,
229 
230       preventOverlapOnSelector             = 0,
231       preventOverlapOffSelector            = 1,
232 
233    typographicExtrasType = 14,
234 
235       hyphensToEmDashOnSelector            = 0,
236       hyphensToEmDashOffSelector           = 1,
237       hyphenToEnDashOnSelector             = 2,
238       hyphenToEnDashOffSelector            = 3,
239       unslashedZeroOnSelector              = 4,
240       slashedZeroOffSelector               = 4,
241       unslashedZeroOffSelector             = 5,
242       slashedZeroOnSelector                = 5,
243       formInterrobangOnSelector            = 6,
244       formInterrobangOffSelector           = 7,
245       smartQuotesOnSelector                = 8,
246       smartQuotesOffSelector               = 9,
247       periodsToEllipsisOnSelector          = 10,
248       periodsToEllipsisOffSelector         = 11,
249 
250    mathematicalExtrasType = 15,
251 
252       hyphenToMinusOnSelector              = 0,
253       hyphenToMinusOffSelector             = 1,
254       asteriskToMultiplyOnSelector         = 2,
255       asteriskToMultiplyOffSelector        = 3,
256       slashToDivideOnSelector              = 4,
257       slashToDivideOffSelector             = 5,
258       inequalityLigaturesOnSelector        = 6,
259       inequalityLigaturesOffSelector       = 7,
260       exponentsOnSelector                  = 8,
261       exponentsOffSelector                 = 9,
262 
263    ornamentSetsType = 16,
264 
265       noOrnamentsSelector                  = 0,
266       dingbatsSelector                     = 1,
267       piCharactersSelector                 = 2,
268       fleuronsSelector                     = 3,
269       decorativeBordersSelector            = 4,
270       internationalSymbolsSelector         = 5,
271       mathSymbolsSelector                  = 6,
272 
273    characterAlternativesType = 17,
274 
275       noAlternatesSelector                 = 0,
276 
277    designComplexityType = 18,
278 
279       designLevel1Selector                 = 0,
280       designLevel2Selector                 = 1,
281       designLevel3Selector                 = 2,
282       designLevel4Selector                 = 3,
283       designLevel5Selector                 = 4,
284       designLevel6Selector                 = 5,
285       designLevel7Selector                 = 6,
286 
287    styleOptionsType = 19,
288 
289       noStyleOptionsSelector               = 0,
290       displayTextSelector                  = 1,
291       engravedTextSelector                 = 2,
292       illuminatedCapsSelector              = 3,
293       titlingCapsSelector                  = 4,
294       tallCapsSelector                     = 5,
295 
296    characterShapeType = 20,
297 
298       traditionalCharactersSelector        = 0,
299       simplifiedCharactersSelector         = 1,
300       jis1978CharactersSelector            = 2,
301       jis1983CharactersSelector            = 3,
302       jis1990CharactersSelector            = 4,
303       traditionalAltOneSelector            = 5,
304       traditionalAltTwoSelector            = 6,
305       traditionalAltThreeSelector          = 7,
306       traditionalAltFourSelector           = 8,
307       traditionalAltFiveSelector           = 9,
308       expertCharactersSelector             = 10,
309 
310    numberCaseType = 21,
311 
312       lowerCaseNumbersSelector             = 0,
313       upperCaseNumbersSelector             = 1,
314 
315    textSpacingType = 22,
316 
317       proportionalTextSelector             = 0,
318       monospacedTextSelector               = 1,
319       halfWidthTextSelector                = 2,
320       normallySpacedTextSelector           = 3,
321 
322    transliterationType = 23,
323 
324       noTransliterationSelector            = 0,
325       hanjaToHangulSelector                = 1,
326       hiraganaToKatakanaSelector           = 2,
327       katakanaToHiraganaSelector           = 3,
328       kanaToRomanizationSelector           = 4,
329       romanizationToHiraganaSelector       = 5,
330       romanizationToKatakanaSelector       = 6,
331       hanjaToHangulAltOneSelector          = 7,
332       hanjaToHangulAltTwoSelector          = 8,
333       hanjaToHangulAltThreeSelector        = 9,
334 
335    annotationType = 24,
336 
337       noAnnotationSelector                 = 0,
338       boxAnnotationSelector                = 1,
339       roundedBoxAnnotationSelector         = 2,
340       circleAnnotationSelector             = 3,
341       invertedCircleAnnotationSelector     = 4,
342       parenthesisAnnotationSelector        = 5,
343       periodAnnotationSelector             = 6,
344       romanNumeralAnnotationSelector       = 7,
345       diamondAnnotationSelector            = 8,
346 
347    kanaSpacingType = 25,
348 
349       fullWidthKanaSelector                = 0,
350       proportionalKanaSelector             = 1,
351 
352    ideographicSpacingType = 26,
353 
354       fullWidthIdeographsSelector          = 0,
355       proportionalIdeographsSelector       = 1,
356 
357    cjkRomanSpacingType = 103,
358 
359       halfWidthCJKRomanSelector            = 0,
360       proportionalCJKRomanSelector         = 1,
361       defaultCJKRomanSelector              = 2,
362       fullWidthCJKRomanSelector            = 3,
363 
364    rubyKanaType = 28,
365 
366       rubyKanaOnSelector                = 2,
367       rubyKanaOffSelector               = 3,
368 
369 /* The following types are provided for compatibility; note that
370    their use is deprecated. */
371 
372    adobeCharacterSpacingType = 100,        /* prefer 22 */
373    adobeKanaSpacingType = 101,             /* prefer 25 */
374    adobeKanjiSpacingType = 102,            /* prefer 26 */
375    adobeSquareLigatures = 104,             /* prefer 1 */
376 
377    lastFeatureType = -1
378 };
379 
380 U_NAMESPACE_END
381 #endif
382 
383