ReactOS 0.4.16-dev-2359-g4b75ec5
cfftypes.h
Go to the documentation of this file.
1/****************************************************************************
2 *
3 * cfftypes.h
4 *
5 * Basic OpenType/CFF 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 CFFTYPES_H_
21#define CFFTYPES_H_
22
23
24#include <freetype/freetype.h>
25#include <freetype/t1tables.h>
30
31
33
34
35 /**************************************************************************
36 *
37 * @struct:
38 * CFF_IndexRec
39 *
40 * @description:
41 * A structure used to model a CFF Index table.
42 *
43 * @fields:
44 * stream ::
45 * The source input stream.
46 *
47 * start ::
48 * The position of the first index byte in the input stream.
49 *
50 * count ::
51 * The number of elements in the index.
52 *
53 * off_size ::
54 * The size in bytes of object offsets in index.
55 *
56 * data_offset ::
57 * The position of first data byte in the index's bytes.
58 *
59 * data_size ::
60 * The size of the data table in this index.
61 *
62 * offsets ::
63 * A table of element offsets in the index. Must be loaded explicitly.
64 *
65 * bytes ::
66 * If the index is loaded in memory, its bytes.
67 */
68 typedef struct CFF_IndexRec_
69 {
77
80
82
83
84 typedef struct CFF_EncodingRec_
85 {
88
90 FT_UShort sids [256]; /* avoid dynamic allocations */
92
94
95
96 typedef struct CFF_CharsetRec_
97 {
98
101
103 FT_UShort* cids; /* the inverse mapping of `sids'; only needed */
104 /* for CID-keyed fonts */
107
109
110
111 /* cf. similar fields in file `ttgxvar.h' from the `truetype' module */
112
113 typedef struct CFF_VarData_
114 {
115#if 0
116 FT_UInt itemCount; /* not used; always zero */
117 FT_UInt shortDeltaCount; /* not used; always zero */
118#endif
119
120 FT_UInt regionIdxCount; /* number of region indexes */
121 FT_UInt* regionIndices; /* array of `regionIdxCount' indices; */
122 /* these index `varRegionList' */
124
125
126 /* contribution of one axis to a region */
127 typedef struct CFF_AxisCoords_
128 {
130 FT_Fixed peakCoord; /* zero peak means no effect (factor = 1) */
132
134
135
136 typedef struct CFF_VarRegion_
137 {
138 CFF_AxisCoords* axisList; /* array of axisCount records */
139
141
142
143 typedef struct CFF_VStoreRec_
144 {
146 CFF_VarData* varData; /* array of dataCount records */
147 /* vsindex indexes this array */
149 FT_UInt regionCount; /* total number of regions defined */
151
153
154
155 /* forward reference */
156 typedef struct CFF_FontRec_* CFF_Font;
157
158
159 /* This object manages one cached blend vector. */
160 /* */
161 /* There is a BlendRec for Private DICT parsing in each subfont */
162 /* and a BlendRec for charstrings in CF2_Font instance data. */
163 /* A cached BV may be used across DICTs or Charstrings if inputs */
164 /* have not changed. */
165 /* */
166 /* `usedBV' is reset at the start of each parse or charstring. */
167 /* vsindex cannot be changed after a BV is used. */
168 /* */
169 /* Note: NDV is long (32/64 bit), while BV is 16.16 (FT_Int32). */
170 typedef struct CFF_BlendRec_
171 {
172 FT_Bool builtBV; /* blendV has been built */
173 FT_Bool usedBV; /* blendV has been used */
174 CFF_Font font; /* top level font struct */
175 FT_UInt lastVsindex; /* last vsindex used */
176 FT_UInt lenNDV; /* normDV length (aka numAxes) */
177 FT_Fixed* lastNDV; /* last NDV used */
178 FT_UInt lenBV; /* BlendV length (aka numMasters) */
179 FT_Int32* BV; /* current blendV (per DICT/glyph) */
180
182
183
184 typedef struct CFF_FontRecDictRec_
185 {
200 FT_ULong units_per_em; /* temporarily used as scaling value also */
212
213 /* these should only be used for the top-level font dictionary */
217
226
227 /* the next fields come from the data of the deprecated */
228 /* `MultipleMaster' operator; they are needed to parse the (also */
229 /* deprecated) `blend' operator in Type 2 charstrings */
232
233 /* fields for CFF2 */
236
238
239
240 /* forward reference */
242
243
244 typedef struct CFF_PrivateRec_
245 {
250
255
261
275
276 /* fields for CFF2 */
279
281
282
283 typedef struct CFF_FDSelectRec_
284 {
287
288 /* that's the table, taken from the file `as is' */
291
292 /* small cache for format 3 only */
296
298
299
300 /* A SubFont packs a font dict and a private dict together. They are */
301 /* needed to support CID-keyed CFF fonts. */
302 typedef struct CFF_SubFontRec_
303 {
306
307 /* fields for CFF2 */
308 CFF_BlendRec blend; /* current blend vector */
309 FT_UInt lenNDV; /* current length NDV or zero */
310 FT_Fixed* NDV; /* ptr to current NDV or NULL */
311
312 /* `blend_stack' is a writable buffer to hold blend results. */
313 /* This buffer is to the side of the normal cff parser stack; */
314 /* `cff_parse_blend' and `cff_blend_doBlend' push blend results here. */
315 /* The normal stack then points to these values instead of the DICT */
316 /* because all other operators in Private DICT clear the stack. */
317 /* `blend_stack' could be cleared at each operator other than blend. */
318 /* Blended values are stored as 5-byte fixed point values. */
319
320 FT_Byte* blend_stack; /* base of stack allocation */
321 FT_Byte* blend_top; /* first empty slot */
322 FT_UInt blend_used; /* number of bytes in use */
323 FT_UInt blend_alloc; /* number of bytes allocated */
324
326 FT_Byte** local_subrs; /* array of pointers */
327 /* into Local Subrs INDEX data */
328
329 FT_UInt32 random;
330
332
333
334#define CFF_MAX_CID_FONTS 256
335
336
337 typedef struct CFF_FontRec_
338 {
341 FT_Memory memory; /* TODO: take this from stream->memory? */
342 FT_ULong base_offset; /* offset to start of CFF */
345
349
350 FT_UInt top_dict_length; /* cff2 only */
351
353
357
360
365
367
368 /* array of pointers into Global Subrs INDEX data */
370
371 /* array of pointers into String INDEX data stored at string_pool */
376
380
382
383 /* interface to PostScript hinter */
385
386 /* interface to Postscript Names service */
387 FT_Service_PsCMaps psnames;
388
389 /* interface to CFFLoad service */
390 const void* cffload;
391
392 /* since version 2.3.0 */
393 PS_FontInfoRec* font_info; /* font info dictionary */
394
395 /* since version 2.3.6 */
398
399 /* since version 2.4.12 */
401
402 /* since version 2.7.1 */
403 CFF_VStoreRec vstore; /* parsed vstore structure */
404
405 /* since version 2.9 */
407
409
410
412
413#endif /* CFFTYPES_H_ */
414
415
416/* END */
struct CFF_FDSelectRec_ CFF_FDSelectRec
struct CFF_SubFontRec_ * CFF_SubFont
Definition: cfftypes.h:241
struct CFF_FontRec_ CFF_FontRec
struct CFF_CharsetRec_ * CFF_Charset
struct CFF_FDSelectRec_ * CFF_FDSelect
struct CFF_BlendRec_ CFF_BlendRec
struct CFF_PrivateRec_ * CFF_Private
struct CFF_VarRegion_ CFF_VarRegion
struct CFF_FontRec_ * CFF_Font
Definition: cfftypes.h:156
struct CFF_EncodingRec_ CFF_EncodingRec
FT_BEGIN_HEADER struct CFF_IndexRec_ * CFF_Index
struct CFF_EncodingRec_ * CFF_Encoding
struct CFF_PrivateRec_ CFF_PrivateRec
struct CFF_AxisCoords_ CFF_AxisCoords
struct CFF_VarData_ CFF_VarData
struct CFF_CharsetRec_ CFF_CharsetRec
struct CFF_SubFontRec_ CFF_SubFontRec
FT_BEGIN_HEADER struct CFF_IndexRec_ CFF_IndexRec
struct CFF_VStoreRec_ CFF_VStoreRec
#define CFF_MAX_CID_FONTS
Definition: cfftypes.h:334
struct CFF_FontRecDictRec_ CFF_FontRecDictRec
struct CFF_VStoreRec_ * CFF_VStore
struct CFF_BlendRec_ * CFF_Blend
struct CFF_FontRecDictRec_ * CFF_FontRecDict
#define FT_END_HEADER
Definition: ftheader.h:57
#define FT_BEGIN_HEADER
Definition: ftheader.h:37
FT_BEGIN_HEADER typedef signed long FT_Pos
Definition: ftimage.h:57
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
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
signed long FT_Fixed
Definition: fttypes.h:287
signed long FT_Long
Definition: fttypes.h:242
unsigned short FT_UShort
Definition: fttypes.h:209
char FT_String
Definition: fttypes.h:187
unsigned int FT_UInt
Definition: fttypes.h:231
signed int FT_Int
Definition: fttypes.h:220
FT_Fixed startCoord
Definition: cfftypes.h:129
FT_Fixed peakCoord
Definition: cfftypes.h:130
FT_Fixed endCoord
Definition: cfftypes.h:131
FT_UInt lastVsindex
Definition: cfftypes.h:175
FT_UInt lenNDV
Definition: cfftypes.h:176
FT_Bool builtBV
Definition: cfftypes.h:172
CFF_Font font
Definition: cfftypes.h:174
FT_Bool usedBV
Definition: cfftypes.h:173
FT_UInt lenBV
Definition: cfftypes.h:178
FT_Fixed * lastNDV
Definition: cfftypes.h:177
FT_Int32 * BV
Definition: cfftypes.h:179
FT_UShort * sids
Definition: cfftypes.h:102
FT_UInt num_glyphs
Definition: cfftypes.h:106
FT_UShort * cids
Definition: cfftypes.h:103
FT_UInt format
Definition: cfftypes.h:99
FT_ULong offset
Definition: cfftypes.h:100
FT_UInt max_cid
Definition: cfftypes.h:105
FT_UShort sids[256]
Definition: cfftypes.h:90
FT_UShort codes[256]
Definition: cfftypes.h:91
FT_UInt count
Definition: cfftypes.h:89
FT_ULong offset
Definition: cfftypes.h:87
FT_UInt format
Definition: cfftypes.h:86
FT_UInt cache_first
Definition: cfftypes.h:293
FT_Byte cache_fd
Definition: cfftypes.h:295
FT_UInt cache_count
Definition: cfftypes.h:294
FT_Byte * data
Definition: cfftypes.h:289
FT_Byte format
Definition: cfftypes.h:285
FT_UInt range_count
Definition: cfftypes.h:286
FT_UInt data_size
Definition: cfftypes.h:290
FT_Long cid_font_version
Definition: cfftypes.h:218
FT_ULong cid_uid_base
Definition: cfftypes.h:222
FT_UInt family_name
Definition: cfftypes.h:190
FT_ULong cid_fd_array_offset
Definition: cfftypes.h:223
FT_ULong charset_offset
Definition: cfftypes.h:205
FT_ULong private_size
Definition: cfftypes.h:209
FT_UInt cid_ordering
Definition: cfftypes.h:215
FT_UInt embedded_postscript
Definition: cfftypes.h:211
FT_Int charstring_type
Definition: cfftypes.h:197
FT_ULong cid_fd_select_offset
Definition: cfftypes.h:224
FT_UInt cid_registry
Definition: cfftypes.h:214
FT_ULong private_offset
Definition: cfftypes.h:208
FT_Bool is_fixed_pitch
Definition: cfftypes.h:192
FT_ULong cid_count
Definition: cfftypes.h:221
FT_UInt cid_font_name
Definition: cfftypes.h:225
FT_Bool has_font_matrix
Definition: cfftypes.h:199
FT_Long cid_font_type
Definition: cfftypes.h:220
FT_Vector font_offset
Definition: cfftypes.h:201
FT_Fixed underline_position
Definition: cfftypes.h:194
FT_ULong charstrings_offset
Definition: cfftypes.h:207
FT_Long synthetic_base
Definition: cfftypes.h:210
FT_ULong encoding_offset
Definition: cfftypes.h:206
FT_ULong unique_id
Definition: cfftypes.h:202
FT_UShort num_designs
Definition: cfftypes.h:230
FT_UShort num_axes
Definition: cfftypes.h:231
FT_Fixed underline_thickness
Definition: cfftypes.h:195
FT_ULong units_per_em
Definition: cfftypes.h:200
FT_ULong vstore_offset
Definition: cfftypes.h:234
FT_Long cid_font_revision
Definition: cfftypes.h:219
FT_Matrix font_matrix
Definition: cfftypes.h:198
FT_Long cid_supplement
Definition: cfftypes.h:216
FT_Fixed italic_angle
Definition: cfftypes.h:193
FT_UInt num_strings
Definition: cfftypes.h:372
FT_UInt num_faces
Definition: cfftypes.h:343
FT_String * font_name
Definition: cfftypes.h:366
FT_Service_PsCMaps psnames
Definition: cfftypes.h:387
FT_Byte ** global_subrs
Definition: cfftypes.h:369
FT_UInt num_subfonts
Definition: cfftypes.h:378
CFF_SubFont subfonts[CFF_MAX_CID_FONTS]
Definition: cfftypes.h:379
FT_Byte version_major
Definition: cfftypes.h:346
CFF_CharsetRec charset
Definition: cfftypes.h:359
FT_Byte header_size
Definition: cfftypes.h:348
FT_Generic cf2_instance
Definition: cfftypes.h:400
CFF_SubFontRec top_font
Definition: cfftypes.h:377
CFF_IndexRec charstrings_index
Definition: cfftypes.h:361
FT_Stream stream
Definition: cfftypes.h:340
CFF_VStoreRec vstore
Definition: cfftypes.h:403
FT_Library library
Definition: cfftypes.h:339
FT_Bool cff2
Definition: cfftypes.h:352
CFF_IndexRec private_index
Definition: cfftypes.h:363
CFF_FDSelectRec fd_select
Definition: cfftypes.h:381
CFF_EncodingRec encoding
Definition: cfftypes.h:358
PS_FontExtraRec * font_extra
Definition: cfftypes.h:406
CFF_IndexRec name_index
Definition: cfftypes.h:354
CFF_IndexRec font_dict_index
Definition: cfftypes.h:362
CFF_IndexRec top_dict_index
Definition: cfftypes.h:355
const void * cffload
Definition: cfftypes.h:390
FT_UInt top_dict_length
Definition: cfftypes.h:350
FT_Byte version_minor
Definition: cfftypes.h:347
FT_String * registry
Definition: cfftypes.h:396
FT_Byte * string_pool
Definition: cfftypes.h:374
CFF_IndexRec local_subrs_index
Definition: cfftypes.h:364
FT_Byte ** strings
Definition: cfftypes.h:373
FT_Memory memory
Definition: cfftypes.h:341
FT_ULong string_pool_size
Definition: cfftypes.h:375
FT_String * ordering
Definition: cfftypes.h:397
CFF_IndexRec global_subrs_index
Definition: cfftypes.h:356
PSHinter_Service pshinter
Definition: cfftypes.h:384
PS_FontInfoRec * font_info
Definition: cfftypes.h:393
FT_UInt num_glyphs
Definition: cfftypes.h:344
FT_ULong base_offset
Definition: cfftypes.h:342
FT_Byte off_size
Definition: cfftypes.h:74
FT_ULong data_size
Definition: cfftypes.h:76
FT_ULong * offsets
Definition: cfftypes.h:78
FT_UInt count
Definition: cfftypes.h:73
FT_ULong data_offset
Definition: cfftypes.h:75
FT_Byte * bytes
Definition: cfftypes.h:79
FT_UInt hdr_size
Definition: cfftypes.h:72
FT_Stream stream
Definition: cfftypes.h:70
FT_ULong start
Definition: cfftypes.h:71
FT_Byte num_snap_heights
Definition: cfftypes.h:263
FT_Byte num_blue_values
Definition: cfftypes.h:246
FT_Int language_group
Definition: cfftypes.h:269
CFF_SubFont subfont
Definition: cfftypes.h:278
FT_Pos other_blues[10]
Definition: cfftypes.h:252
FT_Byte num_snap_widths
Definition: cfftypes.h:262
FT_Int lenIV
Definition: cfftypes.h:268
FT_Long initial_random_seed
Definition: cfftypes.h:271
FT_Fixed blue_scale
Definition: cfftypes.h:256
FT_UInt vsindex
Definition: cfftypes.h:277
FT_Pos snap_heights[13]
Definition: cfftypes.h:265
FT_Pos snap_widths[13]
Definition: cfftypes.h:264
FT_Pos blue_values[14]
Definition: cfftypes.h:251
FT_Byte num_family_blues
Definition: cfftypes.h:248
FT_Pos standard_width
Definition: cfftypes.h:259
FT_Byte num_other_blues
Definition: cfftypes.h:247
FT_Pos nominal_width
Definition: cfftypes.h:274
FT_Pos family_other_blues[10]
Definition: cfftypes.h:254
FT_Byte num_family_other_blues
Definition: cfftypes.h:249
FT_Pos standard_height
Definition: cfftypes.h:260
FT_Pos blue_fuzz
Definition: cfftypes.h:258
FT_Bool force_bold
Definition: cfftypes.h:266
FT_Fixed force_bold_threshold
Definition: cfftypes.h:267
FT_Pos default_width
Definition: cfftypes.h:273
FT_Fixed expansion_factor
Definition: cfftypes.h:270
FT_Pos blue_shift
Definition: cfftypes.h:257
FT_Pos family_blues[14]
Definition: cfftypes.h:253
FT_ULong local_subrs_offset
Definition: cfftypes.h:272
FT_Fixed * NDV
Definition: cfftypes.h:310
FT_UInt lenNDV
Definition: cfftypes.h:309
FT_Byte ** local_subrs
Definition: cfftypes.h:326
FT_Byte * blend_top
Definition: cfftypes.h:321
FT_Byte * blend_stack
Definition: cfftypes.h:320
CFF_IndexRec local_subrs_index
Definition: cfftypes.h:325
FT_UInt blend_used
Definition: cfftypes.h:322
FT_UInt32 random
Definition: cfftypes.h:329
CFF_PrivateRec private_dict
Definition: cfftypes.h:305
FT_UInt blend_alloc
Definition: cfftypes.h:323
CFF_BlendRec blend
Definition: cfftypes.h:308
CFF_FontRecDictRec font_dict
Definition: cfftypes.h:304
FT_UInt dataCount
Definition: cfftypes.h:145
CFF_VarRegion * varRegionList
Definition: cfftypes.h:150
CFF_VarData * varData
Definition: cfftypes.h:146
FT_UShort axisCount
Definition: cfftypes.h:148
FT_UInt regionCount
Definition: cfftypes.h:149
FT_UInt * regionIndices
Definition: cfftypes.h:121
FT_UInt regionIdxCount
Definition: cfftypes.h:120
CFF_AxisCoords * axisList
Definition: cfftypes.h:138
FT_BEGIN_HEADER struct PS_FontInfoRec_ PS_FontInfoRec