Debian Codegraph @

texk/dvipdfm-x/pdffont.h

raw
1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2
3 Copyright (C) 2002-2021 by Jin-Hwan Cho and Shunsaku Hirata,
4 the dvipdfmx project team.
5
6 Copyright (C) 1998, 1999 by Mark A. Wicks <[email protected]>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22
23 #ifndef _PDFFONT_H_
24 #define _PDFFONT_H_
25
26 #include "pdfobj.h"
27 #include "fontmap.h"
28 #include "pdflimits.h"
29
30 #define PDF_FONT_FONTTYPE_TYPE1 0
31 #define PDF_FONT_FONTTYPE_TYPE1C 1
32 #define PDF_FONT_FONTTYPE_TYPE3 2
33 #define PDF_FONT_FONTTYPE_TRUETYPE 3
34
35 #define PDF_FONT_FONTTYPE_TYPE0 4
36 #define PDF_FONT_FONTTYPE_CIDTYPE0 5
37 #define PDF_FONT_FONTTYPE_CIDTYPE2 6
38
39 extern void pdf_font_set_dpi (int font_dpi);
40
41 #define PDF_FONT_FLAG_NOEMBED (1 << 0)
42 #define PDF_FONT_FLAG_COMPOSITE (1 << 1)
43 #define PDF_FONT_FLAG_BASEFONT (1 << 2)
44 #define PDF_FONT_FLAG_USEDCHAR_SHARED (1 << 3)
45 #define PDF_FONT_FLAG_IS_ALIAS (1 << 4)
46 #define PDF_FONT_FLAG_IS_REENCODE (1 << 5)
47 #define PDF_FONT_FLAG_ACCFONT (1 << 6)
48 #define PDF_FONT_FLAG_UCSFONT (1 << 7)
49
50 /* FIXME */
51 /* Converted from Type 1 */
52 #define CIDFONT_FLAG_TYPE1 (1 << 8)
53 #define CIDFONT_FLAG_TYPE1C (1 << 9)
54 #define CIDFONT_FLAG_TRUETYPE (1 << 10)
55
56 #define PDF_FONT_PARAM_DESIGN_SIZE 1
57 #define PDF_FONT_PARAM_POINT_SIZE 2
58
59 #include "fontmap.h"
60 #define FONT_STYLE_NONE FONTMAP_STYLE_NONE
61 #define FONT_STYLE_BOLD FONTMAP_STYLE_BOLD
62 #define FONT_STYLE_ITALIC FONTMAP_STYLE_ITALIC
63 #define FONT_STYLE_BOLDITALIC FONTMAP_STYLE_BOLDITALIC
64
65 typedef struct {
66 char *registry;
67 char *ordering;
68 int supplement;
69 } CIDSysInfo;
70
71 typedef struct
72 {
73 CIDSysInfo csi;
74 int style;
75 int embed;
76 int stemv;
77 } cid_opt;
78
79 struct pdf_font
80 {
81 char *ident; /* map name */
82 int font_id; /* ID of this font */
83 int subtype;
84
85 char *filename;
86
87 int encoding_id; /* encoding or CMap */
88
89 uint32_t index;
90 char *fontname;
91 char uniqueID[7];
92
93 /*
94 * PDF font resource objects
95 */
96 pdf_obj *reference;
97 pdf_obj *resource;
98 pdf_obj *descriptor;
99
100 /*
101 * Font format specific data
102 */
103 char *usedchars;
104 int flags;
105
106 /* PK font */
107 double point_size;
108 double design_size;
109
110 /* Type0 font */
111 struct {
112 int descendant; /* Only single descendant is allowed. */
113 int wmode;
114 } type0;
115
116 /* CIDFont */
117 struct {
118 CIDSysInfo csi; /* Character collection */
119 cid_opt options; /* Options from map record */
120 int need_vmetrics;
121 char *usedchars_v;
122 } cid;
123 };
124
125 typedef struct pdf_font pdf_font;
126
127 /* pdf_open_document() call them. */
128 extern void pdf_init_fonts (void);
129 extern void pdf_close_fonts (void);
130
131 /* tex_name is used when mrec is NULL.
132 * font_scale (point size) used by PK font.
133 * It might be necessary if dvipdfmx supports font format with
134 * various optical sizes supported in the future.
135 */
136 extern int pdf_font_findresource (const char *tex_name, double font_scale);
137 extern int pdf_font_load_font (const char *tex_name, double font_scale, const fontmap_rec *mrec);
138
139 extern pdf_font *pdf_get_font_data (int font_id);
140
141 extern char *pdf_get_font_ident (int font_id);
142 extern int pdf_get_font_subtype (int font_id);
143 extern pdf_obj *pdf_get_font_reference (int font_id);
144 extern pdf_obj *pdf_get_font_resource (int font_id);
145 extern char *pdf_get_font_usedchars (int font_id);
146
147 extern int pdf_get_font_encoding (int font_id);
148 extern int pdf_get_font_wmode (int font_id);
149
150 extern int pdf_font_resource_name (int font_id, char *buf);
151
152
153 extern char *pdf_font_get_uniqueTag (pdf_font *font);
154
155 extern pdf_obj *pdf_font_get_resource (pdf_font *font);
156 extern pdf_obj *pdf_font_get_descriptor (pdf_font *font);
157
158 extern void pdf_font_make_uniqueTag (char *tag);
159
160 #define add_to_used_chars2(b,c) {(b)[(c)/8] |= (1 << (7-((c)%8)));}
161 #define is_used_char2(b,c) (((b)[(c)/8]) & (1 << (7-((c)%8))))
162
163 extern int pdf_check_tfm_widths (const char *ident, double *widths, int firstchar, int lastchar, const char *usedchars);
164
165 #endif /* _PDFFONT_H_ */