Fix OTS warning about `maxp.maxSizeOfInstructions`.
[ttfautohint.git] / lib / tabytecode.h
blob17d99f480b3ee742464b3106ff74930f5662c623
1 /* tabytecode.h */
3 /*
4 * Copyright (C) 2011-2022 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.
16 #ifndef TABYTECODE_H_
17 #define TABYTECODE_H_
20 /* symbolic names for bytecode instruction codes */
22 #define SVTCA_y 0x00 /* set freedom and projection vectors to y axis */
23 #define SVTCA_x 0x01 /* set freedom and projection vectors to x axis */
24 #define SPVTCA_y 0x02 /* set projection vector to y axis */
25 #define SPVTCA_x 0x03 /* set projection vector to x axis */
26 #define SFVTCA_y 0x04 /* set freedom vector to y axis */
27 #define SFVTCA_x 0x05 /* set freedom vector to x axis */
28 #define SPVTL_para 0x06 /* set projection vector parallel to line */
29 #define SPVTL_perp 0x07 /* set projection vector perpendicular to line */
30 #define SFVTL_para 0x08 /* set freedom vector parallel to line */
31 #define SFVTL_perp 0x09 /* set freedom vector perpendicular to line */
32 #define SPVFS 0x0A /* set projection vector from stack */
33 #define SFVFS 0x0B /* set freedom vector from stack */
34 #define GPV 0x0C /* get projection vector */
35 #define GFV 0x0D /* get freedom vector */
36 #define SFVTPV 0x0E /* set freedom vector to projection vector */
37 #define ISECT 0x0F /* move point to intersection of lines */
39 #define SRP0 0x10 /* set reference point 0 */
40 #define SRP1 0x11 /* set reference point 1 */
41 #define SRP2 0x12 /* set reference point 2 */
42 #define SZP0 0x13 /* set zone pointer 0 */
43 #define SZP1 0x14 /* set zone pointer 1 */
44 #define SZP2 0x15 /* set zone pointer 2 */
45 #define SZPS 0x16 /* set zone pointers */
46 #define SLOOP 0x17 /* set loop counter */
47 #define RTG 0x18 /* round to grid */
48 #define RTHG 0x19 /* round to half grid */
49 #define SMD 0x1A /* set `minimum_distance' */
50 #define ELSE 0x1B /* begin of `else' clause */
51 #define JMPR 0x1C /* jump relative */
52 #define SCVTCI 0x1D /* set `control_value_cut_in' */
53 #define SSWCI 0x1E /* set `single_width_cut_in' */
54 #define SSW 0x1F /* set `single_width_value' */
56 #define DUP 0x20 /* duplicate top stack element */
57 #define POP 0x21 /* pop top stack element */
58 #define CLEAR 0x22 /* clear entire stack */
59 #define SWAP 0x23 /* swap top two elements of stack */
60 #define DEPTH 0x24 /* get depth of stack */
61 #define CINDEX 0x25 /* copy indexed element to top of stack */
62 #define MINDEX 0x26 /* move indexed element to top of stack */
63 #define ALIGNPTS 0x27 /* align points */
64 #define INS_28 0x28 /* undefined */
65 #define UTP 0x29 /* untouch point */
66 #define LOOPCALL 0x2A /* loop and call function */
67 #define CALL 0x2B /* call function */
68 #define FDEF 0x2C /* define function */
69 #define ENDF 0x2D /* end of function */
70 #define MDAP_noround 0x2E /* move direct absolute point without rounding */
71 #define MDAP_round 0x2F /* move direct absolute point with rounding */
73 #define IUP_y 0x30 /* interpolate untouched points along y axis */
74 #define IUP_x 0x31 /* interpolate untouched points along x axis */
75 #define SHP_rp2 0x32 /* shift point using rp2 */
76 #define SHP_rp1 0x33 /* shift point using rp1 */
77 #define SHC_rp2 0x34 /* shift contour using rp2 */
78 #define SHC_rp1 0x35 /* shift contour using rp1 */
79 #define SHZ_rp2 0x36 /* shift zone using rp2 */
80 #define SHZ_rp1 0x37 /* shift zone using rp1 */
81 #define SHPIX 0x38 /* shift point by pixel amount */
82 #define IP 0x39 /* interpolate point */
83 #define MSIRP_norp0 0x3A /* move stack indirect relative point, don't set rp0 */
84 #define MSIRP_rp0 0x3B /* move stack indirect relative point, set rp0 */
85 #define ALIGNRP 0x3C /* align relative point */
86 #define RTDG 0x3D /* round to double grid */
87 #define MIAP_noround 0x3E /* move indirect absolute point without rounding */
88 #define MIAP_round 0x3F /* move indirect absolute point with rounding */
90 #define NPUSHB 0x40 /* push `n' bytes */
91 #define NPUSHW 0x41 /* push `n' words */
92 #define WS 0x42 /* write to storage area */
93 #define RS 0x43 /* read from storage area */
94 #define WCVTP 0x44 /* write to CVT in pixel units */
95 #define RCVT 0x45 /* read from CVT */
96 #define GC_cur 0x46 /* get (projected) coordinate, current position */
97 #define GC_orig 0x47 /* get (projected) coordinate, original position */
98 #define SCFS 0x48 /* set coordinate from stack */
99 #define MD_cur 0x49 /* measure distance, current positions */
100 #define MD_orig 0x4A /* measure distance, original positions */
101 #define MPPEM 0x4B /* measure PPEM */
102 #define MPS 0x4C /* measure point size */
103 #define FLIPON 0x4D /* set `auto_flip' to TRUE */
104 #define FLIPOFF 0x4E /* set `auto_flip' to FALSE */
105 #define DEBUG 0x4F /* ignored */
107 #define LT 0x50 /* lower than */
108 #define LTEQ 0x51 /* lower than or equal */
109 #define GT 0x52 /* greater than */
110 #define GTEQ 0x53 /* greater than or equal */
111 #define EQ 0x54 /* equal */
112 #define NEQ 0x55 /* not equal */
113 #define ODD 0x56 /* TRUE if odd */
114 #define EVEN 0x57 /* TRUE if even */
115 #define IF 0x58 /* start of `if' clause */
116 #define EIF 0x59 /* end of `if' or `else' clause */
117 #define AND 0x5A /* logical AND */
118 #define OR 0x5B /* logical OR */
119 #define NOT 0x5C /* logical NOT */
120 #define DELTAP1 0x5D /* delta point exception 1 */
121 #define SDB 0x5E /* set `delta_base' */
122 #define SDS 0x5F /* set `delta_shift' */
124 #define ADD 0x60 /* addition */
125 #define SUB 0x61 /* subtraction */
126 #define DIV 0x62 /* division */
127 #define MUL 0x63 /* multiplication */
128 #define ABS 0x64 /* absolute value */
129 #define NEG 0x65 /* negation */
130 #define FLOOR 0x66 /* floor operation */
131 #define CEILING 0x67 /* ceiling operation */
132 #define ROUND_gray 0x68 /* round value with gray compensation */
133 #define ROUND_black 0x69 /* round value with black compensation */
134 #define ROUND_white 0x6A /* round value with white compensation */
135 #define ROUND_3 0x6B /* undefined */
136 #define NROUND_gray 0x6C /* apply gray compensation */
137 #define NROUND_black 0x6D /* apply black compensation */
138 #define NROUND_white 0x6E /* apply white compensation */
139 #define NROUND_3 0x6F /* undefined */
141 #define WCVTF 0x70 /* write to CVT in font units */
142 #define DELTAP2 0x71 /* delta point exception 2 */
143 #define DELTAP3 0x72 /* delta point exception 3 */
144 #define DELTAC1 0x73 /* delta cvt exception 1 */
145 #define DELTAC2 0x74 /* delta cvt exception 2 */
146 #define DELTAC3 0x75 /* delta cvt exception 3 */
147 #define SROUND 0x76 /* super round */
148 #define S45Round 0x77 /* super round at 45 degrees */
149 #define JROT 0x78 /* jump relative on TRUE */
150 #define JROF 0x79 /* jump relative on FALSE */
151 #define ROFF 0x7A /* turn off rounding */
152 #define INS_7B 0x7B /* undefined */
153 #define RUTG 0x7C /* round up to grid */
154 #define RDTG 0x7D /* round down to grid */
155 #define SANGW 0x7E /* ignored, obsolete */
156 #define AA 0x7F /* ignored, obsolete */
158 #define FLIPPT 0x80 /* flip point on-curve to off-curve and vice versa */
159 #define FLIPRGON 0x81 /* flip range of points to be on-curve */
160 #define FlIPRGOFF 0x82 /* flip range of points to be off-curve */
161 #define INS_83 0x83 /* undefined */
162 #define INS_84 0x84 /* undefined */
163 #define SCANCTRL 0x85 /* scan conversion control */
164 #define SDPVTL_para 0x86 /* set dual projection vector parallel to line */
165 #define SDPVTL_perp 0x87 /* set dual projection vector perpendicular to line */
166 #define GETINFO 0x88 /* get information about font scaler and current glyph */
167 #define IDEF 0x89 /* define instruction */
168 #define ROLL 0x8A /* roll top three stack elements */
169 #define MAX 0x8B /* maximum */
170 #define MIN 0x8C /* minimum */
171 #define SCANTYPE 0x8D /* set scan conversion rules */
172 #define INSTCTRL 0x8E /* set instruction control state */
173 #define INS_8F 0x8F /* undefined */
175 #define INS_90 0x90 /* undefined */
176 #define INS_91 0x91
177 #define INS_92 0x92
178 #define INS_93 0x93
179 #define INS_94 0x94
180 #define INS_95 0x95
181 #define INS_96 0x96
182 #define INS_97 0x97
183 #define INS_98 0x98
184 #define INS_99 0x99
185 #define INS_9A 0x9A
186 #define INS_9B 0x9B
187 #define INS_9C 0x9C
188 #define INS_9D 0x9D
189 #define INS_9E 0x9E
190 #define INS_9F 0x9F
192 #define INS_A0 0xA0 /* undefined */
193 #define INS_A1 0xA1
194 #define INS_A2 0xA2
195 #define INS_A3 0xA3
196 #define INS_A4 0xA4
197 #define INS_A5 0xA5
198 #define INS_A6 0xA6
199 #define INS_A7 0xA7
200 #define INS_A8 0xA8
201 #define INS_9A 0x9A
202 #define INS_AA 0xAA
203 #define INS_AB 0xAB
204 #define INS_AC 0xAC
205 #define INS_AD 0xAD
206 #define INS_AE 0xAE
207 #define INS_AF 0xAF
209 #define PUSHB_1 0xB0 /* push 1 byte */
210 #define PUSHB_2 0xB1 /* push 2 bytes */
211 #define PUSHB_3 0xB2 /* push 3 bytes */
212 #define PUSHB_4 0xB3 /* push 4 bytes */
213 #define PUSHB_5 0xB4 /* push 5 bytes */
214 #define PUSHB_6 0xB5 /* push 6 bytes */
215 #define PUSHB_7 0xB6 /* push 7 bytes */
216 #define PUSHB_8 0xB7 /* push 8 bytes */
217 #define PUSHW_1 0xB8 /* push 1 word */
218 #define PUSHW_2 0xB9 /* push 2 words */
219 #define PUSHW_3 0xBA /* push 3 words */
220 #define PUSHW_4 0xBB /* push 4 words */
221 #define PUSHW_5 0xBC /* push 5 words */
222 #define PUSHW_6 0xBD /* push 6 words */
223 #define PUSHW_7 0xBE /* push 7 words */
224 #define PUSHW_8 0xBF /* push 8 words */
226 #define MDRP_norp0_nokeep_noround_gray 0xC0 /* move direct relative point */
227 #define MDRP_norp0_nokeep_noround_black 0xC1
228 #define MDRP_norp0_nokeep_noround_white 0xC2
229 #define MDRP_norp0_nokeep_noround_3 0xC3 /* undefined */
230 #define MDRP_norp0_nokeep_round_gray 0xC4
231 #define MDRP_norp0_nokeep_round_black 0xC5
232 #define MDRP_norp0_nokeep_round_white 0xC6
233 #define MDRP_norp0_nokeep_round_3 0xC7
234 #define MDRP_norp0_keep_noround_gray 0xC8
235 #define MDRP_norp0_keep_noround_black 0xC9
236 #define MDRP_norp0_keep_noround_white 0xCA
237 #define MDRP_norp0_keep_noround_3 0xCB
238 #define MDRP_norp0_keep_round_gray 0xCC
239 #define MDRP_norp0_keep_round_black 0xCD
240 #define MDRP_norp0_keep_round_white 0xCE
241 #define MDRP_norp0_keep_round_3 0xCF
243 #define MDRP_rp0_nokeep_noround_gray 0xD0
244 #define MDRP_rp0_nokeep_noround_black 0xD1
245 #define MDRP_rp0_nokeep_noround_white 0xD2
246 #define MDRP_rp0_nokeep_noround_3 0xD3
247 #define MDRP_rp0_nokeep_round_gray 0xD4
248 #define MDRP_rp0_nokeep_round_black 0xD5
249 #define MDRP_rp0_nokeep_round_white 0xD6
250 #define MDRP_rp0_nokeep_round_3 0xD7
251 #define MDRP_rp0_keep_noround_gray 0xD8
252 #define MDRP_rp0_keep_noround_black 0xD9
253 #define MDRP_rp0_keep_noround_white 0xDA
254 #define MDRP_rp0_keep_noround_3 0xDB
255 #define MDRP_rp0_keep_round_gray 0xDC
256 #define MDRP_rp0_keep_round_black 0xDD
257 #define MDRP_rp0_keep_round_white 0xDE
258 #define MDRP_rp0_keep_round_3 0xDF
260 #define MIRP_norp0_nokeep_noround_gray 0xE0 /* move indirect relative point */
261 #define MIRP_norp0_nokeep_noround_black 0xE1
262 #define MIRP_norp0_nokeep_noround_white 0xE2
263 #define MIRP_norp0_nokeep_noround_3 0xE3 /* undefined */
264 #define MIRP_norp0_nokeep_round_gray 0xE4
265 #define MIRP_norp0_nokeep_round_black 0xE5
266 #define MIRP_norp0_nokeep_round_white 0xE6
267 #define MIRP_norp0_nokeep_round_3 0xE7
268 #define MIRP_norp0_keep_noround_gray 0xE8
269 #define MIRP_norp0_keep_noround_black 0xE9
270 #define MIRP_norp0_keep_noround_white 0xEA
271 #define MIRP_norp0_keep_noround_3 0xEB
272 #define MIRP_norp0_keep_round_gray 0xEC
273 #define MIRP_norp0_keep_round_black 0xED
274 #define MIRP_norp0_keep_round_white 0xEE
275 #define MIRP_norp0_keep_round_3 0xEF
277 #define MIRP_rp0_nokeep_noround_gray 0xF0
278 #define MIRP_rp0_nokeep_noround_black 0xF1
279 #define MIRP_rp0_nokeep_noround_white 0xF2
280 #define MIRP_rp0_nokeep_noround_3 0xF3
281 #define MIRP_rp0_nokeep_round_gray 0xF4
282 #define MIRP_rp0_nokeep_round_black 0xF5
283 #define MIRP_rp0_nokeep_round_white 0xF6
284 #define MIRP_rp0_nokeep_round_3 0xF7
285 #define MIRP_rp0_keep_noround_gray 0xF8
286 #define MIRP_rp0_keep_noround_black 0xF9
287 #define MIRP_rp0_keep_noround_white 0xFA
288 #define MIRP_rp0_keep_noround_3 0xFB
289 #define MIRP_rp0_keep_round_gray 0xFC
290 #define MIRP_rp0_keep_round_black 0xFD
291 #define MIRP_rp0_keep_round_white 0xFE
292 #define MIRP_rp0_keep_round_3 0xFF
295 /* a simple macro to emit bytecode instructions */
296 #define BCI(code) *(bufp++) = (FT_Byte)(code)
298 /* we increase the stack depth by this amount */
299 #define ADDITIONAL_STACK_ELEMENTS 20
302 /* symbolic names for storage area locations */
304 /* 0 */
305 #define sal_i 0
306 #define sal_j sal_i + 1
307 #define sal_k sal_j + 1
308 #define sal_limit sal_k + 1
309 #define sal_temp1 sal_limit + 1
310 #define sal_temp2 sal_temp1 + 1
311 #define sal_temp3 sal_temp2 + 1
312 #define sal_best sal_temp3 + 1
313 #define sal_ref sal_best + 1
314 #define sal_func sal_ref + 1
316 /* 10 */
317 #define sal_anchor sal_func + 1
318 #define sal_stem_width_function sal_anchor + 1
319 #define sal_base_delta sal_stem_width_function + 1
320 #define sal_vwidth_data_offset sal_base_delta + 1
321 #define sal_scale sal_vwidth_data_offset + 1
322 #define sal_point_min sal_scale + 1
323 #define sal_point_max sal_point_min + 1
324 #define sal_base sal_point_max + 1
325 #define sal_num_packed_segments sal_base + 1
326 #define sal_num_stem_widths sal_num_packed_segments + 1
328 /* 20 */
329 #define sal_stem_width_offset sal_num_stem_widths + 1
330 #define sal_have_cached_width sal_stem_width_offset + 1
331 #define sal_cached_width_offset sal_have_cached_width + 1
332 #define sal_top_to_bottom_hinting sal_cached_width_offset + 1
333 #define sal_segment_offset sal_top_to_bottom_hinting + 1 /* must be last */
336 * After the above registers we have the following layout in the storage
337 * area.
339 * sal[sal_segment_offset]:
340 * `2 * num_segments' registers to hold the start and end points of a
341 * glyph's segments.
342 * sal[sal_segment_offset + 2*num_segments]:
343 * quantized stem width 1 (before stem width computing)
344 * quantized stem width 1 (after stem width computing)
345 * quantized stem width 2 (before stem width computing)
346 * quantized stem width 2 (after stem width computing)
347 * ...
351 /* bytecode function numbers */
353 /* 0 */
354 #define bci_align_x_height 0
355 #define bci_round bci_align_x_height + 1
356 #define bci_natural_stem_width bci_round + 1
357 #define bci_quantize_stem_width bci_natural_stem_width + 1
358 #define bci_smooth_stem_width bci_quantize_stem_width + 1
359 #define bci_get_best_width bci_smooth_stem_width + 1
360 #define bci_strong_stem_width bci_get_best_width + 1
361 #define bci_loop_do bci_strong_stem_width + 1
362 #define bci_loop bci_loop_do + 1
363 #define bci_cvt_rescale bci_loop + 1
364 #define bci_cvt_rescale_range bci_cvt_rescale + 1
365 #define bci_vwidth_data_store bci_cvt_rescale_range + 1
366 #define bci_smooth_blue_round bci_vwidth_data_store + 1
367 #define bci_strong_blue_round bci_smooth_blue_round + 1
368 #define bci_blue_round_range bci_strong_blue_round + 1
369 #define bci_decrement_component_counter bci_blue_round_range + 1
370 #define bci_get_point_extrema bci_decrement_component_counter + 1
371 #define bci_nibbles bci_get_point_extrema + 1
372 #define bci_number_set_is_element bci_nibbles + 1
373 #define bci_number_set_is_element2 bci_number_set_is_element + 1
375 /* 20 */
376 #define bci_create_segment bci_number_set_is_element2 + 1
377 #define bci_create_segments bci_create_segment + 1
379 /* 22 */
380 /* the next ten entries must stay in this order */
381 #define bci_create_segments_0 bci_create_segments + 1
382 #define bci_create_segments_1 bci_create_segments_0 + 1
383 #define bci_create_segments_2 bci_create_segments_1 + 1
384 #define bci_create_segments_3 bci_create_segments_2 + 1
385 #define bci_create_segments_4 bci_create_segments_3 + 1
386 #define bci_create_segments_5 bci_create_segments_4 + 1
387 #define bci_create_segments_6 bci_create_segments_5 + 1
388 #define bci_create_segments_7 bci_create_segments_6 + 1
389 #define bci_create_segments_8 bci_create_segments_7 + 1
390 #define bci_create_segments_9 bci_create_segments_8 + 1
392 #define bci_create_segments_composite bci_create_segments_9 + 1
394 /* 33 */
395 /* the next ten entries must stay in this order */
396 #define bci_create_segments_composite_0 bci_create_segments_composite + 1
397 #define bci_create_segments_composite_1 bci_create_segments_composite_0 + 1
398 #define bci_create_segments_composite_2 bci_create_segments_composite_1 + 1
399 #define bci_create_segments_composite_3 bci_create_segments_composite_2 + 1
400 #define bci_create_segments_composite_4 bci_create_segments_composite_3 + 1
401 #define bci_create_segments_composite_5 bci_create_segments_composite_4 + 1
402 #define bci_create_segments_composite_6 bci_create_segments_composite_5 + 1
403 #define bci_create_segments_composite_7 bci_create_segments_composite_6 + 1
404 #define bci_create_segments_composite_8 bci_create_segments_composite_7 + 1
405 #define bci_create_segments_composite_9 bci_create_segments_composite_8 + 1
407 /* 43 */
408 /* the next three entries must stay in this order */
409 #define bci_deltap1 bci_create_segments_composite_9 + 1
410 #define bci_deltap2 bci_deltap1 + 1
411 #define bci_deltap3 bci_deltap2 + 1
413 /* 46 */
414 #define bci_align_point bci_deltap3 + 1
415 #define bci_align_segment bci_align_point + 1
416 #define bci_align_segments bci_align_segment + 1
418 /* 49 */
419 #define bci_scale_contour bci_align_segments + 1
420 #define bci_scale_glyph bci_scale_contour + 1
421 #define bci_scale_composite_glyph bci_scale_glyph + 1
422 #define bci_shift_contour bci_scale_composite_glyph + 1
423 #define bci_shift_subglyph bci_shift_contour + 1
425 /* 54 */
426 #define bci_ip_outer_align_point bci_shift_subglyph + 1
427 #define bci_ip_on_align_points bci_ip_outer_align_point + 1
428 #define bci_ip_between_align_point bci_ip_on_align_points + 1
429 #define bci_ip_between_align_points bci_ip_between_align_point + 1
431 /* 58 */
432 #define bci_adjust_common bci_ip_between_align_points + 1
433 #define bci_stem_common bci_adjust_common + 1
434 #define bci_serif_common bci_stem_common + 1
435 #define bci_serif_anchor_common bci_serif_common + 1
436 #define bci_serif_link1_common bci_serif_anchor_common + 1
437 #define bci_serif_link2_common bci_serif_link1_common + 1
439 /* 64 */
440 #define bci_lower_bound bci_serif_link2_common + 1
441 #define bci_upper_bound bci_lower_bound + 1
442 #define bci_upper_lower_bound bci_upper_bound + 1
444 /* 67 */
445 #define bci_adjust_bound bci_upper_lower_bound + 1
446 #define bci_stem_bound bci_adjust_bound + 1
447 #define bci_link bci_stem_bound + 1
448 #define bci_anchor bci_link + 1
449 #define bci_adjust bci_anchor + 1
450 #define bci_stem bci_adjust + 1
452 /* the order of the `bci_action_*' entries must correspond */
453 /* to the order of the TA_Action enumeration entries (in `tahints.h') */
455 /* 73 */
456 #define bci_action_ip_before bci_stem + 1
457 #define bci_action_ip_after bci_action_ip_before + 1
458 #define bci_action_ip_on bci_action_ip_after + 1
459 #define bci_action_ip_between bci_action_ip_on + 1
461 /* 77 */
462 #define bci_action_blue bci_action_ip_between + 1
463 #define bci_action_blue_anchor bci_action_blue + 1
465 /* 79 */
466 #define bci_action_anchor bci_action_blue_anchor + 1
467 #define bci_action_anchor_serif bci_action_anchor + 1
468 #define bci_action_anchor_round bci_action_anchor_serif + 1
469 #define bci_action_anchor_round_serif bci_action_anchor_round + 1
471 /* 83 */
472 #define bci_action_adjust bci_action_anchor_round_serif + 1
473 #define bci_action_adjust_serif bci_action_adjust + 1
474 #define bci_action_adjust_round bci_action_adjust_serif + 1
475 #define bci_action_adjust_round_serif bci_action_adjust_round + 1
476 #define bci_action_adjust_bound bci_action_adjust_round_serif + 1
477 #define bci_action_adjust_bound_serif bci_action_adjust_bound + 1
478 #define bci_action_adjust_bound_round bci_action_adjust_bound_serif + 1
479 #define bci_action_adjust_bound_round_serif bci_action_adjust_bound_round + 1
480 #define bci_action_adjust_down_bound bci_action_adjust_bound_round_serif + 1
481 #define bci_action_adjust_down_bound_serif bci_action_adjust_down_bound + 1
482 #define bci_action_adjust_down_bound_round bci_action_adjust_down_bound_serif + 1
483 #define bci_action_adjust_down_bound_round_serif bci_action_adjust_down_bound_round + 1
485 /* 95 */
486 #define bci_action_link bci_action_adjust_down_bound_round_serif + 1
487 #define bci_action_link_serif bci_action_link + 1
488 #define bci_action_link_round bci_action_link_serif + 1
489 #define bci_action_link_round_serif bci_action_link_round + 1
491 /* 99 */
492 #define bci_action_stem bci_action_link_round_serif + 1
493 #define bci_action_stem_serif bci_action_stem + 1
494 #define bci_action_stem_round bci_action_stem_serif + 1
495 #define bci_action_stem_round_serif bci_action_stem_round + 1
496 #define bci_action_stem_bound bci_action_stem_round_serif + 1
497 #define bci_action_stem_bound_serif bci_action_stem_bound + 1
498 #define bci_action_stem_bound_round bci_action_stem_bound_serif + 1
499 #define bci_action_stem_bound_round_serif bci_action_stem_bound_round + 1
500 #define bci_action_stem_down_bound bci_action_stem_bound_round_serif + 1
501 #define bci_action_stem_down_bound_serif bci_action_stem_down_bound + 1
502 #define bci_action_stem_down_bound_round bci_action_stem_down_bound_serif + 1
503 #define bci_action_stem_down_bound_round_serif bci_action_stem_down_bound_round + 1
505 /* 111 */
506 #define bci_action_serif bci_action_stem_down_bound_round_serif + 1
507 #define bci_action_serif_lower_bound bci_action_serif + 1
508 #define bci_action_serif_upper_bound bci_action_serif_lower_bound + 1
509 #define bci_action_serif_upper_lower_bound bci_action_serif_upper_bound + 1
510 #define bci_action_serif_down_lower_bound bci_action_serif_upper_lower_bound + 1
511 #define bci_action_serif_down_upper_bound bci_action_serif_down_lower_bound + 1
512 #define bci_action_serif_down_upper_lower_bound bci_action_serif_down_upper_bound + 1
514 /* 118 */
515 #define bci_action_serif_anchor bci_action_serif_down_upper_lower_bound + 1
516 #define bci_action_serif_anchor_lower_bound bci_action_serif_anchor + 1
517 #define bci_action_serif_anchor_upper_bound bci_action_serif_anchor_lower_bound + 1
518 #define bci_action_serif_anchor_upper_lower_bound bci_action_serif_anchor_upper_bound + 1
519 #define bci_action_serif_anchor_down_lower_bound bci_action_serif_anchor_upper_lower_bound + 1
520 #define bci_action_serif_anchor_down_upper_bound bci_action_serif_anchor_down_lower_bound + 1
521 #define bci_action_serif_anchor_down_upper_lower_bound bci_action_serif_anchor_down_upper_bound + 1
523 /* 125 */
524 #define bci_action_serif_link1 bci_action_serif_anchor_down_upper_lower_bound + 1
525 #define bci_action_serif_link1_lower_bound bci_action_serif_link1 + 1
526 #define bci_action_serif_link1_upper_bound bci_action_serif_link1_lower_bound + 1
527 #define bci_action_serif_link1_upper_lower_bound bci_action_serif_link1_upper_bound + 1
528 #define bci_action_serif_link1_down_lower_bound bci_action_serif_link1_upper_lower_bound + 1
529 #define bci_action_serif_link1_down_upper_bound bci_action_serif_link1_down_lower_bound + 1
530 #define bci_action_serif_link1_down_upper_lower_bound bci_action_serif_link1_down_upper_bound + 1
532 /* 132 */
533 #define bci_action_serif_link2 bci_action_serif_link1_down_upper_lower_bound + 1
534 #define bci_action_serif_link2_lower_bound bci_action_serif_link2 + 1
535 #define bci_action_serif_link2_upper_bound bci_action_serif_link2_lower_bound + 1
536 #define bci_action_serif_link2_upper_lower_bound bci_action_serif_link2_upper_bound + 1
537 #define bci_action_serif_link2_down_lower_bound bci_action_serif_link2_upper_lower_bound + 1
538 #define bci_action_serif_link2_down_upper_bound bci_action_serif_link2_down_lower_bound + 1
539 #define bci_action_serif_link2_down_upper_lower_bound bci_action_serif_link2_down_upper_bound + 1
541 /* 139 */
542 #define bci_hint_glyph bci_action_serif_link2_down_upper_lower_bound + 1
544 /* 140 */
545 #define bci_freetype_enable_deltas bci_hint_glyph + 1
547 #define NUM_FDEFS bci_freetype_enable_deltas + 1 /* must be last */
549 /* the first action handler */
550 #define ACTION_OFFSET bci_action_ip_before
553 /* symbolic names for run-time CVT locations */
554 /* (assigned in `prep' or `fpgm') */
556 #define cvtl_temp 0 /* used for creating twilight points */
557 #define cvtl_funits_to_pixels cvtl_temp + 1
558 #define cvtl_is_subglyph cvtl_funits_to_pixels + 1
559 #define cvtl_stem_width_mode cvtl_is_subglyph + 1
560 #define cvtl_is_element cvtl_stem_width_mode + 1
561 #define cvtl_do_iup_y cvtl_is_element + 1
562 #define cvtl_ignore_std_width cvtl_do_iup_y + 1
564 #define cvtl_max_runtime cvtl_ignore_std_width + 1 /* must be last */
567 /* symbolic names for build-time CVT locations */
568 /* (assigned in `cvt') */
570 /* note that each style has its own set of CVT data, */
571 /* to be accessed using the offsets in the `cvt_offsets' array */
572 /* first style index is 0 */
574 /* the following macros access the variables `font' and `sfnt' */
575 #define CVT_DATA ((glyf_Data*)(font->tables[sfnt->glyf_idx].data))
578 * we have the following layout in the CVT table:
580 * . values initialized at runtime (`cvtl_max_runtime' elements)
581 * . scaling values for each style ID (`num_used_styles' elements) (*)
582 * . offset to the vertical stem widths array for each style ID (*+)
583 * (`num_used_styles' elements)
584 * . size of the vertical stem widths array for each style ID (*+)
585 * (`num_used_styles' elements)
587 * style ID 0:
588 * . horizontal standard width (1 element)
589 * . horizontal stem widths (`cvt_horz_width_sizes[id_to_idx(0)]'
590 * elements)
591 * . vertical standard width (1 element)
592 * . vertical stem widths (`cvt_vert_width_sizes[id_to_idx(0)]'
593 * elements)
594 * . flat blue zones (`cvt_blue_zone_sizes[id_to_idx(0)]' elements)
595 * . round blue zones (`cvt_blue_zone_sizes[id_to_idx(0)]' elements)
596 * style ID 1:
597 * ...
599 * (*) see function `bci_create_segments' how these three arrays get
600 * accessed
602 * (+) the values are stored as multiples of 64 to avoid rounding issues
603 * with non-square pixels (CVT values might be scaled forth and back by
604 * the bytecode interpreter while storing and reading if the aspect
605 * ratio between the horizontal and vertical resolution isn't equal
606 * to 1)
608 * note that the `id_to_idx' function is hypothetical since the code works
609 * exactly the opposite way: the `cvt_*' arrays are indexed by the style
610 * index, and the `style_ids' array maps style indices to style IDs
613 /* scaling value index of style ID id */
614 #define CVT_SCALING_VALUE_OFFSET(id) \
615 (cvtl_max_runtime + (id))
617 /* vwidth offset data of style ID id */
618 #define CVT_VWIDTH_OFFSET_DATA(id) \
619 (CVT_SCALING_VALUE_OFFSET(id) \
620 + CVT_DATA->num_used_styles)
622 /* vwidth size data of style ID id */
623 #define CVT_VWIDTH_SIZE_DATA(id) \
624 (CVT_VWIDTH_OFFSET_DATA(id) \
625 + CVT_DATA->num_used_styles)
627 /* horizontal standard width indices of style i */
628 #define CVT_HORZ_STANDARD_WIDTH_OFFSET(i) \
629 (cvtl_max_runtime \
630 + 3 * CVT_DATA->num_used_styles \
631 + CVT_DATA->cvt_offsets[i])
632 /* start and size of horizontal stem widths array of style i */
633 #define CVT_HORZ_WIDTHS_OFFSET(i) \
634 (CVT_HORZ_STANDARD_WIDTH_OFFSET(i) + 1)
635 #define CVT_HORZ_WIDTHS_SIZE(i) \
636 (CVT_DATA->cvt_horz_width_sizes[i])
638 /* vertical standard width indices of style i */
639 #define CVT_VERT_STANDARD_WIDTH_OFFSET(i) \
640 (CVT_HORZ_WIDTHS_OFFSET(i) + CVT_HORZ_WIDTHS_SIZE(i))
641 /* start and size of vertical stem widths array of style i */
642 #define CVT_VERT_WIDTHS_OFFSET(i) \
643 (CVT_VERT_STANDARD_WIDTH_OFFSET(i) + 1)
644 #define CVT_VERT_WIDTHS_SIZE(i) \
645 (CVT_DATA->cvt_vert_width_sizes[i])
647 /* number of blue zones (including artificial ones) of style i */
648 #define CVT_BLUES_SIZE(i) \
649 (CVT_DATA->cvt_blue_zone_sizes[i])
651 /* start of blue zone arrays for flat and round edges of style i */
652 #define CVT_BLUE_REFS_OFFSET(i) \
653 (CVT_VERT_WIDTHS_OFFSET(i) + CVT_VERT_WIDTHS_SIZE(i))
654 #define CVT_BLUE_SHOOTS_OFFSET(i) \
655 (CVT_BLUE_REFS_OFFSET(i) + CVT_BLUES_SIZE(i))
657 /* x height blue zone (shoot) index of style i (valid if < 0xFFFF) */
658 #define CVT_X_HEIGHT_BLUE_OFFSET(i) \
659 (CVT_BLUE_SHOOTS_OFFSET(i) \
660 + CVT_DATA->cvt_blue_adjustment_offsets[i])
663 extern FT_Byte ttfautohint_glyph_bytecode[7];
665 #endif /* TABYTECODE_H_ */
667 /* end of tabytecode.h */