Debian Codegraph @

podofo/3rdparty/adobe/afdko/include/abfdesc.h

raw
1 /* Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/). All Rights Reserved.
2 This software is licensed as OpenSource, under the Apache License, Version 2.0.
3 This license is available at: http://opensource.org/licenses/Apache-2.0. */
4
5 /*
6 * Abstract Font Descriptor.
7 */
8
9 #ifndef ABFDESC_H
10 #define ABFDESC_H
11
12 /* An abstract font descriptor is composed of a single fixed-length
13 "abfFontDescHeader" followed by one or more variable-length
14 "abfFontDescElement"s (see below). */
15
16 typedef struct /* Font descriptor element */
17 {
18 /* The following "flags" field is used to represent font parameters having
19 values of fixed size.
20
21 Bits in the field indicate the presence (set) or absence (clear) for
22 corresponding font parameter value(s) in the "values" array. Clear bits
23 signify that the font parameter was either missing from the font or its
24 value was equal to the default value for that font parameter (specified
25 below).
26
27 For correct correspondence with their values in the "values" array the
28 fields must be considered in least significant to most significant bit
29 order. All bits correspond to 1 value except the FontMatrix where it
30 is an array of 6 values.
31
32 Comments show default values: */
33 unsigned short flags;
34 #define ABF_DESC_CharstringType (1 << 0) /* 2 */
35 #define ABF_DESC_PaintType (1 << 1) /* 0 */
36 #define ABF_DESC_BlueScale (1 << 2) /* 0.039625 */
37 #define ABF_DESC_BlueShift (1 << 3) /* 7 */
38 #define ABF_DESC_BlueFuzz (1 << 4) /* 1 */
39 #define ABF_DESC_StdHW (1 << 5) /* none */
40 #define ABF_DESC_StdVW (1 << 6) /* none */
41 #define ABF_DESC_ForceBold (1 << 7) /* 0=false */
42 #define ABF_DESC_LanguageGroup (1 << 8) /* 0 */
43 #define ABF_DESC_ExpansionFactor (1 << 9) /* 0.06 */
44 #define ABF_DESC_initialRandomSeed (1 << 10) /* 0 */
45 #define ABF_DESC_defaultWidthX (1 << 11) /* 0 */
46 #define ABF_DESC_nominalWidthX (1 << 12) /* 0 */
47 #define ABF_DESC_lenSubrArray (1 << 13) /* 0 (local subr count) */
48 #define ABF_DESC_FontMatrix (1 << 14) /* [.001 0 0 .001 0 0] */
49
50 /* The following fields are used to represent font parameters having
51 values of variable size.
52
53 The values stored in the fields represent the number of elements in the
54 "values" array that are used to represent each font parameter. If the
55 value is zero the corresponding font value is not stored in the "values"
56 array indicating that the font parameter was missing from the font.
57
58 For correct correspondence with their values in the "values" array the
59 fields must be considered in order starting with "BlueValues".
60
61 Comments show [max element count]: */
62 unsigned char BlueValues; /* [14] */
63 unsigned char OtherBlues; /* [10] */
64 unsigned char FamilyBlues; /* [14] */
65 unsigned char FamilyOtherBlues; /* [10] */
66 unsigned char StemSnapH; /* [12] */
67 unsigned char StemSnapV; /* [12] */
68
69 /* The values array contains the values corresponding to the font
70 parameters with fixed and variable size values described above. The
71 actual number of elements in the array is provided in the "valueCnt"
72 field. */
73 unsigned long valueCnt;
74 float values[1]; /* [valueCnt] */
75 } abfFontDescElement;
76
77 typedef struct /* Font descriptor header */
78 {
79 unsigned short length; /* Total size in bytes of descriptor */
80 unsigned short FDElementCnt; /* Count of "abfFontDescElement"s */
81 float FontBBox[4];
82 float StrokeWidth;
83 float lenGSubrArray; /* Global subr count */
84 } abfFontDescHeader;
85
86 #define ABF_GET_FIRST_DESC(hdr) \
87 (abfFontDescElement *)((char *)(hdr) + sizeof(abfFontDescHeader))
88
89 /* The ABF_GET_FIRST_DESC() macro returns a pointer to the first
90 abfFontDescElement in the font descriptor when supplied with a
91 abfFontDescHeader pointer. */
92
93 #define ABF_GET_NEXT_DESC(elem) \
94 (abfFontDescElement *)((char *)(elem) + sizeof(abfFontDescElement) + \
95 (((abfFontDescElement *)(elem))->valueCnt - 1) * sizeof(float))
96
97 /* The ABF_GET_NEXT_DESC() macro returns a pointer to the next
98 abfFontDescElement in the font descriptor when supplied with an
99 abfFontDescElement pointer. The client must ensure that ABF_GET_NEXT_DESC()
100 is not called more times than there are abfFontDescElement's in the font
101 descriptor. The number of elements is available via the "FDElementCnt" field
102 in the abfFontDescHeader. */
103
104 #endif /* ABFDESC_H */