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