Debian Codegraph @

texk/dvipdfm-x/tt_table.h

raw
1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2
3 Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata,
4 the dvipdfmx project team.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 */
20
21 #ifndef _TT_TABLE_H_
22 #define _TT_TABLE_H_
23
24 #include "sfnt.h"
25
26 #define TT_HEAD_TABLE_SIZE 54UL
27 #define TT_MAXP_TABLE_SIZE 32UL
28 #define TT_HHEA_TABLE_SIZE 36UL
29 #define TT_VHEA_TABLE_SIZE 36UL
30
31 struct tt_head_table
32 {
33 Fixed version;
34 Fixed fontRevision;
35 ULONG checkSumAdjustment;
36 ULONG magicNumber;
37 USHORT flags;
38 USHORT unitsPerEm;
39 BYTE created[8];
40 BYTE modified[8];
41 FWord xMin, yMin, xMax, yMax;
42 USHORT macStyle;
43 USHORT lowestRecPPEM;
44 SHORT fontDirectionHint;
45 SHORT indexToLocFormat;
46 SHORT glyphDataFormat;
47 };
48
49 struct tt_hhea_table
50 {
51 Fixed version;
52 FWord ascent;
53 FWord descent;
54 FWord lineGap;
55 uFWord advanceWidthMax;
56 FWord minLeftSideBearing;
57 FWord minRightSideBearing;
58 FWord xMaxExtent;
59 SHORT caretSlopeRise;
60 SHORT caretSlopeRun;
61 FWord caretOffset;
62 SHORT reserved[4]; /* set to 0 */
63 SHORT metricDataFormat;
64 USHORT numOfLongHorMetrics;
65 USHORT numOfExSideBearings; /* extra information */
66 };
67
68 struct tt_vhea_table
69 {
70 Fixed version;
71 SHORT vertTypoAscender; /* v.1.1 name */
72 SHORT vertTypoDescender; /* v.1.1 name */
73 SHORT vertTypoLineGap; /* v.1.1 name */
74 SHORT advanceHeightMax;
75 SHORT minTopSideBearing;
76 SHORT minBottomSideBearing;
77 SHORT yMaxExtent;
78 SHORT caretSlopeRise;
79 SHORT caretSlopeRun;
80 SHORT caretOffset;
81 SHORT reserved[4]; /* set to 0 */
82 SHORT metricDataFormat;
83 USHORT numOfLongVerMetrics;
84 USHORT numOfExSideBearings; /* extra information */
85 };
86
87 struct tt_maxp_table
88 {
89 Fixed version;
90 USHORT numGlyphs;
91 USHORT maxPoints;
92 USHORT maxContours;
93 USHORT maxComponentPoints;
94 USHORT maxComponentContours;
95 USHORT maxZones;
96 USHORT maxTwilightPoints;
97 USHORT maxStorage;
98 USHORT maxFunctionDefs;
99 USHORT maxInstructionDefs;
100 USHORT maxStackElements;
101 USHORT maxSizeOfInstructions;
102 USHORT maxComponentElements;
103 USHORT maxComponentDepth;
104 };
105
106 struct tt_os2__table
107 {
108 USHORT version; /* 0x0001 or 0x0002 */
109 SHORT xAvgCharWidth;
110 USHORT usWeightClass;
111 USHORT usWidthClass;
112 SHORT fsType; /* if (faType & 0x08) editable_embedding */
113 SHORT ySubscriptXSize;
114 SHORT ySubscriptYSize;
115 SHORT ySubscriptXOffset;
116 SHORT ySubscriptYOffset;
117 SHORT ySuperscriptXSize;
118 SHORT ySuperscriptYSize;
119 SHORT ySuperscriptXOffset;
120 SHORT ySuperscriptYOffset;
121 SHORT yStrikeoutSize;
122 SHORT yStrikeoutPosition;
123 SHORT sFamilyClass;
124 BYTE panose[10];
125 ULONG ulUnicodeRange1;
126 ULONG ulUnicodeRange2;
127 ULONG ulUnicodeRange3;
128 ULONG ulUnicodeRange4;
129 CHAR achVendID[4];
130 USHORT fsSelection;
131 USHORT usFirstCharIndex;
132 USHORT usLastCharIndex;
133 SHORT sTypoAscender; /* TTF spec. from MS is wrong */
134 SHORT sTypoDescender; /* TTF spec. from MS is wrong */
135 SHORT sTypoLineGap; /* TTF spec. from MS is wrong */
136 USHORT usWinAscent;
137 USHORT usWinDescent;
138 ULONG ulCodePageRange1;
139 ULONG ulCodePageRange2;
140 /* version 0x0002 */
141 SHORT sxHeight;
142 SHORT sCapHeight;
143 USHORT usDefaultChar;
144 USHORT usBreakChar;
145 USHORT usMaxContext;
146 };
147
148 struct tt_vertOriginYMetrics {
149 USHORT glyphIndex;
150 SHORT vertOriginY;
151 };
152
153 struct tt_VORG_table {
154 SHORT defaultVertOriginY;
155 USHORT numVertOriginYMetrics;
156 struct tt_vertOriginYMetrics *vertOriginYMetrics;
157 };
158
159 /* hmtx and vmtx */
160 struct tt_longMetrics
161 {
162 USHORT advance;
163 SHORT sideBearing;
164 };
165
166
167 /* head, hhea, maxp */
168 extern char *tt_pack_head_table (struct tt_head_table *table);
169 extern struct tt_head_table *tt_read_head_table (sfnt *sfont);
170 extern char *tt_pack_hhea_table (struct tt_hhea_table *table);
171 extern struct tt_hhea_table *tt_read_hhea_table (sfnt *sfont);
172 extern char *tt_pack_maxp_table (struct tt_maxp_table *table);
173 extern struct tt_maxp_table *tt_read_maxp_table (sfnt *sfont);
174
175 /* vhea */
176 #if 0
177 extern char *tt_pack_vhea_table (struct tt_vhea_table *table);
178 #endif
179 extern struct tt_vhea_table *tt_read_vhea_table (sfnt *sfont);
180
181 /* VORG */
182 extern struct tt_VORG_table *tt_read_VORG_table (sfnt *sfont);
183
184 /* hmtx and vmtx */
185 extern struct tt_longMetrics *tt_read_longMetrics (sfnt *sfont,
186 USHORT numGlyphs, USHORT numLongMetrics, USHORT numExSideBearings);
187
188 /* OS/2 table */
189 extern struct tt_os2__table *tt_read_os2__table (sfnt *sfont);
190
191 /* name table */
192 extern USHORT tt_get_ps_fontname (sfnt *sfont, char *dest, USHORT destlen);
193
194 #endif /* _TT_TABLE_H_ */