Rev 1892 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1892 | serge | 1 | /* cairo - a vector graphics library with display and print output |
2 | * |
||
3 | * Copyright © 2006 Red Hat, Inc |
||
4 | * |
||
5 | * This library is free software; you can redistribute it and/or |
||
6 | * modify it either under the terms of the GNU Lesser General Public |
||
7 | * License version 2.1 as published by the Free Software Foundation |
||
8 | * (the "LGPL") or, at your option, under the terms of the Mozilla |
||
9 | * Public License Version 1.1 (the "MPL"). If you do not alter this |
||
10 | * notice, a recipient may use your version of this file under either |
||
11 | * the MPL or the LGPL. |
||
12 | * |
||
13 | * You should have received a copy of the LGPL along with this library |
||
14 | * in the file COPYING-LGPL-2.1; if not, write to the Free Software |
||
15 | * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA |
||
16 | * You should have received a copy of the MPL along with this library |
||
17 | * in the file COPYING-MPL-1.1 |
||
18 | * |
||
19 | * The contents of this file are subject to the Mozilla Public License |
||
20 | * Version 1.1 (the "License"); you may not use this file except in |
||
21 | * compliance with the License. You may obtain a copy of the License at |
||
22 | * http://www.mozilla.org/MPL/ |
||
23 | * |
||
24 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY |
||
25 | * OF ANY KIND, either express or implied. See the LGPL or the MPL for |
||
26 | * the specific language governing rights and limitations. |
||
27 | * |
||
28 | * The Original Code is the cairo graphics library. |
||
29 | * |
||
30 | * The Initial Developer of the Original Code is Red Hat, Inc. |
||
31 | * |
||
32 | * Contributor(s): |
||
33 | * Kristian Høgsberg |
||
34 | * Adrian Johnson |
||
35 | */ |
||
36 | |||
37 | #ifndef CAIRO_TRUETYPE_SUBSET_PRIVATE_H |
||
38 | #define CAIRO_TRUETYPE_SUBSET_PRIVATE_H |
||
39 | |||
40 | #include "cairoint.h" |
||
41 | |||
42 | #if CAIRO_HAS_FONT_SUBSET |
||
43 | |||
44 | /* The structs defined here should strictly follow the TrueType |
||
45 | * specification and not be padded. We use only 16-bit integer |
||
46 | * in their definition to guarantee that. The fields of type |
||
47 | * "FIXED" in the TT spec are broken into two *_1 and *_2 16-bit |
||
48 | * parts, and 64-bit members are broken into four. |
||
49 | * |
||
50 | * The test truetype-tables in the test suite makes sure that |
||
51 | * these tables have the right size. Please update that test |
||
52 | * if you add new tables/structs that should be packed. |
||
53 | */ |
||
54 | |||
55 | #define MAKE_TT_TAG(a, b, c, d) (a<<24 | b<<16 | c<<8 | d) |
||
56 | #define TT_TAG_CFF MAKE_TT_TAG('C','F','F',' ') |
||
57 | #define TT_TAG_cmap MAKE_TT_TAG('c','m','a','p') |
||
58 | #define TT_TAG_cvt MAKE_TT_TAG('c','v','t',' ') |
||
59 | #define TT_TAG_fpgm MAKE_TT_TAG('f','p','g','m') |
||
60 | #define TT_TAG_glyf MAKE_TT_TAG('g','l','y','f') |
||
61 | #define TT_TAG_head MAKE_TT_TAG('h','e','a','d') |
||
62 | #define TT_TAG_hhea MAKE_TT_TAG('h','h','e','a') |
||
63 | #define TT_TAG_hmtx MAKE_TT_TAG('h','m','t','x') |
||
64 | #define TT_TAG_loca MAKE_TT_TAG('l','o','c','a') |
||
65 | #define TT_TAG_maxp MAKE_TT_TAG('m','a','x','p') |
||
66 | #define TT_TAG_name MAKE_TT_TAG('n','a','m','e') |
||
3959 | Serge | 67 | #define TT_TAG_OS2 MAKE_TT_TAG('O','S','/','2') |
1892 | serge | 68 | #define TT_TAG_post MAKE_TT_TAG('p','o','s','t') |
69 | #define TT_TAG_prep MAKE_TT_TAG('p','r','e','p') |
||
70 | |||
71 | /* All tt_* structs are big-endian */ |
||
72 | typedef struct _tt_cmap_index { |
||
73 | uint16_t platform; |
||
74 | uint16_t encoding; |
||
75 | uint32_t offset; |
||
76 | } tt_cmap_index_t; |
||
77 | |||
78 | typedef struct _tt_cmap { |
||
79 | uint16_t version; |
||
80 | uint16_t num_tables; |
||
81 | tt_cmap_index_t index[1]; |
||
82 | } tt_cmap_t; |
||
83 | |||
84 | typedef struct _segment_map { |
||
85 | uint16_t format; |
||
86 | uint16_t length; |
||
87 | uint16_t version; |
||
88 | uint16_t segCountX2; |
||
89 | uint16_t searchRange; |
||
90 | uint16_t entrySelector; |
||
91 | uint16_t rangeShift; |
||
92 | uint16_t endCount[1]; |
||
93 | } tt_segment_map_t; |
||
94 | |||
95 | typedef struct _tt_head { |
||
96 | int16_t version_1; |
||
97 | int16_t version_2; |
||
98 | int16_t revision_1; |
||
99 | int16_t revision_2; |
||
100 | uint16_t checksum_1; |
||
101 | uint16_t checksum_2; |
||
102 | uint16_t magic_1; |
||
103 | uint16_t magic_2; |
||
104 | uint16_t flags; |
||
105 | uint16_t units_per_em; |
||
106 | int16_t created_1; |
||
107 | int16_t created_2; |
||
108 | int16_t created_3; |
||
109 | int16_t created_4; |
||
110 | int16_t modified_1; |
||
111 | int16_t modified_2; |
||
112 | int16_t modified_3; |
||
113 | int16_t modified_4; |
||
114 | int16_t x_min; /* FWORD */ |
||
115 | int16_t y_min; /* FWORD */ |
||
116 | int16_t x_max; /* FWORD */ |
||
117 | int16_t y_max; /* FWORD */ |
||
118 | uint16_t mac_style; |
||
119 | uint16_t lowest_rec_pppem; |
||
120 | int16_t font_direction_hint; |
||
121 | int16_t index_to_loc_format; |
||
122 | int16_t glyph_data_format; |
||
123 | } tt_head_t; |
||
124 | |||
125 | typedef struct _tt_hhea { |
||
126 | int16_t version_1; |
||
127 | int16_t version_2; |
||
128 | int16_t ascender; /* FWORD */ |
||
129 | int16_t descender; /* FWORD */ |
||
130 | int16_t line_gap; /* FWORD */ |
||
131 | uint16_t advance_max_width; /* UFWORD */ |
||
132 | int16_t min_left_side_bearing; /* FWORD */ |
||
133 | int16_t min_right_side_bearing; /* FWORD */ |
||
134 | int16_t x_max_extent; /* FWORD */ |
||
135 | int16_t caret_slope_rise; |
||
136 | int16_t caret_slope_run; |
||
137 | int16_t reserved[5]; |
||
138 | int16_t metric_data_format; |
||
139 | uint16_t num_hmetrics; |
||
140 | } tt_hhea_t; |
||
141 | |||
142 | typedef struct _tt_maxp { |
||
143 | int16_t version_1; |
||
144 | int16_t version_2; |
||
145 | uint16_t num_glyphs; |
||
146 | uint16_t max_points; |
||
147 | uint16_t max_contours; |
||
148 | uint16_t max_composite_points; |
||
149 | uint16_t max_composite_contours; |
||
150 | uint16_t max_zones; |
||
151 | uint16_t max_twilight_points; |
||
152 | uint16_t max_storage; |
||
153 | uint16_t max_function_defs; |
||
154 | uint16_t max_instruction_defs; |
||
155 | uint16_t max_stack_elements; |
||
156 | uint16_t max_size_of_instructions; |
||
157 | uint16_t max_component_elements; |
||
158 | uint16_t max_component_depth; |
||
159 | } tt_maxp_t; |
||
160 | |||
161 | typedef struct _tt_name_record { |
||
162 | uint16_t platform; |
||
163 | uint16_t encoding; |
||
164 | uint16_t language; |
||
165 | uint16_t name; |
||
166 | uint16_t length; |
||
167 | uint16_t offset; |
||
168 | } tt_name_record_t; |
||
169 | |||
170 | typedef struct _tt_name { |
||
171 | uint16_t format; |
||
172 | uint16_t num_records; |
||
173 | uint16_t strings_offset; |
||
174 | tt_name_record_t records[1]; |
||
175 | } tt_name_t; |
||
176 | |||
177 | |||
3959 | Serge | 178 | /* bitmask for fsSelection field */ |
179 | #define TT_FS_SELECTION_ITALIC 1 |
||
180 | #define TT_FS_SELECTION_BOLD 32 |
||
1892 | serge | 181 | |
3959 | Serge | 182 | /* _unused fields are defined in TT spec but not used by cairo */ |
183 | typedef struct _tt_os2 { |
||
184 | uint16_t _unused1[2]; |
||
185 | uint16_t usWeightClass; |
||
186 | uint16_t _unused2[28]; |
||
187 | uint16_t fsSelection; |
||
188 | uint16_t _unused3[11]; |
||
189 | } tt_os2_t; |
||
190 | |||
1892 | serge | 191 | /* composite_glyph_t flags */ |
192 | #define TT_ARG_1_AND_2_ARE_WORDS 0x0001 |
||
193 | #define TT_WE_HAVE_A_SCALE 0x0008 |
||
194 | #define TT_MORE_COMPONENTS 0x0020 |
||
195 | #define TT_WE_HAVE_AN_X_AND_Y_SCALE 0x0040 |
||
196 | #define TT_WE_HAVE_A_TWO_BY_TWO 0x0080 |
||
197 | |||
198 | typedef struct _tt_composite_glyph { |
||
199 | uint16_t flags; |
||
200 | uint16_t index; |
||
201 | uint16_t args[6]; /* 1 to 6 arguments depending on value of flags */ |
||
202 | } tt_composite_glyph_t; |
||
203 | |||
204 | typedef struct _tt_glyph_data { |
||
205 | int16_t num_contours; |
||
206 | int8_t data[8]; |
||
207 | tt_composite_glyph_t glyph; |
||
208 | } tt_glyph_data_t; |
||
209 | |||
210 | #endif /* CAIRO_HAS_FONT_SUBSET */ |
||
211 | |||
212 | #endif /* CAIRO_TRUETYPE_SUBSET_PRIVATE_H */8><8>16><16>24><24> |