1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2 
3     Copyright (C) 2002-2015 by Jin-Hwan Cho and Shunsaku Hirata,
4     the dvipdfmx project team.
5 
6     Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
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 _FONTMAP_H_
24 #define _FONTMAP_H_
25 
26 #define FONTMAP_RMODE_REPLACE  0
27 #define FONTMAP_RMODE_APPEND  '+'
28 #define FONTMAP_RMODE_REMOVE  '-'
29 
30 #define FONTMAP_OPT_NOEMBED (1 << 1)
31 #define FONTMAP_OPT_VERT    (1 << 2)
32 
33 #define FONTMAP_STYLE_NONE       0
34 #define FONTMAP_STYLE_BOLD       1
35 #define FONTMAP_STYLE_ITALIC     2
36 #define FONTMAP_STYLE_BOLDITALIC 3
37 
38 /* Options */
39 typedef struct fontmap_opt {
40   /* Synthetic font */
41   double slant, extend, bold;
42   /* comaptibility and other flags */
43   long   mapc,  flags;
44 
45   char  *otl_tags;    /* currently unused */
46   char  *tounicode;   /* not implemented yet */
47 
48   void  *cff_charsets;
49 
50   double design_size; /* unused */
51 
52   char  *charcoll;    /* Adobe-Japan1-4, etc. */
53   int    index;       /* TTC index */
54   int    style;       /* ,Bold, etc. */
55   int    stemv;       /* StemV value especially for CJK fonts */
56 } fontmap_opt;
57 
58 typedef struct fontmap_rec {
59   char  *map_name;
60 
61   char  *font_name;
62   char  *enc_name;
63 
64   /* Subfont mapping: translate 8-bit charcode to 16-bit charcode
65    * via SFD.
66    */
67   struct {
68     char  *sfd_name;
69     char  *subfont_id;
70   } charmap;
71 
72   fontmap_opt opt;
73 } fontmap_rec;
74 
75 extern void         pdf_fontmap_set_verbose   (void);
76 
77 extern void         pdf_init_fontmaps         (void);
78 #if 0
79 extern void         pdf_clear_fontmaps        (void);
80 #endif
81 extern void         pdf_close_fontmaps        (void);
82 
83 extern void         pdf_init_fontmap_record   (fontmap_rec *mrec);
84 extern void         pdf_clear_fontmap_record  (fontmap_rec *mrec);
85 
86 extern int          pdf_load_fontmap_file     (const char  *filename, int mode);
87 extern int          pdf_read_fontmap_line     (fontmap_rec *mrec, const char *mline, long mline_strlen, int format);
88 
89 extern int          pdf_append_fontmap_record (const char  *kp, const fontmap_rec *mrec);
90 extern int          pdf_remove_fontmap_record (const char  *kp);
91 extern fontmap_rec *pdf_insert_fontmap_record (const char  *kp, const fontmap_rec *mrec);
92 extern fontmap_rec *pdf_lookup_fontmap_record (const char  *kp);
93 
94 extern int          is_pdfm_mapline           (const char  *mline);
95 
96 extern fontmap_rec *pdf_insert_native_fontmap_record (const char *filename, uint32_t index,
97                                                       int layout_dir, int extend, int slant, int embolden);
98 
99 #endif /* _FONTMAP_H_ */
100