src/texfonts.h
/* [<][>][^][v][top][bottom][index][help] */
FUNCTIONS
This source file includes following functions.
- READ_INT1
- READ_UINT1
- READ_INT2
- READ_UINT2
- READ_INT3
- READ_UINT3
- READ_INT4
- READ_UINT4
- READ_INTN
- READ_UINTN
- SKIP_N
- GET_INT1
- GET_UINT1
- GET_INT2
- GET_UINT2
- GET_INT3
- GET_UINT3
- GET_INT4
- GET_UINT4
- GET_INTN
- GET_UINTN
1 /*
2 * texfonts.h - a header file for texfonts.c
3 * by Hirotsugu Kakugawa
4 *
5 * 5 Mar 1997 VFlib 3.1.4
6 * 1 Apr 1997 VFlib 3.2 Long capability names
7 */
8 /*
9 * Copyright (C) 1996-1998 Hirotsugu Kakugawa.
10 * All rights reserved.
11 *
12 * This file is part of the VFlib Library. This library is free
13 * software; you can redistribute it and/or modify it under the terms of
14 * the GNU Library General Public License as published by the Free
15 * Software Foundation; either version 2 of the License, or (at your
16 * option) any later version. This library is distributed in the hope
17 * that it will be useful, but WITHOUT ANY WARRANTY; without even the
18 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 * PURPOSE. See the GNU Library General Public License for more details.
20 * You should have received a copy of the GNU Library General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 */
24
25 #ifndef __VFLIB_TEXFONTS_H__
26 #define __VFLIB_TEXFONTS_H__
27
28 #define FONTCLASS_NAME_GF "gf"
29 #define FONTCLASS_NAME_PK "pk"
30 #define FONTCLASS_NAME_TFM "tfm"
31 #define FONTCLASS_NAME_VF "vf"
32 #define FONTCLASS_NAME_TeX "TeX"
33
34 #define DEFAULT_EXTENSIONS_GF "gf" /* e.g., "gf, GF" */
35 #define DEFAULT_EXTENSIONS_PK "pk" /* e.g., "pk, PK" */
36 #define DEFAULT_EXTENSIONS_TFM "tfm" /* e.g., "tfm, TFM" */
37 #define DEFAULT_EXTENSIONS_VF "vf" /* e.g., "vf, VF" */
38
39 #define TEX_FILE_FORMAT_TYPE_TFM 0
40 #define TEX_FILE_FORMAT_TYPE_GF 1
41 #define TEX_FILE_FORMAT_TYPE_PK 2
42 #define TEX_FILE_FORMAT_TYPE_VF 3
43
44 #define VF_CAPE_TEX_TFM_DIRECTORIES "tfm-directories"
45 #define VF_CAPE_TEX_TFM_EXTENSIONS "tfm-filename-extensions"
46 #define VF_CAPE_MAKE_MISSING_GLYPH "make-missing-glyph"
47 #define VF_CAPE_RESOLUTION_CORR "resolution-corrections"
48 #define VF_CAPE_RESOLUTION_ACCU "resolution-accuracy"
49
50 #define VF_CAPE_TEX_FONT_MAPPING "font-mapping"
51 #define TEX_FONT_MAPPING_PTSIZE "point-size-from-tfm"
52 #define TEX_FONT_MAPPING_MAG_ADJ "magnification-adjustment"
53
54 #define VF_CAPE_TEX_GLYPH_STYLE "glyph-style" /* for vf, tfm */
55 #define TEX_GLYPH_STYLE_DEFAULT 1
56 #define TEX_GLYPH_STYLE_EMPTY_STR "empty"
57 #define TEX_GLYPH_STYLE_EMPTY 0
58 #define TEX_GLYPH_STYLE_FILL_STR "fill"
59 #define TEX_GLYPH_STYLE_FILL 1
60
61 #define VF_CAPE_TEX_OPEN_STYLE "open-style" /* for vf */
62 #define TEX_OPEN_STYLE_DEFAULT 0
63 #define TEX_OPEN_STYLE_REQUIRE_STR "require"
64 #define TEX_OPEN_STYLE_REQUIRE 0
65 #define TEX_OPEN_STYLE_TRY_STR "try"
66 #define TEX_OPEN_STYLE_TRY 1
67 #define TEX_OPEN_STYLE_NONE_STR "none"
68 #define TEX_OPEN_STYLE_NONE 2
69
70 #define DEFAULT_DPI 300
71 #define DEFAULT_RESOLUTION_ACCU 0.03
72
73 #define VFLIB_ENV_ASCII_JTEX_DIR "VFLIB_ASCII_JTEX_DIRECTORY"
74
75 #if 0
76 #define TEX_ENV_FONT_DIR "VFLIB_TEX_FONTS"
77 #define GF_ENV_FONT_DIR "VFLIB_GF_FONTS"
78 #define PK_ENV_FONT_DIR "VFLIB_PK_FONTS"
79 #define VF_ENV_FONT_DIR "VFLIB_VF_FONTS"
80 #define TFM_ENV_FONT_DIR "VFLIB_TFM_FONTS"
81 #endif
82
83
84 Glocal int vf_dbg_drv_texfonts;
85 Glocal SEXP_ALIST vf_tex_default_properties;
86 Glocal SEXP_ALIST vf_tex_default_variables;
87
88
89
90 /* IMPORTANT ASSUMPTION:
91 * char: at least 8 bits
92 * int: at least 16 bits
93 * long: at least 32 bits
94 */
95 typedef char INT1;
96 typedef unsigned char UINT1;
97 typedef int INT2;
98 typedef unsigned int UINT2;
99 typedef long INT3;
100 typedef unsigned long UINT3;
101 typedef long INT4;
102 typedef unsigned long UINT4;
103
104 /*
105 * TFM structure
106 */
107
108 #define METRIC_TYPE_TFM 0 /* Traditional TFM by Prof. Knuth */
109 #define METRIC_TYPE_OFM 1 /* Omega Font Metric */
110 #define METRIC_TYPE_JFM 2 /* Japanese Font Metric by ASCII Co. */
111 #define METRIC_TYPE_JFM_AUX_H 0 /* Horizontal */
112 #define METRIC_TYPE_JFM_AUX_V 1 /* Vertical */
113
114 typedef struct s_tfm *TFM;
115 struct s_tfm {
116 /* Font Info */
117 int type; /* METRIC_TYPE_xxx */
118 int type_aux; /* METRIC_TYPE_AUX_xxx */
119 UINT4 cs;
120 /* Metrics */
121 UINT4 ds;
122 double design_size;
123 double slant;
124 unsigned int begin_char, end_char;
125 INT4 *width, *height, *depth;
126 unsigned int *ct_kcode, *ct_ctype; /* JFM only */
127 int nt; /* JFM only */
128 /* Font bounding box */
129 double font_bbx_w, font_bbx_h;
130 double font_bbx_xoff, font_bbx_yoff;
131 };
132
133
134
135 #define READ_INT1(fp) (INT1)vf_tex_read_intn((fp), 1)
136 #define READ_UINT1(fp) (UINT1)vf_tex_read_uintn((fp), 1)
137 #define READ_INT2(fp) (INT2)vf_tex_read_intn((fp), 2)
138 #define READ_UINT2(fp) (UINT2)vf_tex_read_uintn((fp), 2)
139 #define READ_INT3(fp) (INT3)vf_tex_read_intn((fp), 3)
140 #define READ_UINT3(fp) (UINT3)vf_tex_read_uintn((fp), 3)
141 #define READ_INT4(fp) (INT4)vf_tex_read_intn((fp), 4)
142 #define READ_UINT4(fp) (UINT4)vf_tex_read_uintn((fp), 4)
143 #define READ_INTN(fp,n) (INT4)vf_tex_read_intn((fp), (n))
144 #define READ_UINTN(fp,n) (UINT4)vf_tex_read_uintn((fp), (n))
145 #define SKIP_N(fp,k) vf_tex_skip_n((fp), (k))
146
147 Glocal long vf_tex_read_intn(FILE*,int);
148 Glocal unsigned long vf_tex_read_uintn(FILE*,int);
149 Glocal void vf_tex_skip_n(FILE*,int);
150
151
152 #define GET_INT1(p) (INT1)vf_tex_get_intn((p), 1)
153 #define GET_UINT1(p) (UINT1)vf_tex_get_uintn((p), 1)
154 #define GET_INT2(p) (INT2)vf_tex_get_intn((p), 2)
155 #define GET_UINT2(p) (UINT2)vf_tex_get_uintn((p), 2)
156 #define GET_INT3(p) (INT3)vf_tex_get_intn((p), 3)
157 #define GET_UINT3(p) (UINT3)vf_tex_get_uintn((p), 3)
158 #define GET_INT4(p) (INT4)vf_tex_get_intn((p), 4)
159 #define GET_UINT4(p) (UINT4)vf_tex_get_uintn((p), 4)
160 #define GET_INTN(p,n) (INT4)vf_tex_get_intn((p), (n))
161 #define GET_UINTN(p,n) (UINT4)vf_tex_get_uintn((p), (n))
162
163 Glocal long vf_tex_get_intn(unsigned char*,int);
164 Glocal unsigned long vf_tex_get_uintn(unsigned char*,int);
165
166
167
168 Glocal int vf_tex_init(void);
169 Glocal int vf_tex_default_dpi(void);
170 Glocal int vf_tex_fix_resolution(int dev_dpi, double mag);
171 Glocal int vf_tex_parse_open_style(char *s, int def_value);
172 Glocal int vf_tex_parse_glyph_style(char *s, int def_value);
173 Glocal void vf_texfont_parse_font_name(char*,char*,double,double,
174 char*,int,int*,int*,double*);
175
176 Glocal int vf_tex_syntax_check_font_mapping(SEXP);
177 Glocal int vf_tex_try_map_and_open_font(VF_FONT font, char *font_name,
178 SEXP font_mapping,
179 double tfm_design_size,
180 SEXP tfm_dirs, SEXP tfm_extensions,
181 double opt_mag);
182
183 Glocal char* vf_tex_search_file_tfm(char *filename, SEXP dirs, SEXP exts);
184 Glocal char* vf_tex_search_file_glyph(char *filename, int implicit, int format,
185 SEXP dirs, int dpi, double mag,
186 SEXP exts);
187 Glocal char* vf_tex_search_file_misc(char *filename, int implicit, int format,
188 SEXP dirs, SEXP exts);
189
190 #endif /*__VFLIB_TEXFONTS_H__*/
191
192
193 /*EOF*/