4 * Copyright (C) 2011 by Werner Lemberg.
6 * This file is part of the ttfautohint library, and may only be used,
7 * modified, and distributed under the terms given in `COPYING'. By
8 * continuing to use, modify, or distribute this file you indicate that you
9 * have read `COPYING' and understand and accept it fully.
11 * The file `COPYING' mentioned in the previous paragraph is distributed
12 * with the ttfautohint library.
22 #include FT_FREETYPE_H
23 #include FT_TRUETYPE_TABLES_H
24 #include FT_TRUETYPE_TAGS_H
29 #include "ttfautohint.h"
32 /* these macros convert 16bit and 32bit numbers into single bytes */
33 /* using the byte order needed within SFNT files */
35 #define HIGH(x) (FT_Byte)(((x) & 0xFF00) >> 8)
36 #define LOW(x) ((x) & 0x00FF)
38 #define BYTE1(x) (FT_Byte)(((x) & 0xFF000000UL) >> 24);
39 #define BYTE2(x) (FT_Byte)(((x) & 0x00FF0000UL) >> 16);
40 #define BYTE3(x) (FT_Byte)(((x) & 0x0000FF00UL) >> 8);
41 #define BYTE4(x) ((x) & 0x000000FFUL);
44 /* the length of a dummy `DSIG' table */
47 /* the length of our `gasp' table */
50 /* an empty slot in the table info array */
51 #define MISSING (FT_ULong)~0
53 /* the offset to the loca table format in the `head' table */
54 #define LOCA_FORMAT_OFFSET 51
56 /* various offsets within the `maxp' table */
57 #define MAXP_MAX_ZONES_OFFSET 14
58 #define MAXP_MAX_TWILIGHT_POINTS_OFFSET 16
59 #define MAXP_MAX_STORAGE_OFFSET 18
60 #define MAXP_MAX_FUNCTION_DEFS_OFFSET 20
61 #define MAXP_MAX_INSTRUCTION_DEFS_OFFSET 22
62 #define MAXP_MAX_STACK_ELEMENTS_OFFSET 24
63 #define MAXP_MAX_INSTRUCTIONS_OFFSET 26
67 /* the offset of the type flags field in the `OS/2' table */
68 #define OS2_FSTYPE_OFFSET 8
71 /* flags in composite glyph records */
72 #define ARGS_ARE_WORDS 0x0001
73 #define ARGS_ARE_XY_VALUES 0x0002
74 #define WE_HAVE_A_SCALE 0x0008
75 #define MORE_COMPONENTS 0x0020
76 #define WE_HAVE_AN_XY_SCALE 0x0040
77 #define WE_HAVE_A_2X2 0x0080
78 #define WE_HAVE_INSTR 0x0100
80 /* flags in simple glyph records */
81 #define X_SHORT_VECTOR 0x02
82 #define Y_SHORT_VECTOR 0x04
91 FT_ULong len1
; /* number of bytes before instructions location */
92 FT_ULong len2
; /* number of bytes after instructions location; */
93 /* if zero, this indicates a composite glyph */
94 FT_Byte
* buf
; /* extracted glyph data */
95 FT_ULong flags_offset
; /* offset to last flag in a composite glyph */
97 FT_ULong ins_len
; /* number of new instructions */
98 FT_Byte
* ins_buf
; /* new instruction data */
101 /* a representation of the data in the `glyf' table */
102 typedef struct glyf_Data_
104 FT_UShort num_glyphs
;
109 typedef struct SFNT_Table_
{
112 FT_Byte
* buf
; /* the table data */
113 FT_ULong offset
; /* from beginning of file */
115 void* data
; /* used e.g. for `glyf' table data */
119 /* we use indices into the SFNT table array to */
120 /* represent table info records of the TTF header */
121 typedef FT_ULong SFNT_Table_Info
;
123 /* this structure is used to model a TTF or a subfont within a TTC */
124 typedef struct SFNT_
{
127 SFNT_Table_Info
* table_infos
;
128 FT_ULong num_table_infos
;
130 /* various SFNT table indices */
137 /* values necessary to update the `maxp' table */
138 FT_UShort max_storage
;
139 FT_UShort max_stack_elements
;
140 FT_UShort max_twilight_points
;
141 FT_UShort max_instructions
;
144 /* our font object */
145 typedef struct FONT_
{
160 TA_LoaderRec loader
[1]; /* the interface to the autohinter */
162 /* configuration options */
163 TA_Progress_Func progress
;
165 FT_UInt hinting_range_min
;
166 FT_UInt hinting_range_max
;
168 FT_Bool no_x_height_snapping
;
169 FT_Byte
* x_height_snapping_exceptions
;
170 FT_Bool ignore_permissions
;
171 FT_UInt fallback_script
;
174 #include "tatables.h"
175 #include "tabytecode.h"
177 #endif /* __TA_H__ */