Debian Codegraph @

texk/xdvipsk/otflib/tt_table.h

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