summaryrefslogtreecommitdiff
path: root/base/gxttf.h
blob: ba64e462534734bc8a98a5ad0f91cf3f6c49cbfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/* Copyright (C) 2001-2023 Artifex Software, Inc.
   All Rights Reserved.

   This software is provided AS-IS with no warranty, either express or
   implied.

   This software is distributed under license and may not be copied,
   modified or distributed except as expressly authorized under the terms
   of the license contained in the file LICENSE in this distribution.

   Refer to licensing information at http://www.artifex.com or contact
   Artifex Software, Inc.,  39 Mesa Street, Suite 108A, San Francisco,
   CA 94129, USA, for further information.
*/


/* Table definitions for TrueType fonts */

#ifndef gxttf_INCLUDED
#  define gxttf_INCLUDED

#include "stdpre.h"

/* ------ Composite glyf component flags ------ */

#define TT_CG_ARGS_ARE_WORDS     (1<<0)
#define TT_CG_ARGS_ARE_XY_VALUES (1<<1)
#define TT_CG_ROUND_XY_TO_GRID   (1<<2)
#define TT_CG_HAVE_SCALE         (1<<3)
#define TT_CG_MORE_COMPONENTS    (1<<5)
#define TT_CG_HAVE_XY_SCALE      (1<<6)
#define TT_CG_HAVE_2X2           (1<<7)
#define TT_CG_HAVE_INSTRUCTIONS  (1<<8)
#define TT_CG_USE_MY_METRICS     (1<<9)

/* ------ head ------ */

typedef struct ttf_head_s {
    byte
        version[4],		/* version 1.0 */
        fontRevision[4],
        checkSumAdjustment[4],
        magicNumber[4],
        flags[2],
        unitsPerEm[2],
        created[8],
        modified[8],
        xMin[2],
        yMin[2],
        xMax[2],
        yMax[2],
        macStyle[2],
        lowestRecPPM[2],
        fontDirectionHint[2],
        indexToLocFormat[2],
        glyphDataFormat[2];
} ttf_head_t;

/* ------ hhea ------ */

typedef struct ttf_hhea_s {
    byte
        version[4],		/* version 1.0 */
        ascender[2],		/* FWord */
        descender[2],		/* FWord */
        lineGap[2],		/* FWord */
        advanceWidthMax[2],	/* uFWord */
        minLeftSideBearing[2],	/* FWord */
        minRightSideBearing[2],	/* FWord */
        xMaxExtent[2],		/* FWord */
        caretSlopeRise[2],
        caretSlopeRun[2],
        caretOffset[2],
        reserved[8],
        metricDataFormat[2],	/* 0 */
        numHMetrics[2];
} ttf_hhea_t;

/* ------ hmtx ------ */

typedef struct longHorMetric_s {
    byte
        advanceWidth[2],	/* uFWord */
        lsb[2];			/* FWord */
} longHorMetric_t;

/* ------ maxp ------ */

typedef struct ttf_maxp_s {
    byte
        version[4],		/* 1.0 */
        numGlyphs[2],
        maxPoints[2],
        maxContours[2],
        maxCompositePoints[2],
        maxCompositeContours[2],
        maxZones[2],
        maxTwilightPoints[2],
        maxStorage[2],
        maxFunctionDefs[2],
        maxInstructionDefs[2],
        maxStackElements[2],
        maxSizeOfInstructions[2],
        maxComponentElements[2],
        maxComponentDepth[2];
} ttf_maxp_t;

/* ------ OS/2 ------ */

typedef struct ttf_OS_2_s {
    byte
        version[2],		/* version 1 */
        xAvgCharWidth[2],
        usWeightClass[2],
        usWidthClass[2],
        fsType[2],
        ySubscriptXSize[2],
        ySubscriptYSize[2],
        ySubscriptXOffset[2],
        ySubscriptYOffset[2],
        ySuperscriptXSize[2],
        ySuperscriptYSize[2],
        ySuperscriptXOffset[2],
        ySuperscriptYOffset[2],
        yStrikeoutSize[2],
        yStrikeoutPosition[2],
        sFamilyClass[2],
        /*panose:*/
            bFamilyType, bSerifStyle, bWeight, bProportion, bContrast,
            bStrokeVariation, bArmStyle, bLetterform, bMidline, bXHeight,
        ulUnicodeRanges[16],
        achVendID[4],
        fsSelection[2],
        usFirstCharIndex[2],
        usLastCharIndex[2],
        sTypoAscender[2],
        sTypoDescender[2],
        sTypoLineGap[2],
        usWinAscent[2],
        usWinDescent[2],
        ulCodePageRanges[8],

        sxHeight[2],            /* version 2 */
        sCapHeight[2],
        usDefaultChar[2],
        usBreakChar[2],
        usMaxContext[2],
                                /* version 5 */
        usLowerOpticalPointSize[2],
        usUpperOpticalPointSize[2];
} ttf_OS_2_t;

/* ------ vhea ------ */

typedef struct ttf_vhea_s {
    byte
        version[4],		/* version 1.0 */
        ascent[2],		/* FWord */
        descent[2],		/* FWord */
        lineGap[2],		/* FWord */
        advanceHeightMax[2],	/* uFWord */
        minTopSideBearing[2],	/* FWord */
        minBottomSideBearing[2],  /* FWord */
        yMaxExtent[2],		/* FWord */
        caretSlopeRise[2],
        caretSlopeRun[2],
        caretOffset[2],
        reserved[8],
        metricDataFormat[2],	/* 0 */
        numVMetrics[2];
} ttf_vhea_t;

/* ------ vmtx ------ */

typedef struct longVerMetric_s {
    byte
        advanceHeight[2],	/* uFWord */
        topSideBearing[2];	/* FWord */
} longVerMetric_t;

#endif /* gxttf_INCLUDED */