Debian Codegraph @

texk/web2c/luatexdir/font/mapfile.h

raw
1 /* mapfile.h
2
3 Copyright 2009 Taco Hoekwater <[email protected]>
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 #ifndef MAPFILE_H
22 # define MAPFILE_H
23
24 # define F_INCLUDED (1 << 0)
25 # define F_SUBSETTED (1 << 1)
26 # define F_STDT1FONT (1 << 2)
27 /* we don't support sub fonts */
28 # define F_TYPE1 (1 << 4)
29 # define F_TRUETYPE (1 << 5)
30 # define F_OTF (1 << 6)
31 # define F_CIDKEYED (1 << 7)
32 # define F_SLANTSET (1 << 8)
33 # define F_EXTENDSET (1 << 9)
34 # define F_INUSE (1 << 10)
35
36 typedef enum { MAPFILE, MAPLINE } maptype;
37
38 # define set_included(fm) ((fm)->type = (unsigned short)((fm)->type | F_INCLUDED))
39 # define set_subsetted(fm) ((fm)->type = (unsigned short)((fm)->type | F_SUBSETTED))
40 # define set_std_t1font(fm) ((fm)->type = (unsigned short)((fm)->type | F_STDT1FONT))
41 # define set_type1(fm) ((fm)->type = (unsigned short)((fm)->type | F_TYPE1))
42 # define set_truetype(fm) ((fm)->type = (unsigned short)((fm)->type | F_TRUETYPE))
43 # define set_opentype(fm) ((fm)->type = (unsigned short)((fm)->type | F_OTF))
44 # define set_cidkeyed(fm) ((fm)->type = (unsigned short)((fm)->type | F_CIDKEYED))
45 # define set_slantset(fm) ((fm)->type = (unsigned short)((fm)->type | F_SLANTSET))
46 # define set_extendset(fm) ((fm)->type = (unsigned short)((fm)->type | F_EXTENDSET))
47 # define set_inuse(fm) ((fm)->type = (unsigned short)((fm)->type | F_INUSE))
48
49 # define unset_included(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_INCLUDED))
50 # define unset_subsetted(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_SUBSETTED))
51 # define unset_std_t1font(fm)((fm)->type = (unsigned short)((fm)->type & ~F_STDT1FONT))
52 # define unset_type1(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_TYPE1))
53 # define unset_truetype(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_TRUETYPE))
54 # define unset_opentype(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_OTF))
55 # define unset_cidkeyed(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_CIDKEYED))
56 # define unset_slantset(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_SLANTSET))
57 # define unset_extendset(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_EXTENDSET))
58 # define unset_inuse(fm) ((fm)->type = (unsigned short)((fm)->type & ~F_INUSE))
59
60 # define is_included(fm) (((fm)->type & F_INCLUDED) != 0)
61 # define is_subsetted(fm) (((fm)->type & F_SUBSETTED) != 0)
62 # define is_std_t1font(fm) (((fm)->type & F_STDT1FONT) != 0)
63 # define is_type1(fm) (((fm)->type & F_TYPE1) != 0)
64 # define is_truetype(fm) (((fm)->type & F_TRUETYPE) != 0)
65 # define is_opentype(fm) (((fm)->type & F_OTF) != 0)
66 # define is_cidkeyed(fm) (((fm)->type & F_CIDKEYED) != 0)
67 # define is_slantset(fm) (((fm)->type & F_SLANTSET) != 0)
68 # define is_extendset(fm) (((fm)->type & F_EXTENDSET) != 0)
69 # define is_inuse(fm) (((fm)->type & F_INUSE) != 0)
70
71 # define fm_slant(fm) (fm)->slant
72 # define fm_extend(fm) (fm)->extend
73 # define fm_fontfile(fm) (fm)->ff_name
74
75 # define is_reencoded(fm) ((fm)->encname != NULL)
76 # define is_fontfile(fm) (fm_fontfile(fm) != NULL)
77 # define is_t1fontfile(fm) (is_fontfile(fm) && is_type1(fm))
78 # define is_builtin(fm) (!is_fontfile(fm))
79
80 /**********************************************************************/
81
82 typedef struct {
83 /* parameters scanned from the map file: */
84 char *tfm_name; /* TFM file name (1st field in map line) */
85 char *ps_name; /* PostScript name (optional 2nd field in map line) */
86 int fd_flags; /* font descriptor /Flags (PDF Ref. section 5.7.1) */
87 int slant; /* SlantFont */
88 int extend; /* ExtendFont */
89 char *encname; /* encoding file name */
90 int subfont; /* specific index in a ttc file */
91 char *ff_name; /* font file name */
92 unsigned short type; /* various flags */
93 } fm_entry;
94
95 typedef struct {
96 char *ff_name; /* base name of font file */
97 char *ff_path; /* full path to font file */
98 } ff_entry;
99
100 /**********************************************************************/
101
102 fm_entry *getfontmap(char *tfm_name);
103 void fm_free(void);
104 ff_entry *check_ff_exist(char *, boolean);
105 void pdfmapfile(int);
106 void pdfmapline(int);
107 void pdf_init_map_file(const char *map_name);
108 fm_entry *new_fm_entry(void);
109 void delete_fm_entry(fm_entry *);
110 int avl_do_entry(fm_entry *, int);
111 int check_std_t1font(char *s);
112 int is_subsetable(fm_entry * fm);
113 void process_map_item(char *s, int type);
114
115 #endif /* MAPFILE_H */