1/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkPanose_DEFINED
9#define SkPanose_DEFINED
10
11#include "SkOTTableTypes.h"
12
13#pragma pack(push, 1)
14
15struct SkPanose {
16    //This value changes the meaning of the following 9 bytes.
17    enum class FamilyType : SK_OT_BYTE {
18        Any = 0,
19        NoFit = 1,
20        TextAndDisplay = 2,
21        Script = 3,
22        Decorative = 4,
23        Pictoral = 5,
24    } bFamilyType;
25
26    union Data {
27        struct TextAndDisplay {
28            enum class SerifStyle : SK_OT_BYTE {
29                Any = 0,
30                NoFit = 1,
31                Cove = 2,
32                ObtuseCove = 3,
33                SquareCove = 4,
34                ObtuseSquareCove = 5,
35                Square = 6,
36                Thin = 7,
37                Bone = 8,
38                Exaggerated = 9,
39                Triangle = 10,
40                NormalSans = 11,
41                ObtuseSans = 12,
42                PerpSans = 13,
43                Flared = 14,
44                Rounded = 15,
45            } bSerifStyle;
46
47            enum class Weight : SK_OT_BYTE {
48                Any = 0,
49                NoFit = 1,
50                VeryLight = 2,
51                Light = 3,
52                Thin = 4,
53                Book = 5,
54                Medium = 6,
55                Demi = 7,
56                Bold = 8,
57                Heavy = 9,
58                Black = 10,
59                ExtraBlack = 11,
60            } bWeight;
61
62            enum class Proportion : SK_OT_BYTE {
63                Any = 0,
64                NoFit = 1,
65                OldStyle = 2,
66                Modern = 3,
67                EvenWidth = 4,
68                Expanded = 5,
69                Condensed = 6,
70                VeryExpanded = 7,
71                VeryCondensed = 8,
72                Monospaced = 9,
73            } bProportion;
74
75            enum class Contrast : SK_OT_BYTE {
76                Any = 0,
77                NoFit = 1,
78                None = 2,
79                VeryLow = 3,
80                Low = 4,
81                MediumLow = 5,
82                Medium = 6,
83                MediumHigh = 7,
84                High = 8,
85                VeryHigh = 9,
86            } bContrast;
87
88#ifdef SK_WIN_PANOSE
89            //This is what Windows (and FontForge and Apple TT spec) define.
90            //The Impact font uses 9.
91            enum class StrokeVariation : SK_OT_BYTE {
92                Any = 0,
93                NoFit = 1,
94                GradualDiagonal = 2,
95                GradualTransitional = 3,
96                GradualVertical = 4,
97                GradualHorizontal = 5,
98                RapidVertical = 6,
99                RapidHorizontal = 7,
100                InstantVertical = 8,
101            } bStrokeVariation;
102#else
103            //Stroke variation description in OT OS/2 ver0,ver1 is incorrect.
104            //This is what HP Panose says.
105            enum class StrokeVariation : SK_OT_BYTE {
106                Any = 0,
107                NoFit = 1,
108                NoVariation = 2,
109                Gradual_Diagonal = 3,
110                Gradual_Transitional = 4,
111                Gradual_Vertical = 5,
112                Gradual_Horizontal = 6,
113                Rapid_Vertical = 7,
114                Rapid_Horizontal = 8,
115                Instant_Vertical = 9,
116                Instant_Horizontal = 10,
117            } bStrokeVariation;
118#endif
119
120            enum class ArmStyle : SK_OT_BYTE {
121                Any = 0,
122                NoFit = 1,
123                StraightArms_Horizontal = 2,
124                StraightArms_Wedge = 3,
125                StraightArms_Vertical = 4,
126                StraightArms_SingleSerif = 5,
127                StraightArms_DoubleSerif = 6,
128                NonStraightArms_Horizontal = 7,
129                NonStraightArms_Wedge = 8,
130                NonStraightArms_Vertical = 9,
131                NonStraightArms_SingleSerif = 10,
132                NonStraightArms_DoubleSerif = 11,
133            } bArmStyle;
134
135            enum class Letterform : SK_OT_BYTE {
136                Any = 0,
137                NoFit = 1,
138                Normal_Contact = 2,
139                Normal_Weighted = 3,
140                Normal_Boxed = 4,
141                Normal_Flattened = 5,
142                Normal_Rounded = 6,
143                Normal_OffCenter = 7,
144                Normal_Square = 8,
145                Oblique_Contact = 9,
146                Oblique_Weighted = 10,
147                Oblique_Boxed = 11,
148                Oblique_Flattened = 12,
149                Oblique_Rounded = 13,
150                Oblique_OffCenter = 14,
151                Oblique_Square = 15,
152            } bLetterform;
153
154            enum class Midline : SK_OT_BYTE {
155                Any = 0,
156                NoFit = 1,
157                Standard_Trimmed = 2,
158                Standard_Pointed = 3,
159                Standard_Serifed = 4,
160                High_Trimmed = 5,
161                High_Pointed = 6,
162                High_Serifed = 7,
163                Constant_Trimmed = 8,
164                Constant_Pointed = 9,
165                Constant_Serifed = 10,
166                Low_Trimmed = 11,
167                Low_Pointed = 12,
168                Low_Serifed = 13,
169            } bMidline;
170
171            enum class XHeight : SK_OT_BYTE {
172                Any = 0,
173                NoFit = 1,
174                Constant_Small = 2,
175                Constant_Standard = 3,
176                Constant_Large = 4,
177                Ducking_Small = 5,
178                Ducking_Standard = 6,
179                Ducking_Large = 7,
180            } bXHeight;
181        } textAndDisplay;
182
183        struct Script {
184            enum class ToolKind : SK_OT_BYTE {
185                Any = 0,
186                NoFit = 1,
187                FlatNib = 2,
188                PressurePoint = 3,
189                Engraved = 4,
190                Ball = 5,
191                Brush = 6,
192                Rough = 7,
193                FeltPen = 8,
194                WildBrush = 9,
195            } bToolKind;
196
197            enum class Weight : SK_OT_BYTE {
198                Any = 0,
199                NoFit = 1,
200                VeryLight = 2,
201                Light = 3,
202                Thin = 4,
203                Book = 5,
204                Medium = 6,
205                Demi = 7,
206                Bold = 8,
207                Heavy = 9,
208                Black = 10,
209                ExtraBlack = 11,
210            } bWeight;
211
212            enum class Spacing : SK_OT_BYTE {
213                Any = 0,
214                NoFit = 1,
215                ProportionalSpaced = 2,
216                Monospaced = 3,
217            } bSpacing;
218
219            enum class AspectRatio : SK_OT_BYTE {
220                Any = 0,
221                NoFit = 1,
222                VeryCondensed = 2,
223                Condensed = 3,
224                Normal = 4,
225                Expanded = 5,
226                VeryExpanded = 6,
227            } bAspectRatio;
228
229            enum class Contrast : SK_OT_BYTE {
230                Any = 0,
231                NoFit = 1,
232                None = 2,
233                VeryLow = 3,
234                Low = 4,
235                MediumLow = 5,
236                Medium = 6,
237                MediumHigh = 7,
238                High = 8,
239                VeryHigh = 9,
240            } bContrast;
241
242            enum class Topology : SK_OT_BYTE {
243                Any = 0,
244                NoFit = 1,
245                Roman_Disconnected = 2,
246                Roman_Trailing = 3,
247                Roman_Connected = 4,
248                Cursive_Disconnected = 5,
249                Cursive_Trailing = 6,
250                Cursive_Connected = 7,
251                Blackletter_Disconnected = 8,
252                Blackletter_Trailing = 9,
253                Blackletter_Connected = 10,
254            } bTopology;
255
256            enum class Form : SK_OT_BYTE {
257                Any = 0,
258                NoFit = 1,
259                Upright_NoWrapping = 2,
260                Upright_SomeWrapping = 3,
261                Upright_MoreWrapping = 4,
262                Upright_ExtremeWrapping = 5,
263                Oblique_NoWrapping = 6,
264                Oblique_SomeWrapping = 7,
265                Oblique_MoreWrapping = 8,
266                Oblique_ExtremeWrapping = 9,
267                Exaggerated_NoWrapping = 10,
268                Exaggerated_SomeWrapping = 11,
269                Exaggerated_MoreWrapping = 12,
270                Exaggerated_ExtremeWrapping = 13,
271            } bForm;
272
273            enum class Finials : SK_OT_BYTE {
274                Any = 0,
275                NoFit = 1,
276                None_NoLoops = 2,
277                None_ClosedLoops = 3,
278                None_OpenLoops = 4,
279                Sharp_NoLoops = 5,
280                Sharp_ClosedLoops = 6,
281                Sharp_OpenLoops = 7,
282                Tapered_NoLoops = 8,
283                Tapered_ClosedLoops = 9,
284                Tapered_OpenLoops = 10,
285                Round_NoLoops = 11,
286                Round_ClosedLoops = 12,
287                Round_OpenLoops = 13,
288            } bFinials;
289
290            enum class XAscent : SK_OT_BYTE {
291                Any = 0,
292                NoFit = 1,
293                VeryLow = 2,
294                Low = 3,
295                Medium = 4,
296                High = 5,
297                VeryHigh = 6,
298            } bXAscent;
299        } script;
300
301        struct Decorative {
302            enum class Class : SK_OT_BYTE {
303                Any = 0,
304                NoFit = 1,
305                Derivative = 2,
306                NonStandard_Topology = 3,
307                NonStandard_Elements = 4,
308                NonStandard_Aspect = 5,
309                Initials = 6,
310                Cartoon = 7,
311                PictureStems = 8,
312                Ornamented = 9,
313                TextAndBackground = 10,
314                Collage = 11,
315                Montage = 12,
316            } bClass;
317
318            enum class Weight : SK_OT_BYTE {
319                Any = 0,
320                NoFit = 1,
321                VeryLight = 2,
322                Light = 3,
323                Thin = 4,
324                Book = 5,
325                Medium = 6,
326                Demi = 7,
327                Bold = 8,
328                Heavy = 9,
329                Black = 10,
330                ExtraBlack = 11,
331            } bWeight;
332
333            enum class Aspect : SK_OT_BYTE {
334                Any = 0,
335                NoFit = 1,
336                SuperCondensed = 2,
337                VeryCondensed = 3,
338                Condensed = 4,
339                Normal = 5,
340                Extended = 6,
341                VeryExtended = 7,
342                SuperExtended = 8,
343                Monospaced = 9,
344            } bAspect;
345
346            enum class Contrast : SK_OT_BYTE {
347                Any = 0,
348                NoFit = 1,
349                None = 2,
350                VeryLow = 3,
351                Low = 4,
352                MediumLow = 5,
353                Medium = 6,
354                MediumHigh = 7,
355                High = 8,
356                VeryHigh = 9,
357                HorizontalLow = 10,
358                HorizontalMedium = 11,
359                HorizontalHigh = 12,
360                Broken = 13,
361            } bContrast;
362
363            enum class SerifVariant : SK_OT_BYTE {
364                Any = 0,
365                NoFit = 1,
366                Cove = 2,
367                ObtuseCove = 3,
368                SquareCove = 4,
369                ObtuseSquareCove = 5,
370                Square = 6,
371                Thin = 7,
372                Oval = 8,
373                Exaggerated = 9,
374                Triangle = 10,
375                NormalSans = 11,
376                ObtuseSans = 12,
377                PerpendicularSans = 13,
378                Flared = 14,
379                Rounded = 15,
380                Script = 16,
381            } bSerifVariant;
382
383            enum class Treatment : SK_OT_BYTE {
384                Any = 0,
385                NoFit = 1,
386                None_StandardSolidFill = 2,
387                White_NoFill = 3,
388                PatternedFill = 4,
389                ComplexFill = 5,
390                ShapedFill = 6,
391                DrawnDistressed = 7,
392            } bTreatment;
393
394            enum class Lining : SK_OT_BYTE {
395                Any = 0,
396                NoFit = 1,
397                None = 2,
398                Inline = 3,
399                Outline = 4,
400                Engraved = 5,
401                Shadow = 6,
402                Relief = 7,
403                Backdrop = 8,
404            } bLining;
405
406            enum class Topology : SK_OT_BYTE {
407                Any = 0,
408                NoFit = 1,
409                Standard = 2,
410                Square = 3,
411                MultipleSegment = 4,
412                DecoWacoMidlines = 5,
413                UnevenWeighting = 6,
414                DiverseArms = 7,
415                DiverseForms = 8,
416                LombardicForms = 9,
417                UpperCaseInLowerCase = 10,
418                ImpliedTopology = 11,
419                HorseshoeEandA = 12,
420                Cursive = 13,
421                Blackletter = 14,
422                SwashVariance = 15,
423            } bTopology;
424
425            enum class RangeOfCharacters : SK_OT_BYTE {
426                Any = 0,
427                NoFit = 1,
428                ExtendedCollection = 2,
429                Litterals = 3,
430                NoLowerCase = 4,
431                SmallCaps = 5,
432            } bRangeOfCharacters;
433        } decorative;
434
435        struct Pictoral {
436            enum class Kind : SK_OT_BYTE {
437                Any = 0,
438                NoFit = 1,
439                Montages = 2,
440                Pictures = 3,
441                Shapes = 4,
442                Scientific = 5,
443                Music = 6,
444                Expert = 7,
445                Patterns = 8,
446                Boarders = 9,
447                Icons = 10,
448                Logos = 11,
449                IndustrySpecific = 12,
450            } bKind;
451
452            enum class Weight : SK_OT_BYTE {
453                NoFit = 1,
454            } bWeight;
455
456            enum class Spacing : SK_OT_BYTE {
457                Any = 0,
458                NoFit = 1,
459                ProportionalSpaced = 2,
460                Monospaced = 3,
461            } bSpacing;
462
463            enum class AspectRatioAndContrast : SK_OT_BYTE {
464                NoFit = 1,
465            } bAspectRatioAndContrast;
466
467            enum class AspectRatio94 : SK_OT_BYTE {
468                Any = 0,
469                NoFit = 1,
470                NoWidth = 2,
471                ExceptionallyWide = 3,
472                SuperWide = 4,
473                VeryWide = 5,
474                Wide = 6,
475                Normal = 7,
476                Narrow = 8,
477                VeryNarrow = 9,
478            } bAspectRatio94;
479
480            enum class AspectRatio119 : SK_OT_BYTE {
481                Any = 0,
482                NoFit = 1,
483                NoWidth = 2,
484                ExceptionallyWide = 3,
485                SuperWide = 4,
486                VeryWide = 5,
487                Wide = 6,
488                Normal = 7,
489                Narrow = 8,
490                VeryNarrow = 9,
491            } bAspectRatio119;
492
493             enum class AspectRatio157 : SK_OT_BYTE {
494                Any = 0,
495                NoFit = 1,
496                NoWidth = 2,
497                ExceptionallyWide = 3,
498                SuperWide = 4,
499                VeryWide = 5,
500                Wide = 6,
501                Normal = 7,
502                Narrow = 8,
503                VeryNarrow = 9,
504            } bAspectRatio157;
505
506            enum class AspectRatio163 : SK_OT_BYTE {
507                Any = 0,
508                NoFit = 1,
509                NoWidth = 2,
510                ExceptionallyWide = 3,
511                SuperWide = 4,
512                VeryWide = 5,
513                Wide = 6,
514                Normal = 7,
515                Narrow = 8,
516                VeryNarrow = 9,
517            } bAspectRatio163;
518        } pictoral;
519    } data;
520};
521
522#pragma pack(pop)
523
524
525static_assert(sizeof(SkPanose) == 10, "sizeof_SkPanose_not_10");
526
527#endif
528