1 /* texfont.h Main font API implementation for the pascal parts
2 
3    Copyright 2006-2010 Taco Hoekwater <taco@luatex.org>
4 
5    This file is part of LuaTeX.
6 
7    LuaTeX is free software; you can redistribute it and/or modify it under
8    the terms of the GNU General Public License as published by the Free
9    Software Foundation; either version 2 of the License, or (at your
10    option) any later version.
11 
12    LuaTeX is distributed in the hope that it will be useful, but WITHOUT
13    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15    License for more details.
16 
17    You should have received a copy of the GNU General Public License along
18    with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
19 
20 
21 /* Here we have the interface to LuaTeX's font system, as seen from the
22    main pascal program. There is a companion list in luatex.defines to
23    keep web2c happy */
24 
25 /* this file is read at the end of ptexlib.h, which is called for at
26    the end of luatexcoerce.h, as well as from the C sources
27 */
28 
29 #ifndef TEXFONT_H
30 #  define TEXFONT_H
31 
32 #  define pointer halfword
33 
34 /* these are dumped en block, so they need endianness tests */
35 typedef struct liginfo {
36 #  ifdef WORDS_BIGENDIAN
37     int adj;
38     int lig;
39     int type;
40 #  else
41     int type;
42     int lig;
43     int adj;
44 #  endif
45 } liginfo;
46 
47 /* these are dumped en block, so they need endianness tests */
48 typedef struct kerninfo {
49 #  ifdef WORDS_BIGENDIAN
50     int adj;
51     scaled sc;
52 #  else
53     scaled sc;
54     int adj;
55 #  endif
56 } kerninfo;
57 
58 typedef struct extinfo {
59     struct extinfo *next;
60     int glyph;
61     int start_overlap;
62     int end_overlap;
63     int advance;
64     int extender;
65 } extinfo;
66 /* todo: maybe create a 'math info structure' */
67 typedef struct charinfo {
68     char *name;                 /* postscript character name */
69     liginfo *ligatures;         /* ligature items */
70     kerninfo *kerns;            /* kern items */
71     eight_bits *packets;        /* virtual commands.  */
72     unsigned short index;       /* CID index */
73     int remainder;              /* spare value for odd items, could be union-ed with extensible */
74     scaled width;               /* width */
75     scaled height;              /* height */
76     scaled depth;               /* depth */
77     scaled italic;              /* italic correction */
78     scaled top_accent;          /* top accent alignment */
79     scaled bot_accent;          /* bot accent alignment */
80     int ef;                     /* font expansion factor */
81     int lp;                     /* left protruding factor */
82     int rp;                     /* right protruding factor */
83     char tag;                   /* list / ext taginfo */
84     char used;                  /* char is typeset ? */
85     char *tounicode;            /* unicode equivalent */
86     extinfo *hor_variants;      /* horizontal variants */
87     extinfo *vert_variants;     /* vertical variants */
88     int top_left_math_kerns;
89     int top_right_math_kerns;
90     int bottom_right_math_kerns;
91     int bottom_left_math_kerns;
92     scaled *top_left_math_kern_array;
93     scaled *top_right_math_kern_array;
94     scaled *bottom_right_math_kern_array;
95     scaled *bottom_left_math_kern_array;
96 } charinfo;
97 
98 #  define EXT_NORMAL 0
99 #  define EXT_REPEAT 1
100 
101 extern extinfo *get_charinfo_vert_variants(charinfo * ci);
102 extern extinfo *get_charinfo_hor_variants(charinfo * ci);
103 extern void set_charinfo_hor_variants(charinfo * ci, extinfo * ext);
104 extern void set_charinfo_vert_variants(charinfo * ci, extinfo * ext);
105 extern void add_charinfo_vert_variant(charinfo * ci, extinfo * ext);
106 extern void add_charinfo_hor_variant(charinfo * ci, extinfo * ext);
107 
108 extern extinfo *copy_variants(extinfo * o);
109 
110 extern extinfo *new_variant(int glyph, int startconnect, int endconnect,
111                             int advance, int repeater);
112 
113 extern scaled_whd get_charinfo_whd(internal_font_number f, int c);
114 
115 
116 
117 typedef struct texfont {
118     int _font_size;
119     int _font_dsize;
120     int _font_units_per_em;
121     char *_font_name;
122     char *_font_area;
123     char *_font_filename;
124     char *_font_fullname;
125     char *_font_psname;
126     char *_font_encodingname;
127     char *_font_cidregistry;
128     char *_font_cidordering;
129     int _font_cidversion;
130     int _font_cidsupplement;
131 
132     int _font_ec;
133     unsigned _font_checksum;    /* internal information */
134     char _font_used;            /* internal information */
135     char _font_touched;         /* internal information */
136     int _font_cache_id;         /* internal information */
137     char _font_encodingbytes;   /* 1 or 2 bytes */
138 
139     int _font_slant;            /* a slant in ppt */
140     int _font_extend;           /* an extension in ppt, or 1000 */
141     int font_max_shrink;
142     int font_max_stretch;
143     int _font_step;             /* amount of one step of expansion */
144     boolean _font_auto_expand;  /* this font is auto-expanded? */
145 
146     char _font_tounicode;       /* 1 if info is present */
147     fm_entry *_font_map;
148     int _font_type;
149     int _font_format;
150     int _font_embedding;
151     int _font_bc;
152     int _hyphen_char;
153     int _skew_char;
154     int _font_natural_dir;
155 
156     charinfo *_left_boundary;
157     charinfo *_right_boundary;
158 
159     int _font_params;
160     scaled *_param_base;
161 
162     int _font_math_params;
163     scaled *_math_param_base;
164 
165     sa_tree characters;
166     int charinfo_count;
167     int charinfo_size;
168     charinfo *charinfo;
169     int *charinfo_cache;
170     int ligatures_disabled;
171 
172     int _pdf_font_num;          /* maps to a PDF resource ID */
173     str_number _pdf_font_attr;  /* pointer to additional attributes */
174 } texfont;
175 
176 typedef enum {
177     unknown_font_type = 0,      /* new font (has not been used yet) */
178     virtual_font_type,          /* virtual font */
179     real_font_type,             /* real font */
180 } font_types;
181 
182 typedef enum {
183     unknown_format = 0,
184     type1_format,
185     type3_format,
186     truetype_format,
187     opentype_format,
188 } font_formats;
189 
190 typedef enum {
191     unknown_embedding = 0,
192     no_embedding,
193     subset_embedding,
194     full_embedding,
195 } font_embedding_option;
196 
197 extern const char *font_type_strings[];
198 extern const char *font_format_strings[];
199 extern const char *font_embedding_strings[];
200 
201 
202 #  define font_checksum(a)          font_tables[a]->_font_checksum
203 #  define set_font_checksum(a,b)    font_checksum(a) = b
204 
205 #  define font_check_0(a)           ((font_tables[a]->_font_checksum&0xFF000000)>>24)
206 #  define font_check_1(a)           ((font_tables[a]->_font_checksum&0x00FF0000)>>16)
207 #  define font_check_2(a)           ((font_tables[a]->_font_checksum&0x0000FF00)>>8)
208 #  define font_check_3(a)            (font_tables[a]->_font_checksum&0x000000FF)
209 
210 #  define font_size(a)              font_tables[a]->_font_size
211 #  define set_font_size(a,b)        font_size(a) = b
212 #  define font_dsize(a)             font_tables[a]->_font_dsize
213 #  define set_font_dsize(a,b)       font_dsize(a) = b
214 
215 #  define font_units_per_em(a)             font_tables[a]->_font_units_per_em
216 #  define set_font_units_per_em(a,b)       font_units_per_em(a) = b
217 
218 #  define font_name(a)              font_tables[a]->_font_name
219 #  define get_font_name(a)          (unsigned char *)font_name(a)
220 #  define set_font_name(f,b)        font_name(f) = b
221 #  define tex_font_name(a)          maketexstring(font_name(a))
222 
223 #  define font_area(a)              font_tables[a]->_font_area
224 #  define get_font_area(a)          (unsigned char *)font_area(a)
225 #  define set_font_area(f,b)        font_area(f) = b
226 #  define tex_font_area(a)          maketexstring(font_area(a))
227 
228 boolean cmp_font_area(int, str_number);
229 
230 #  define font_reassign(a,b)            { if (a!=NULL) free(a); a = b; }
231 
232 #  define font_filename(a)            font_tables[a]->_font_filename
233 #  define set_font_filename(f,b)      font_reassign(font_filename(f),b)
234 
235 #  define font_fullname(a)            font_tables[a]->_font_fullname
236 #  define set_font_fullname(f,b)      font_reassign(font_fullname(f),b)
237 
238 #  define font_psname(a)              font_tables[a]->_font_psname
239 #  define set_font_psname(f,b)        font_reassign(font_psname(f),b)
240 
241 #  define font_encodingname(a)        font_tables[a]->_font_encodingname
242 #  define set_font_encodingname(f,b)  font_reassign(font_encodingname(f),b)
243 
244 #  define cmp_font_filename(a,b)      (!(font_filename(a)!=NULL || font_filename(b)!=NULL || \
245                                        strcmp(font_filename(a),font_filename(b))))
246 #  define cmp_font_fullname(a,b)      (!(font_fullname(a)!=NULL || font_fullname(b)!=NULL || \
247                                        strcmp(font_fullname(a),font_fullname(b))))
248 #  define cmp_font_encodingname(a,b)  (!(font_encoding(a)!=NULL || font_encodingname(b)!=NULL || \
249                                        strcmp(font_encodingname(a),font_encodingname(b))))
250 
251 #  define font_bc(a)                  font_tables[a]->_font_bc
252 #  define set_font_bc(f,b)            font_bc(f) = b
253 
254 #  define font_ec(a)                  font_tables[a]->_font_ec
255 #  define set_font_ec(f,b)            font_ec(f) = b
256 
257 #  define font_used(a)                (font_tables[a]!=NULL && font_tables[a]->_font_used)
258 #  define set_font_used(a,b)          font_tables[a]->_font_used = b
259 
260 #  define font_touched(a)             font_tables[a]->_font_touched
261 #  define set_font_touched(a,b)       font_touched(a) = b
262 
263 #  define font_type(a)                font_tables[a]->_font_type
264 #  define set_font_type(a,b)          {  /* fprintf(stdout,"set font type of %s to %i: %s\n",font_name(a),b,__FILE__); */   \
265                                        font_type(a) = b; }
266 
267 #  define font_format(a)              font_tables[a]->_font_format
268 #  define font_format_name(a)         font_format_strings[font_tables[a]->_font_format]
269 #  define set_font_format(a,b)        font_format(a) = b
270 
271 #  define font_embedding(a)           font_tables[a]->_font_embedding
272 #  define set_font_embedding(a,b)     font_embedding(a) = b
273 
274 #  define font_cidversion(a)          font_tables[a]->_font_cidversion
275 #  define set_font_cidversion(a,b)    font_cidversion(a) = b
276 
277 #  define font_cidsupplement(a)       font_tables[a]->_font_cidsupplement
278 #  define set_font_cidsupplement(a,b) font_cidsupplement(a) = b
279 
280 #  define font_cidordering(a)         font_tables[a]->_font_cidordering
281 #  define set_font_cidordering(f,b)   font_reassign(font_cidordering(f),b)
282 
283 #  define font_cidregistry(a)         font_tables[a]->_font_cidregistry
284 #  define set_font_cidregistry(f,b)   font_reassign(font_cidregistry(f),b)
285 
286 #  define font_map(a)                 font_tables[a]->_font_map
287 #  define set_font_map(a,b)           font_map(a) = b
288 
289 #  define font_cache_id(a)            font_tables[a]->_font_cache_id
290 #  define set_font_cache_id(a,b)      font_cache_id(a) = b
291 
292 #  define font_encodingbytes(a)       font_tables[a]->_font_encodingbytes
293 #  define set_font_encodingbytes(a,b) font_encodingbytes(a) = b
294 
295 #  define font_slant(a)               font_tables[a]->_font_slant
296 #  define set_font_slant(a,b)         font_slant(a) = b
297 
298 #  define font_extend(a)              font_tables[a]->_font_extend
299 #  define set_font_extend(a,b)        font_extend(a) = b
300 
301 #  define font_shrink(a)              font_tables[a]->_font_shrink
302 #  define set_font_shrink(a,b)        font_shrink(a) = b
303 
304 #  define font_stretch(a)             font_tables[a]->_font_stretch
305 #  define set_font_stretch(a,b)       font_stretch(a) = b
306 
307 #  define font_max_shrink(a)          font_tables[a]->font_max_shrink
308 #  define set_font_max_shrink(a,b)    font_max_shrink(a) = b
309 
310 #  define font_max_stretch(a)         font_tables[a]->font_max_stretch
311 #  define set_font_max_stretch(a,b)   font_max_stretch(a) = b
312 
313 #  define font_step(a)                font_tables[a]->_font_step
314 #  define set_font_step(a,b)          font_step(a) = b
315 
316 #  define font_auto_expand(a)         font_tables[a]->_font_auto_expand
317 #  define set_font_auto_expand(a,b)   font_auto_expand(a) = b
318 
319 #  define font_tounicode(a)           font_tables[a]->_font_tounicode
320 #  define set_font_tounicode(a,b)     font_tounicode(a) = b
321 
322 #  define hyphen_char(a)              font_tables[a]->_hyphen_char
323 #  define set_hyphen_char(a,b)        hyphen_char(a) = b
324 
325 #  define skew_char(a)                font_tables[a]->_skew_char
326 #  define set_skew_char(a,b)          skew_char(a) = b
327 
328 #  define font_natural_dir(a)         font_tables[a]->_font_natural_dir
329 #  define set_font_natural_dir(a,b)   font_natural_dir(a) = b
330 
331 #  define pdf_font_num(a)             font_tables[a]->_pdf_font_num
332 #  define set_pdf_font_num(a,b)       pdf_font_num(a) = b
333 
334 #  define pdf_font_attr(a)            font_tables[a]->_pdf_font_attr
335 #  define set_pdf_font_attr(a,b)      pdf_font_attr(a) = b
336 
337 
338 #  define left_boundarychar  -1
339 #  define right_boundarychar -2
340 #  define non_boundarychar -3
341 
342 #  define left_boundary(a)              font_tables[a]->_left_boundary
343 #  define has_left_boundary(a)          (left_boundary(a)!=NULL)
344 #  define set_left_boundary(a,b)        font_reassign(left_boundary(a),b)
345 
346 #  define right_boundary(a)             font_tables[a]->_right_boundary
347 #  define has_right_boundary(a)         (right_boundary(a)!=NULL)
348 #  define set_right_boundary(a,b)       font_reassign(right_boundary(a),b)
349 
350 #  define font_bchar(a)       (right_boundary(a)!=NULL ? right_boundarychar : non_boundarychar)
351 
352 /* font parameters */
353 
354 #  define font_params(a)       font_tables[a]->_font_params
355 #  define param_base(a)        font_tables[a]->_param_base
356 #  define font_param(a,b)      font_tables[a]->_param_base[b]
357 
358 extern void set_font_params(internal_font_number f, int b);
359 
360 #  define set_font_param(f,n,b)                                 \
361   { if (font_params(f)<n) set_font_params(f,n);                 \
362     font_param(f,n) = b; }
363 
364 
365 #  define font_math_params(a)       font_tables[a]->_font_math_params
366 #  define math_param_base(a)        font_tables[a]->_math_param_base
367 #  define font_math_param(a,b)      font_tables[a]->_math_param_base[b]
368 
369 extern void set_font_math_params(internal_font_number f, int b);
370 
371 #  define set_font_math_param(f,n,b)                                   \
372   { if (font_math_params(f)<n) set_font_math_params(f,n);              \
373     font_math_param(f,n) = b; }
374 
375 /* Font parameters are sometimes referred to as |slant(f)|, |space(f)|, etc.*/
376 
377 typedef enum {
378     slant_code = 1,
379     space_code = 2,
380     space_stretch_code = 3,
381     space_shrink_code = 4,
382     x_height_code = 5,
383     quad_code = 6,
384     extra_space_code = 7
385 } font_parameter_codes;
386 
387 #  define slant(f)         font_param(f,slant_code)
388 #  define space(f)         font_param(f,space_code)
389 #  define space_stretch(f) font_param(f,space_stretch_code)
390 #  define space_shrink(f)  font_param(f,space_shrink_code)
391 #  define x_height(f)      font_param(f,x_height_code)
392 #  ifdef quad
393 #    undef quad
394 #  endif
395 #  define quad(f)          font_param(f,quad_code)
396 #  define extra_space(f)   font_param(f,extra_space_code)
397 
398 /* now for characters  */
399 
400 typedef enum {
401     top_right_kern = 1,
402     bottom_right_kern = 2,
403     bottom_left_kern = 3,
404     top_left_kern = 4
405 } font_math_kern_codes;
406 
407 extern charinfo *get_charinfo(internal_font_number f, int c);
408 extern int char_exists(internal_font_number f, int c);
409 extern charinfo *char_info(internal_font_number f, int c);
410 
411 /* Here is a quick way to test if a glyph exists, when you are
412 already certain the font |f| exists, and that the |c| is a regular
413 glyph id, not one of the two special boundary objects.
414 */
415 #  define quick_char_exists(f,c) get_sa_item(font_tables[f]->characters,c)
416 
417 extern void set_charinfo_width(charinfo * ci, scaled val);
418 extern void set_charinfo_height(charinfo * ci, scaled val);
419 extern void set_charinfo_depth(charinfo * ci, scaled val);
420 extern void set_charinfo_italic(charinfo * ci, scaled val);
421 extern void set_charinfo_top_accent(charinfo * ci, scaled val);
422 extern void set_charinfo_bot_accent(charinfo * ci, scaled val);
423 extern void set_charinfo_tag(charinfo * ci, scaled val);
424 extern void set_charinfo_remainder(charinfo * ci, scaled val);
425 extern void set_charinfo_used(charinfo * ci, scaled val);
426 extern void set_charinfo_index(charinfo * ci, scaled val);
427 extern void set_charinfo_name(charinfo * ci, char *val);
428 extern void set_charinfo_tounicode(charinfo * ci, char *val);
429 extern void set_charinfo_ligatures(charinfo * ci, liginfo * val);
430 extern void set_charinfo_kerns(charinfo * ci, kerninfo * val);
431 extern void set_charinfo_packets(charinfo * ci, eight_bits * val);
432 extern void set_charinfo_extensible(charinfo * ci, int a, int b, int c, int d);
433 extern void set_charinfo_ef(charinfo * ci, scaled val);
434 extern void set_charinfo_lp(charinfo * ci, scaled val);
435 extern void set_charinfo_rp(charinfo * ci, scaled val);
436 
437 extern void add_charinfo_math_kern(charinfo * ci, int type, scaled ht,
438                                    scaled krn);
439 extern int get_charinfo_math_kerns(charinfo * ci, int id);
440 
441 #  define set_char_used(f,a,b)  do {                            \
442         if (char_exists(f,a))                                   \
443             set_charinfo_used(char_info(f,a),b);                \
444     } while (0)
445 
446 extern scaled get_charinfo_width(charinfo * ci);
447 extern scaled get_charinfo_height(charinfo * ci);
448 extern scaled get_charinfo_depth(charinfo * ci);
449 extern scaled get_charinfo_italic(charinfo * ci);
450 extern scaled get_charinfo_top_accent(charinfo * ci);
451 extern scaled get_charinfo_bot_accent(charinfo * ci);
452 extern char get_charinfo_tag(charinfo * ci);
453 extern int get_charinfo_remainder(charinfo * ci);
454 extern char get_charinfo_used(charinfo * ci);
455 extern int get_charinfo_index(charinfo * ci);
456 extern char *get_charinfo_name(charinfo * ci);
457 extern char *get_charinfo_tounicode(charinfo * ci);
458 extern liginfo *get_charinfo_ligatures(charinfo * ci);
459 extern kerninfo *get_charinfo_kerns(charinfo * ci);
460 extern eight_bits *get_charinfo_packets(charinfo * ci);
461 extern int get_charinfo_ef(charinfo * ci);
462 extern int get_charinfo_rp(charinfo * ci);
463 extern int get_charinfo_lp(charinfo * ci);
464 extern int get_charinfo_extensible(charinfo * ci, int which);
465 
466 extern int ext_top(internal_font_number f, int c);
467 extern int ext_bot(internal_font_number f, int c);
468 extern int ext_rep(internal_font_number f, int c);
469 extern int ext_mid(internal_font_number f, int c);
470 
471 #  define set_ligature_item(f,b,c,d)  { f.type = b; f.adj = c;  f.lig = d; }
472 
473 #  define set_kern_item(f,b,c)      { f.adj = b;  f.sc = c; }
474 
475 
476 /* character information */
477 
478 #  define non_char 65536        /* a code that can't match a real character */
479 #  define non_address 0         /* a spurious |bchar_label| */
480 
481 
482 /* character kerns and ligatures */
483 
484 #  define end_kern               0x7FFFFF
485                                         /* otherchar value meaning "stop" */
486 #  define ignored_kern           0x800000
487                                         /* otherchar value meaning "disabled" */
488 
489 #  define charinfo_kern(b,c)        b->kerns[c]
490 
491 #  define kern_char(b)          (b).adj
492 #  define kern_kern(b)          (b).sc
493 #  define kern_end(b)          ((b).adj == end_kern)
494 #  define kern_disabled(b)     ((b).adj > end_kern)
495 
496 /* character ligatures */
497 
498 #  define end_ligature          0x7FFFFF        /* otherchar value meaning "stop" */
499 #  define ignored_ligature      0x800000        /* otherchar value meaning "disabled" */
500 
501 #  define charinfo_ligature(b,c)     b->ligatures[c]
502 
503 #  define is_valid_ligature(a)   ((a).type!=0)
504 #  define lig_type(a)            ((a).type>>1)
505 #  define lig_char(a)            (a).adj
506 #  define lig_replacement(a)     (a).lig
507 #  define lig_end(a)             (lig_char(a) == end_ligature)
508 #  define lig_disabled(a)        (lig_char(a) > end_ligature)
509 
510 #  define no_tag 0              /* vanilla character */
511 #  define lig_tag 1             /* character has a ligature/kerning program */
512 #  define list_tag 2            /* character has a successor in a charlist */
513 #  define ext_tag 3             /* character is extensible */
514 
515 extern scaled char_height(internal_font_number f, int c);
516 extern scaled calc_char_width(internal_font_number f, int c, int ex);
517 extern scaled char_width(internal_font_number f, int c);
518 extern scaled char_depth(internal_font_number f, int c);
519 extern scaled char_italic(internal_font_number f, int c);
520 extern scaled char_top_accent(internal_font_number f, int c);
521 extern scaled char_bot_accent(internal_font_number f, int c);
522 
523 extern liginfo *char_ligatures(internal_font_number f, int c);
524 extern kerninfo *char_kerns(internal_font_number f, int c);
525 extern eight_bits *char_packets(internal_font_number f, int c);
526 
527 #  define has_lig(f,b)          (char_exists(f,b) &&( char_ligatures(f,b) != NULL))
528 #  define has_kern(f,b)         (char_exists(f,b) && (char_kerns(f,b) != NULL))
529 #  define has_packet(f,b)       (char_exists(f,b) && (char_packets(f,b) != NULL))
530 
531 extern int char_remainder(internal_font_number f, int c);
532 extern char char_tag(internal_font_number f, int c);
533 extern char char_used(internal_font_number f, int c);
534 extern char *char_name(internal_font_number f, int c);
535 extern int char_index(internal_font_number f, int c);
536 
537 scaled raw_get_kern(internal_font_number f, int lc, int rc);
538 scaled get_kern(internal_font_number f, int lc, int rc);
539 liginfo get_ligature(internal_font_number f, int lc, int rc);
540 
541 #  define EXT_TOP 0
542 #  define EXT_BOT 1
543 #  define EXT_MID 2
544 #  define EXT_REP 3
545 
546 extern texfont **font_tables;
547 
548 int new_font(void);
549 extern void font_malloc_charinfo(internal_font_number f, int num);
550 int copy_font(int id);
551 int scale_font(int id, int atsize);
552 int max_font_id(void);
553 void set_max_font_id(int id);
554 int new_font_id(void);
555 void create_null_font(void);
556 void delete_font(int id);
557 boolean is_valid_font(int id);
558 
559 void dump_font(int font_number);
560 void undump_font(int font_number);
561 
562 int test_no_ligatures(internal_font_number f);
563 void set_no_ligatures(internal_font_number f);
564 
565 extern int get_tag_code(internal_font_number f, int c);
566 extern int get_lp_code(internal_font_number f, int c);
567 extern int get_rp_code(internal_font_number f, int c);
568 extern int get_ef_code(internal_font_number f, int c);
569 
570 extern void set_tag_code(internal_font_number f, int c, int i);
571 extern void set_lp_code(internal_font_number f, int c, int i);
572 extern void set_rp_code(internal_font_number f, int c, int i);
573 extern void set_ef_code(internal_font_number f, int c, int i);
574 
575 int read_tfm_info(internal_font_number f, const char *nom, scaled s);
576 
577 
578 /* from dofont.c */
579 
580 extern int read_font_info(pointer u, char *cnom, scaled s, int ndir);
581 extern int find_font_id(const char *nom, scaled s);
582 
583 /* for and from vfpacket.c */
584 
585 typedef enum { packet_char_code,
586     packet_font_code,
587     packet_pop_code,
588     packet_push_code,
589     packet_special_code,
590     packet_image_code,
591     packet_right_code,
592     packet_down_code,
593     packet_rule_code,
594     packet_node_code,
595     packet_nop_code,
596     packet_end_code,
597     packet_scale_code,
598     packet_lua_code,
599 } packet_command_codes;
600 
601 extern scaled store_scaled_f(scaled sq, int fw);
602 
603 extern void do_vf_packet(PDF pdf, internal_font_number vf_f, int c, int ex);
604 extern int vf_packet_bytes(charinfo * co);
605 
606 extern charinfo *copy_charinfo(charinfo * ci);
607 
608 /* this function is in vfovf.c for the moment */
609 extern int make_vf_table(lua_State * L, const char *name, scaled s);
610 
611 /* some bits of the old interface, used by e.g. writet3.c */
612 
613 #  define get_x_height(f) x_height(f)
614 #  define get_quad(f) quad(f)
615 #  define get_slant(f) slant(f)
616 #  define get_charwidth(f,c) (char_exists(f,c) ? char_width(f,c) : 0)
617 #  define get_charheight(f,c) (char_exists(f,c) ? char_height(f,c) : 0)
618 #  define get_chardepth(f,c) (char_exists(f,c) ? char_depth(f,c) : 0)
619 
620 #endif                          /* TEXFONT_H */
621