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