xref: /plan9/sys/src/cmd/gs/src/gxttf.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 2000 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gxttf.h,v 1.6 2002/06/28 05:27:22 lpd Exp $ */
18 /* Table definitions for TrueType fonts */
19 
20 #ifndef gxttf_INCLUDED
21 #  define gxttf_INCLUDED
22 
23 /* ------ Composite glyf component flags ------ */
24 
25 #define TT_CG_ARGS_ARE_WORDS     (1<<0)
26 #define TT_CG_ARGS_ARE_XY_VALUES (1<<1)
27 #define TT_CG_ROUND_XY_TO_GRID   (1<<2)
28 #define TT_CG_HAVE_SCALE         (1<<3)
29 #define TT_CG_MORE_COMPONENTS    (1<<5)
30 #define TT_CG_HAVE_XY_SCALE      (1<<6)
31 #define TT_CG_HAVE_2X2           (1<<7)
32 #define TT_CG_HAVE_INSTRUCTIONS  (1<<8)
33 #define TT_CG_USE_MY_METRICS     (1<<9)
34 
35 /* ------ head ------ */
36 
37 typedef struct ttf_head_s {
38     byte
39 	version[4],		/* version 1.0 */
40 	fontRevision[4],
41 	checkSumAdjustment[4],
42 	magicNumber[4],
43 	flags[2],
44 	unitsPerEm[2],
45 	created[8],
46 	modified[8],
47 	xMin[2],
48 	yMin[2],
49 	xMax[2],
50 	yMax[2],
51 	macStyle[2],
52 	lowestRecPPM[2],
53 	fontDirectionHint[2],
54 	indexToLocFormat[2],
55 	glyphDataFormat[2];
56 } ttf_head_t;
57 
58 /* ------ hhea ------ */
59 
60 typedef struct ttf_hhea_s {
61     byte
62 	version[4],		/* version 1.0 */
63 	ascender[2],		/* FWord */
64 	descender[2],		/* FWord */
65 	lineGap[2],		/* FWord */
66 	advanceWidthMax[2],	/* uFWord */
67 	minLeftSideBearing[2],	/* FWord */
68 	minRightSideBearing[2],	/* FWord */
69 	xMaxExtent[2],		/* FWord */
70 	caretSlopeRise[2],
71 	caretSlopeRun[2],
72 	caretOffset[2],
73 	reserved[8],
74 	metricDataFormat[2],	/* 0 */
75 	numHMetrics[2];
76 } ttf_hhea_t;
77 
78 /* ------ hmtx ------ */
79 
80 typedef struct longHorMetric_s {
81     byte
82 	advanceWidth[2],	/* uFWord */
83 	lsb[2];			/* FWord */
84 } longHorMetric_t;
85 
86 /* ------ maxp ------ */
87 
88 typedef struct ttf_maxp_s {
89     byte
90 	version[4],		/* 1.0 */
91 	numGlyphs[2],
92 	maxPoints[2],
93 	maxContours[2],
94 	maxCompositePoints[2],
95 	maxCompositeContours[2],
96 	maxZones[2],
97 	maxTwilightPoints[2],
98 	maxStorage[2],
99 	maxFunctionDefs[2],
100 	maxInstructionDefs[2],
101 	maxStackElements[2],
102 	maxSizeOfInstructions[2],
103 	maxComponentElements[2],
104 	maxComponentDepth[2];
105 } ttf_maxp_t;
106 
107 /* ------ OS/2 ------ */
108 
109 typedef struct ttf_OS_2_s {
110     byte
111 	version[2],		/* version 1 */
112 	xAvgCharWidth[2],
113 	usWeightClass[2],
114 	usWidthClass[2],
115 	fsType[2],
116 	ySubscriptXSize[2],
117 	ySubscriptYSize[2],
118 	ySubscriptXOffset[2],
119 	ySubscriptYOffset[2],
120 	ySuperscriptXSize[2],
121 	ySuperscriptYSize[2],
122 	ySuperscriptXOffset[2],
123 	ySuperscriptYOffset[2],
124 	yStrikeoutSize[2],
125 	yStrikeoutPosition[2],
126 	sFamilyClass[2],
127 	/*panose:*/
128 	    bFamilyType, bSerifStyle, bWeight, bProportion, bContrast,
129 	    bStrokeVariation, bArmStyle, bLetterform, bMidline, bXHeight,
130 	ulUnicodeRanges[16],
131 	achVendID[4],
132 	fsSelection[2],
133 	usFirstCharIndex[2],
134 	usLastCharIndex[2],
135 	sTypoAscender[2],
136 	sTypoDescender[2],
137 	sTypoLineGap[2],
138 	usWinAscent[2],
139 	usWinDescent[2],
140 	ulCodePageRanges[8];
141 } ttf_OS_2_t;
142 
143 /* ------ vhea ------ */
144 
145 typedef struct ttf_vhea_s {
146     byte
147 	version[4],		/* version 1.0 */
148 	ascent[2],		/* FWord */
149 	descent[2],		/* FWord */
150 	lineGap[2],		/* FWord */
151 	advanceHeightMax[2],	/* uFWord */
152 	minTopSideBearing[2],	/* FWord */
153 	minBottomSideBearing[2],  /* FWord */
154 	yMaxExtent[2],		/* FWord */
155 	caretSlopeRise[2],
156 	caretSlopeRun[2],
157 	caretOffset[2],
158 	reserved[8],
159 	metricDataFormat[2],	/* 0 */
160 	numVMetrics[2];
161 } ttf_vhea_t;
162 
163 /* ------ vmtx ------ */
164 
165 typedef struct longVerMetric_s {
166     byte
167 	advanceHeight[2],	/* uFWord */
168 	topSideBearing[2];	/* FWord */
169 } longVerMetric_t;
170 
171 #endif /* gxttf_INCLUDED */
172