ReactOS 0.4.16-dev-2332-g4cba65d
wofftypes.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * wofftypes.h
4 *
5 * Basic WOFF/WOFF2 type definitions and interface (specification
6 * only).
7 *
8 * Copyright (C) 1996-2020 by
9 * David Turner, Robert Wilhelm, and Werner Lemberg.
10 *
11 * This file is part of the FreeType project, and may only be used,
12 * modified, and distributed under the terms of the FreeType project
13 * license, LICENSE.TXT. By continuing to use, modify, or distribute
14 * this file you indicate that you have read the license and
15 * understand and accept it fully.
16 *
17 */
18
19
20#ifndef WOFFTYPES_H_
21#define WOFFTYPES_H_
22
23
24#include <freetype/tttables.h>
26
27
29
30
31 /**************************************************************************
32 *
33 * @struct:
34 * WOFF_HeaderRec
35 *
36 * @description:
37 * WOFF file format header.
38 *
39 * @fields:
40 * See
41 *
42 * https://www.w3.org/TR/WOFF/#WOFFHeader
43 */
44 typedef struct WOFF_HeaderRec_
45 {
59
61
62
63 /**************************************************************************
64 *
65 * @struct:
66 * WOFF_TableRec
67 *
68 * @description:
69 * This structure describes a given table of a WOFF font.
70 *
71 * @fields:
72 * Tag ::
73 * A four-bytes tag describing the table.
74 *
75 * Offset ::
76 * The offset of the table from the start of the WOFF font in its
77 * resource.
78 *
79 * CompLength ::
80 * Compressed table length (in bytes).
81 *
82 * OrigLength ::
83 * Uncompressed table length (in bytes).
84 *
85 * CheckSum ::
86 * The table checksum. This value can be ignored.
87 *
88 * OrigOffset ::
89 * The uncompressed table file offset. This value gets computed while
90 * constructing the (uncompressed) SFNT header. It is not contained in
91 * the WOFF file.
92 */
93 typedef struct WOFF_TableRec_
94 {
95 FT_ULong Tag; /* table ID */
96 FT_ULong Offset; /* table file offset */
97 FT_ULong CompLength; /* compressed table length */
98 FT_ULong OrigLength; /* uncompressed table length */
99 FT_ULong CheckSum; /* uncompressed checksum */
100
101 FT_ULong OrigOffset; /* uncompressed table file offset */
102 /* (not in the WOFF file) */
104
105
106 /**************************************************************************
107 *
108 * @struct:
109 * WOFF2_TtcFontRec
110 *
111 * @description:
112 * Metadata for a TTC font entry in WOFF2.
113 *
114 * @fields:
115 * flavor ::
116 * TTC font flavor.
117 *
118 * num_tables ::
119 * Number of tables in TTC, indicating number of elements in
120 * `table_indices`.
121 *
122 * table_indices ::
123 * Array of table indices for each TTC font.
124 */
125 typedef struct WOFF2_TtcFontRec_
126 {
130
132
133
134 /**************************************************************************
135 *
136 * @struct:
137 * WOFF2_HeaderRec
138 *
139 * @description:
140 * WOFF2 file format header.
141 *
142 * @fields:
143 * See
144 *
145 * https://www.w3.org/TR/WOFF2/#woff20Header
146 *
147 * @note:
148 * We don't care about the fields `reserved`, `majorVersion` and
149 * `minorVersion`, so they are not included. The `totalSfntSize` field
150 * does not necessarily represent the actual size of the uncompressed
151 * SFNT font stream, so that is used as a reference value instead.
152 */
153 typedef struct WOFF2_HeaderRec_
154 {
166
167 FT_ULong uncompressed_size; /* uncompressed brotli stream size */
168 FT_ULong compressed_offset; /* compressed stream offset */
169 FT_ULong header_version; /* version of original TTC Header */
170 FT_UShort num_fonts; /* number of fonts in TTC */
171 FT_ULong actual_sfnt_size; /* actual size of sfnt stream */
172
173 WOFF2_TtcFont ttc_fonts; /* metadata for fonts in a TTC */
174
176
177
178 /**************************************************************************
179 *
180 * @struct:
181 * WOFF2_TableRec
182 *
183 * @description:
184 * This structure describes a given table of a WOFF2 font.
185 *
186 * @fields:
187 * See
188 *
189 * https://www.w3.org/TR/WOFF2/#table_dir_format
190 */
191 typedef struct WOFF2_TableRec_
192 {
193 FT_Byte FlagByte; /* table type and flags */
194 FT_ULong Tag; /* table file offset */
195 FT_ULong dst_length; /* uncompressed table length */
196 FT_ULong TransformLength; /* transformed length */
197
198 FT_ULong flags; /* calculated flags */
199 FT_ULong src_offset; /* compressed table offset */
200 FT_ULong src_length; /* compressed table length */
201 FT_ULong dst_offset; /* uncompressed table offset */
202
204
205
206 /**************************************************************************
207 *
208 * @struct:
209 * WOFF2_InfoRec
210 *
211 * @description:
212 * Metadata for WOFF2 font that may be required for reconstruction of
213 * sfnt tables.
214 *
215 * @fields:
216 * header_checksum ::
217 * Checksum of SFNT offset table.
218 *
219 * num_glyphs ::
220 * Number of glyphs in the font.
221 *
222 * num_hmetrics ::
223 * `numberOfHMetrics` field in the 'hhea' table.
224 *
225 * x_mins ::
226 * `xMin` values of glyph bounding box.
227 *
228 * glyf_table ::
229 * A pointer to the `glyf' table record.
230 *
231 * loca_table ::
232 * A pointer to the `loca' table record.
233 *
234 * head_table ::
235 * A pointer to the `head' table record.
236 */
237 typedef struct WOFF2_InfoRec_
238 {
243
247
249
250
251 /**************************************************************************
252 *
253 * @struct:
254 * WOFF2_SubstreamRec
255 *
256 * @description:
257 * This structure stores information about a substream in the transformed
258 * 'glyf' table in a WOFF2 stream.
259 *
260 * @fields:
261 * start ::
262 * Beginning of the substream relative to uncompressed table stream.
263 *
264 * offset ::
265 * Offset of the substream relative to uncompressed table stream.
266 *
267 * size ::
268 * Size of the substream.
269 */
270 typedef struct WOFF2_SubstreamRec_
271 {
275
277
278
279 /**************************************************************************
280 *
281 * @struct:
282 * WOFF2_PointRec
283 *
284 * @description:
285 * This structure stores information about a point in the transformed
286 * 'glyf' table in a WOFF2 stream.
287 *
288 * @fields:
289 * x ::
290 * x-coordinate of point.
291 *
292 * y ::
293 * y-coordinate of point.
294 *
295 * on_curve ::
296 * Set if point is on-curve.
297 */
298 typedef struct WOFF2_PointRec_
299 {
303
305
306
308
309#endif /* WOFFTYPES_H_ */
310
311
312/* END */
#define FT_END_HEADER
Definition: ftheader.h:57
#define FT_BEGIN_HEADER
Definition: ftheader.h:37
FT_BEGIN_HEADER typedef unsigned char FT_Bool
Definition: fttypes.h:108
unsigned long FT_ULong
Definition: fttypes.h:253
unsigned char FT_Byte
Definition: fttypes.h:154
unsigned short FT_UShort
Definition: fttypes.h:209
signed short FT_Short
Definition: fttypes.h:198
signed int FT_Int
Definition: fttypes.h:220
FT_ULong metaOffset
Definition: wofftypes.h:161
FT_ULong metaOrigLength
Definition: wofftypes.h:163
FT_ULong totalCompressedSize
Definition: wofftypes.h:160
FT_UShort num_fonts
Definition: wofftypes.h:170
FT_ULong actual_sfnt_size
Definition: wofftypes.h:171
FT_ULong totalSfntSize
Definition: wofftypes.h:159
FT_ULong privLength
Definition: wofftypes.h:165
FT_ULong length
Definition: wofftypes.h:157
WOFF2_TtcFont ttc_fonts
Definition: wofftypes.h:173
FT_ULong signature
Definition: wofftypes.h:155
FT_UShort num_tables
Definition: wofftypes.h:158
FT_ULong metaLength
Definition: wofftypes.h:162
FT_ULong flavor
Definition: wofftypes.h:156
FT_ULong header_version
Definition: wofftypes.h:169
FT_ULong privOffset
Definition: wofftypes.h:164
FT_ULong compressed_offset
Definition: wofftypes.h:168
FT_ULong uncompressed_size
Definition: wofftypes.h:167
FT_UShort num_hmetrics
Definition: wofftypes.h:241
WOFF2_Table glyf_table
Definition: wofftypes.h:244
FT_Short * x_mins
Definition: wofftypes.h:242
WOFF2_Table loca_table
Definition: wofftypes.h:245
FT_UShort num_glyphs
Definition: wofftypes.h:240
WOFF2_Table head_table
Definition: wofftypes.h:246
FT_ULong header_checksum
Definition: wofftypes.h:239
FT_Bool on_curve
Definition: wofftypes.h:302
FT_ULong Tag
Definition: wofftypes.h:194
FT_ULong flags
Definition: wofftypes.h:198
FT_ULong dst_length
Definition: wofftypes.h:195
FT_ULong dst_offset
Definition: wofftypes.h:201
FT_ULong TransformLength
Definition: wofftypes.h:196
FT_Byte FlagByte
Definition: wofftypes.h:193
FT_ULong src_length
Definition: wofftypes.h:200
FT_ULong src_offset
Definition: wofftypes.h:199
FT_UShort * table_indices
Definition: wofftypes.h:129
FT_UShort num_tables
Definition: wofftypes.h:128
FT_ULong flavor
Definition: wofftypes.h:127
FT_ULong privOffset
Definition: wofftypes.h:57
FT_UShort minorVersion
Definition: wofftypes.h:53
FT_ULong signature
Definition: wofftypes.h:46
FT_UShort num_tables
Definition: wofftypes.h:49
FT_ULong metaLength
Definition: wofftypes.h:55
FT_ULong privLength
Definition: wofftypes.h:58
FT_ULong metaOrigLength
Definition: wofftypes.h:56
FT_ULong length
Definition: wofftypes.h:48
FT_UShort majorVersion
Definition: wofftypes.h:52
FT_UShort reserved
Definition: wofftypes.h:50
FT_ULong flavor
Definition: wofftypes.h:47
FT_ULong metaOffset
Definition: wofftypes.h:54
FT_ULong totalSfntSize
Definition: wofftypes.h:51
FT_ULong OrigOffset
Definition: wofftypes.h:101
FT_ULong Tag
Definition: wofftypes.h:95
FT_ULong CompLength
Definition: wofftypes.h:97
FT_ULong OrigLength
Definition: wofftypes.h:98
FT_ULong CheckSum
Definition: wofftypes.h:99
FT_ULong Offset
Definition: wofftypes.h:96
struct WOFF2_TableRec_ * WOFF2_Table
struct WOFF2_TtcFontRec_ * WOFF2_TtcFont
struct WOFF_TableRec_ WOFF_TableRec
struct WOFF2_HeaderRec_ * WOFF2_Header
FT_BEGIN_HEADER struct WOFF_HeaderRec_ * WOFF_Header
struct WOFF2_PointRec_ WOFF2_PointRec
FT_BEGIN_HEADER struct WOFF_HeaderRec_ WOFF_HeaderRec
struct WOFF2_TtcFontRec_ WOFF2_TtcFontRec
struct WOFF2_InfoRec_ WOFF2_InfoRec
struct WOFF2_SubstreamRec_ WOFF2_SubstreamRec
struct WOFF2_PointRec_ * WOFF2_Point
struct WOFF_TableRec_ * WOFF_Table
struct WOFF2_HeaderRec_ WOFF2_HeaderRec
struct WOFF2_SubstreamRec_ * WOFF2_Substream
struct WOFF2_InfoRec_ * WOFF2_Info
struct WOFF2_TableRec_ WOFF2_TableRec