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