1 | /***************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* t1tables.h */ |
---|
4 | /* */ |
---|
5 | /* Basic Type 1/Type 2 tables definitions and interface (specification */ |
---|
6 | /* only). */ |
---|
7 | /* */ |
---|
8 | /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008 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 __T1TABLES_H__ |
---|
21 | #define __T1TABLES_H__ |
---|
22 | |
---|
23 | |
---|
24 | #include <ft2build.h> |
---|
25 | #include FT_FREETYPE_H |
---|
26 | |
---|
27 | #ifdef FREETYPE_H |
---|
28 | #error "freetype.h of FreeType 1 has been loaded!" |
---|
29 | #error "Please fix the directory search order for header files" |
---|
30 | #error "so that freetype.h of FreeType 2 is found first." |
---|
31 | #endif |
---|
32 | |
---|
33 | |
---|
34 | FT_BEGIN_HEADER |
---|
35 | |
---|
36 | |
---|
37 | /*************************************************************************/ |
---|
38 | /* */ |
---|
39 | /* <Section> */ |
---|
40 | /* type1_tables */ |
---|
41 | /* */ |
---|
42 | /* <Title> */ |
---|
43 | /* Type 1 Tables */ |
---|
44 | /* */ |
---|
45 | /* <Abstract> */ |
---|
46 | /* Type~1 (PostScript) specific font tables. */ |
---|
47 | /* */ |
---|
48 | /* <Description> */ |
---|
49 | /* This section contains the definition of Type 1-specific tables, */ |
---|
50 | /* including structures related to other PostScript font formats. */ |
---|
51 | /* */ |
---|
52 | /*************************************************************************/ |
---|
53 | |
---|
54 | |
---|
55 | /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */ |
---|
56 | /* structures in order to support Multiple Master fonts. */ |
---|
57 | |
---|
58 | |
---|
59 | /*************************************************************************/ |
---|
60 | /* */ |
---|
61 | /* <Struct> */ |
---|
62 | /* PS_FontInfoRec */ |
---|
63 | /* */ |
---|
64 | /* <Description> */ |
---|
65 | /* A structure used to model a Type~1 or Type~2 FontInfo dictionary. */ |
---|
66 | /* Note that for Multiple Master fonts, each instance has its own */ |
---|
67 | /* FontInfo dictionary. */ |
---|
68 | /* */ |
---|
69 | typedef struct PS_FontInfoRec_ |
---|
70 | { |
---|
71 | FT_String* version; |
---|
72 | FT_String* notice; |
---|
73 | FT_String* full_name; |
---|
74 | FT_String* family_name; |
---|
75 | FT_String* weight; |
---|
76 | FT_Long italic_angle; |
---|
77 | FT_Bool is_fixed_pitch; |
---|
78 | FT_Short underline_position; |
---|
79 | FT_UShort underline_thickness; |
---|
80 | |
---|
81 | /* since 2.3.8 */ |
---|
82 | |
---|
83 | FT_UShort fs_type; |
---|
84 | |
---|
85 | } PS_FontInfoRec; |
---|
86 | |
---|
87 | |
---|
88 | /*************************************************************************/ |
---|
89 | /* */ |
---|
90 | /* <Struct> */ |
---|
91 | /* PS_FontInfo */ |
---|
92 | /* */ |
---|
93 | /* <Description> */ |
---|
94 | /* A handle to a @PS_FontInfoRec structure. */ |
---|
95 | /* */ |
---|
96 | typedef struct PS_FontInfoRec_* PS_FontInfo; |
---|
97 | |
---|
98 | |
---|
99 | /*************************************************************************/ |
---|
100 | /* */ |
---|
101 | /* <Struct> */ |
---|
102 | /* T1_FontInfo */ |
---|
103 | /* */ |
---|
104 | /* <Description> */ |
---|
105 | /* This type is equivalent to @PS_FontInfoRec. It is deprecated but */ |
---|
106 | /* kept to maintain source compatibility between various versions of */ |
---|
107 | /* FreeType. */ |
---|
108 | /* */ |
---|
109 | typedef PS_FontInfoRec T1_FontInfo; |
---|
110 | |
---|
111 | |
---|
112 | /*************************************************************************/ |
---|
113 | /* */ |
---|
114 | /* <Struct> */ |
---|
115 | /* PS_PrivateRec */ |
---|
116 | /* */ |
---|
117 | /* <Description> */ |
---|
118 | /* A structure used to model a Type~1 or Type~2 private dictionary. */ |
---|
119 | /* Note that for Multiple Master fonts, each instance has its own */ |
---|
120 | /* Private dictionary. */ |
---|
121 | /* */ |
---|
122 | typedef struct PS_PrivateRec_ |
---|
123 | { |
---|
124 | FT_Int unique_id; |
---|
125 | FT_Int lenIV; |
---|
126 | |
---|
127 | FT_Byte num_blue_values; |
---|
128 | FT_Byte num_other_blues; |
---|
129 | FT_Byte num_family_blues; |
---|
130 | FT_Byte num_family_other_blues; |
---|
131 | |
---|
132 | FT_Short blue_values[14]; |
---|
133 | FT_Short other_blues[10]; |
---|
134 | |
---|
135 | FT_Short family_blues [14]; |
---|
136 | FT_Short family_other_blues[10]; |
---|
137 | |
---|
138 | FT_Fixed blue_scale; |
---|
139 | FT_Int blue_shift; |
---|
140 | FT_Int blue_fuzz; |
---|
141 | |
---|
142 | FT_UShort standard_width[1]; |
---|
143 | FT_UShort standard_height[1]; |
---|
144 | |
---|
145 | FT_Byte num_snap_widths; |
---|
146 | FT_Byte num_snap_heights; |
---|
147 | FT_Bool force_bold; |
---|
148 | FT_Bool round_stem_up; |
---|
149 | |
---|
150 | FT_Short snap_widths [13]; /* including std width */ |
---|
151 | FT_Short snap_heights[13]; /* including std height */ |
---|
152 | |
---|
153 | FT_Fixed expansion_factor; |
---|
154 | |
---|
155 | FT_Long language_group; |
---|
156 | FT_Long password; |
---|
157 | |
---|
158 | FT_Short min_feature[2]; |
---|
159 | |
---|
160 | } PS_PrivateRec; |
---|
161 | |
---|
162 | |
---|
163 | /*************************************************************************/ |
---|
164 | /* */ |
---|
165 | /* <Struct> */ |
---|
166 | /* PS_Private */ |
---|
167 | /* */ |
---|
168 | /* <Description> */ |
---|
169 | /* A handle to a @PS_PrivateRec structure. */ |
---|
170 | /* */ |
---|
171 | typedef struct PS_PrivateRec_* PS_Private; |
---|
172 | |
---|
173 | |
---|
174 | /*************************************************************************/ |
---|
175 | /* */ |
---|
176 | /* <Struct> */ |
---|
177 | /* T1_Private */ |
---|
178 | /* */ |
---|
179 | /* <Description> */ |
---|
180 | /* This type is equivalent to @PS_PrivateRec. It is deprecated but */ |
---|
181 | /* kept to maintain source compatibility between various versions of */ |
---|
182 | /* FreeType. */ |
---|
183 | /* */ |
---|
184 | typedef PS_PrivateRec T1_Private; |
---|
185 | |
---|
186 | |
---|
187 | /*************************************************************************/ |
---|
188 | /* */ |
---|
189 | /* <Enum> */ |
---|
190 | /* T1_Blend_Flags */ |
---|
191 | /* */ |
---|
192 | /* <Description> */ |
---|
193 | /* A set of flags used to indicate which fields are present in a */ |
---|
194 | /* given blend dictionary (font info or private). Used to support */ |
---|
195 | /* Multiple Masters fonts. */ |
---|
196 | /* */ |
---|
197 | typedef enum T1_Blend_Flags_ |
---|
198 | { |
---|
199 | /*# required fields in a FontInfo blend dictionary */ |
---|
200 | T1_BLEND_UNDERLINE_POSITION = 0, |
---|
201 | T1_BLEND_UNDERLINE_THICKNESS, |
---|
202 | T1_BLEND_ITALIC_ANGLE, |
---|
203 | |
---|
204 | /*# required fields in a Private blend dictionary */ |
---|
205 | T1_BLEND_BLUE_VALUES, |
---|
206 | T1_BLEND_OTHER_BLUES, |
---|
207 | T1_BLEND_STANDARD_WIDTH, |
---|
208 | T1_BLEND_STANDARD_HEIGHT, |
---|
209 | T1_BLEND_STEM_SNAP_WIDTHS, |
---|
210 | T1_BLEND_STEM_SNAP_HEIGHTS, |
---|
211 | T1_BLEND_BLUE_SCALE, |
---|
212 | T1_BLEND_BLUE_SHIFT, |
---|
213 | T1_BLEND_FAMILY_BLUES, |
---|
214 | T1_BLEND_FAMILY_OTHER_BLUES, |
---|
215 | T1_BLEND_FORCE_BOLD, |
---|
216 | |
---|
217 | /*# never remove */ |
---|
218 | T1_BLEND_MAX |
---|
219 | |
---|
220 | } T1_Blend_Flags; |
---|
221 | |
---|
222 | /* */ |
---|
223 | |
---|
224 | |
---|
225 | /*# backwards compatible definitions */ |
---|
226 | #define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION |
---|
227 | #define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS |
---|
228 | #define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE |
---|
229 | #define t1_blend_blue_values T1_BLEND_BLUE_VALUES |
---|
230 | #define t1_blend_other_blues T1_BLEND_OTHER_BLUES |
---|
231 | #define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH |
---|
232 | #define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT |
---|
233 | #define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS |
---|
234 | #define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS |
---|
235 | #define t1_blend_blue_scale T1_BLEND_BLUE_SCALE |
---|
236 | #define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT |
---|
237 | #define t1_blend_family_blues T1_BLEND_FAMILY_BLUES |
---|
238 | #define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES |
---|
239 | #define t1_blend_force_bold T1_BLEND_FORCE_BOLD |
---|
240 | #define t1_blend_max T1_BLEND_MAX |
---|
241 | |
---|
242 | |
---|
243 | /* maximum number of Multiple Masters designs, as defined in the spec */ |
---|
244 | #define T1_MAX_MM_DESIGNS 16 |
---|
245 | |
---|
246 | /* maximum number of Multiple Masters axes, as defined in the spec */ |
---|
247 | #define T1_MAX_MM_AXIS 4 |
---|
248 | |
---|
249 | /* maximum number of elements in a design map */ |
---|
250 | #define T1_MAX_MM_MAP_POINTS 20 |
---|
251 | |
---|
252 | |
---|
253 | /* this structure is used to store the BlendDesignMap entry for an axis */ |
---|
254 | typedef struct PS_DesignMap_ |
---|
255 | { |
---|
256 | FT_Byte num_points; |
---|
257 | FT_Long* design_points; |
---|
258 | FT_Fixed* blend_points; |
---|
259 | |
---|
260 | } PS_DesignMapRec, *PS_DesignMap; |
---|
261 | |
---|
262 | /* backwards-compatible definition */ |
---|
263 | typedef PS_DesignMapRec T1_DesignMap; |
---|
264 | |
---|
265 | |
---|
266 | typedef struct PS_BlendRec_ |
---|
267 | { |
---|
268 | FT_UInt num_designs; |
---|
269 | FT_UInt num_axis; |
---|
270 | |
---|
271 | FT_String* axis_names[T1_MAX_MM_AXIS]; |
---|
272 | FT_Fixed* design_pos[T1_MAX_MM_DESIGNS]; |
---|
273 | PS_DesignMapRec design_map[T1_MAX_MM_AXIS]; |
---|
274 | |
---|
275 | FT_Fixed* weight_vector; |
---|
276 | FT_Fixed* default_weight_vector; |
---|
277 | |
---|
278 | PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1]; |
---|
279 | PS_Private privates [T1_MAX_MM_DESIGNS + 1]; |
---|
280 | |
---|
281 | FT_ULong blend_bitflags; |
---|
282 | |
---|
283 | FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1]; |
---|
284 | |
---|
285 | /* since 2.3.0 */ |
---|
286 | |
---|
287 | /* undocumented, optional: the default design instance; */ |
---|
288 | /* corresponds to default_weight_vector -- */ |
---|
289 | /* num_default_design_vector == 0 means it is not present */ |
---|
290 | /* in the font and associated metrics files */ |
---|
291 | FT_UInt default_design_vector[T1_MAX_MM_DESIGNS]; |
---|
292 | FT_UInt num_default_design_vector; |
---|
293 | |
---|
294 | } PS_BlendRec, *PS_Blend; |
---|
295 | |
---|
296 | |
---|
297 | /* backwards-compatible definition */ |
---|
298 | typedef PS_BlendRec T1_Blend; |
---|
299 | |
---|
300 | |
---|
301 | /*************************************************************************/ |
---|
302 | /* */ |
---|
303 | /* <Struct> */ |
---|
304 | /* CID_FaceDictRec */ |
---|
305 | /* */ |
---|
306 | /* <Description> */ |
---|
307 | /* A structure used to represent data in a CID top-level dictionary. */ |
---|
308 | /* */ |
---|
309 | typedef struct CID_FaceDictRec_ |
---|
310 | { |
---|
311 | PS_PrivateRec private_dict; |
---|
312 | |
---|
313 | FT_UInt len_buildchar; |
---|
314 | FT_Fixed forcebold_threshold; |
---|
315 | FT_Pos stroke_width; |
---|
316 | FT_Fixed expansion_factor; |
---|
317 | |
---|
318 | FT_Byte paint_type; |
---|
319 | FT_Byte font_type; |
---|
320 | FT_Matrix font_matrix; |
---|
321 | FT_Vector font_offset; |
---|
322 | |
---|
323 | FT_UInt num_subrs; |
---|
324 | FT_ULong subrmap_offset; |
---|
325 | FT_Int sd_bytes; |
---|
326 | |
---|
327 | } CID_FaceDictRec; |
---|
328 | |
---|
329 | |
---|
330 | /*************************************************************************/ |
---|
331 | /* */ |
---|
332 | /* <Struct> */ |
---|
333 | /* CID_FaceDict */ |
---|
334 | /* */ |
---|
335 | /* <Description> */ |
---|
336 | /* A handle to a @CID_FaceDictRec structure. */ |
---|
337 | /* */ |
---|
338 | typedef struct CID_FaceDictRec_* CID_FaceDict; |
---|
339 | |
---|
340 | /* */ |
---|
341 | |
---|
342 | |
---|
343 | /* backwards-compatible definition */ |
---|
344 | typedef CID_FaceDictRec CID_FontDict; |
---|
345 | |
---|
346 | |
---|
347 | /*************************************************************************/ |
---|
348 | /* */ |
---|
349 | /* <Struct> */ |
---|
350 | /* CID_FaceInfoRec */ |
---|
351 | /* */ |
---|
352 | /* <Description> */ |
---|
353 | /* A structure used to represent CID Face information. */ |
---|
354 | /* */ |
---|
355 | typedef struct CID_FaceInfoRec_ |
---|
356 | { |
---|
357 | FT_String* cid_font_name; |
---|
358 | FT_Fixed cid_version; |
---|
359 | FT_Int cid_font_type; |
---|
360 | |
---|
361 | FT_String* registry; |
---|
362 | FT_String* ordering; |
---|
363 | FT_Int supplement; |
---|
364 | |
---|
365 | PS_FontInfoRec font_info; |
---|
366 | FT_BBox font_bbox; |
---|
367 | FT_ULong uid_base; |
---|
368 | |
---|
369 | FT_Int num_xuid; |
---|
370 | FT_ULong xuid[16]; |
---|
371 | |
---|
372 | FT_ULong cidmap_offset; |
---|
373 | FT_Int fd_bytes; |
---|
374 | FT_Int gd_bytes; |
---|
375 | FT_ULong cid_count; |
---|
376 | |
---|
377 | FT_Int num_dicts; |
---|
378 | CID_FaceDict font_dicts; |
---|
379 | |
---|
380 | FT_ULong data_offset; |
---|
381 | |
---|
382 | } CID_FaceInfoRec; |
---|
383 | |
---|
384 | |
---|
385 | /*************************************************************************/ |
---|
386 | /* */ |
---|
387 | /* <Struct> */ |
---|
388 | /* CID_FaceInfo */ |
---|
389 | /* */ |
---|
390 | /* <Description> */ |
---|
391 | /* A handle to a @CID_FaceInfoRec structure. */ |
---|
392 | /* */ |
---|
393 | typedef struct CID_FaceInfoRec_* CID_FaceInfo; |
---|
394 | |
---|
395 | |
---|
396 | /*************************************************************************/ |
---|
397 | /* */ |
---|
398 | /* <Struct> */ |
---|
399 | /* CID_Info */ |
---|
400 | /* */ |
---|
401 | /* <Description> */ |
---|
402 | /* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */ |
---|
403 | /* kept to maintain source compatibility between various versions of */ |
---|
404 | /* FreeType. */ |
---|
405 | /* */ |
---|
406 | typedef CID_FaceInfoRec CID_Info; |
---|
407 | |
---|
408 | |
---|
409 | /************************************************************************ |
---|
410 | * |
---|
411 | * @function: |
---|
412 | * FT_Has_PS_Glyph_Names |
---|
413 | * |
---|
414 | * @description: |
---|
415 | * Return true if a given face provides reliable PostScript glyph |
---|
416 | * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro, |
---|
417 | * except that certain fonts (mostly TrueType) contain incorrect |
---|
418 | * glyph name tables. |
---|
419 | * |
---|
420 | * When this function returns true, the caller is sure that the glyph |
---|
421 | * names returned by @FT_Get_Glyph_Name are reliable. |
---|
422 | * |
---|
423 | * @input: |
---|
424 | * face :: |
---|
425 | * face handle |
---|
426 | * |
---|
427 | * @return: |
---|
428 | * Boolean. True if glyph names are reliable. |
---|
429 | * |
---|
430 | */ |
---|
431 | FT_EXPORT( FT_Int ) |
---|
432 | FT_Has_PS_Glyph_Names( FT_Face face ); |
---|
433 | |
---|
434 | |
---|
435 | /************************************************************************ |
---|
436 | * |
---|
437 | * @function: |
---|
438 | * FT_Get_PS_Font_Info |
---|
439 | * |
---|
440 | * @description: |
---|
441 | * Retrieve the @PS_FontInfoRec structure corresponding to a given |
---|
442 | * PostScript font. |
---|
443 | * |
---|
444 | * @input: |
---|
445 | * face :: |
---|
446 | * PostScript face handle. |
---|
447 | * |
---|
448 | * @output: |
---|
449 | * afont_info :: |
---|
450 | * Output font info structure pointer. |
---|
451 | * |
---|
452 | * @return: |
---|
453 | * FreeType error code. 0~means success. |
---|
454 | * |
---|
455 | * @note: |
---|
456 | * The string pointers within the font info structure are owned by |
---|
457 | * the face and don't need to be freed by the caller. |
---|
458 | * |
---|
459 | * If the font's format is not PostScript-based, this function will |
---|
460 | * return the `FT_Err_Invalid_Argument' error code. |
---|
461 | * |
---|
462 | */ |
---|
463 | FT_EXPORT( FT_Error ) |
---|
464 | FT_Get_PS_Font_Info( FT_Face face, |
---|
465 | PS_FontInfo afont_info ); |
---|
466 | |
---|
467 | |
---|
468 | /************************************************************************ |
---|
469 | * |
---|
470 | * @function: |
---|
471 | * FT_Get_PS_Font_Private |
---|
472 | * |
---|
473 | * @description: |
---|
474 | * Retrieve the @PS_PrivateRec structure corresponding to a given |
---|
475 | * PostScript font. |
---|
476 | * |
---|
477 | * @input: |
---|
478 | * face :: |
---|
479 | * PostScript face handle. |
---|
480 | * |
---|
481 | * @output: |
---|
482 | * afont_private :: |
---|
483 | * Output private dictionary structure pointer. |
---|
484 | * |
---|
485 | * @return: |
---|
486 | * FreeType error code. 0~means success. |
---|
487 | * |
---|
488 | * @note: |
---|
489 | * The string pointers within the font info structure are owned by |
---|
490 | * the face and don't need to be freed by the caller. |
---|
491 | * |
---|
492 | * If the font's format is not PostScript-based, this function will |
---|
493 | * return the `FT_Err_Invalid_Argument' error code. |
---|
494 | * |
---|
495 | */ |
---|
496 | FT_EXPORT( FT_Error ) |
---|
497 | FT_Get_PS_Font_Private( FT_Face face, |
---|
498 | PS_Private afont_private ); |
---|
499 | |
---|
500 | /* */ |
---|
501 | |
---|
502 | |
---|
503 | FT_END_HEADER |
---|
504 | |
---|
505 | #endif /* __T1TABLES_H__ */ |
---|
506 | |
---|
507 | |
---|
508 | /* END */ |
---|