1 /* Copyright (C) 1990, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
3 This file is part of GNU Ghostscript.
5 GNU Ghostscript is distributed in the hope that it will be useful, but
6 WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
7 to anyone for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing. Refer
9 to the GNU General Public License for full details.
11 Everyone is granted permission to copy, modify and redistribute GNU
12 Ghostscript, but only under the conditions described in the GNU General
13 Public License. A copy of this license is supposed to have been given
14 to you along with GNU Ghostscript so you can know your rights and
15 responsibilities. It should be in a file named COPYING. Among other
16 things, the copyright notice and this notice must be preserved on all
19 Aladdin Enterprises supports the work of the GNU Project, but is not
20 affiliated with the Free Software Foundation or the GNU Project. GNU
21 Ghostscript, as distributed by Aladdin Enterprises, does not require any
22 GNU software to build or run it.
26 /* Client interface to Adobe Type 1 font routines */
28 #ifndef gstype1_INCLUDED
29 # define gstype1_INCLUDED
31 /* ------ Normal client interface ------ */
33 #define crypt_charstring_seed 4330
34 typedef struct gs_type1_state_s gs_type1_state
;
36 #ifndef gx_path_DEFINED
37 # define gx_path_DEFINED
38 typedef struct gx_path_s gx_path
;
41 #ifndef gs_show_enum_s_DEFINED
42 struct gs_show_enum_s
;
45 #ifndef gs_font_type1_DEFINED
46 # define gs_font_type1_DEFINED
47 typedef struct gs_font_type1_s gs_font_type1
;
50 #ifndef gs_type1_data_s_DEFINED
51 struct gs_type1_data_s
;
54 int gs_type1_interp_init(P7(gs_type1_state
* pcis
, gs_imager_state
* pis
,
55 gx_path
* ppath
, const gs_log2_scale_point
* pscale
,
56 bool charpath_flag
, int paint_type
,
57 gs_font_type1
* pfont
));
58 void gs_type1_set_lsb(P2(gs_type1_state
* pcis
, const gs_point
* psbpt
));
59 void gs_type1_set_width(P2(gs_type1_state
* pcis
, const gs_point
* pwpt
));
61 /* Backward compatibility */
62 #define gs_type1_init(pcis, penum, psbpt, charpath_flag, paint_type, pfont)\
63 (gs_type1_interp_init(pcis, (gs_imager_state *)((penum)->pgs),\
64 (penum)->pgs->path, &(penum)->log2_current_scale,\
65 charpath_flag, paint_type, pfont) |\
66 ((psbpt) == 0 ? 0 : (gs_type1_set_lsb(pcis, psbpt), 0)))
68 * Continue interpreting a Type 1 CharString. If str != 0, it is taken as
69 * the byte string to interpret. Return 0 on successful completion, <0 on
70 * error, or >0 when client intervention is required (or allowed). The int*
71 * argument is where the othersubr # is stored for callothersubr.
73 #define type1_result_sbw 1 /* allow intervention after [h]sbw */
74 #define type1_result_callothersubr 2
76 int gs_type1_interpret(P3(gs_type1_state
*, const gs_const_string
*, int *));
78 /* ------ CharString number representation ------ */
80 /* Define the representation of integers used by both Type 1 and Type 2. */
83 /* Values from 32 to 246 represent small integers. */
85 #define c_value_num1(ch) ((int)(byte)(ch) - 139)
87 /* The next 4 values represent 2-byte positive integers. */
92 #define c_value_pos2(c1,c2)\
93 (((int)(byte)((c1) - (int)c_pos2_0) << 8) + (int)(byte)(c2) + 108)
95 /* The next 4 values represent 2-byte negative integers. */
100 #define c_value_neg2(c1,c2)\
101 -(((int)(byte)((c1) - (int)c_neg2_0) << 8) + (int)(byte)(c2) + 108)
105 /* ------ Type 1 & Type 2 CharString representation ------ */
108 * We define both the Type 1 and Type 2 operators here, because they
113 /* Commands with identical functions in Type 1 and Type 2 */
120 c_undoc15
= 15, /* An obsolete and undocumented */
121 /* command used in some very old */
125 /* Commands with similar but not identical functions */
126 /* in Type 1 and Type 2 charstrings. */
135 cx_escape
= 12, /* extends the command set */
142 cx_num4
= 255, /* 4-byte numbers */
144 /* Commands recognized only in Type 1 charstrings. */
149 /* Commands not recognized in Type 1 charstrings. */
151 #define case_c1_undefs\
152 case 16: case 18: case 19:\
153 case 20: case 23: case 24:\
154 case 25: case 26: case 27: case 28: case 29
156 /* Commands only recognized in Type 2 charstrings. */
170 /* Commands not recognized in Type 2 charstrings. */
172 #define case_c2_undefs\
177 #define char1_command_names\
178 0, "hstem", 0, "vstem", "vmoveto",\
179 "rlineto", "hlineto", "vlineto", "rrcurveto", "closepath",\
180 "callsubr", "return", "(escape)", "hsbw", "endchar",\
181 "undoc15", 0, 0, 0, 0,\
182 0, "rmoveto", "hmoveto", 0, 0,\
184 "vhcurveto", "hvcurveto"
185 #define char2_command_names\
186 0, "hstem", 0, "vstem", "vmoveto",\
187 "rlineto", "hlineto", "vlineto", "rrcurveto", 0,\
188 "callsubr", "return", "(escape)", 0, "endchar",\
189 "undoc15", "blend", 0, "hstemhm", "hintmask",\
190 "cntrmask", "rmoveto", "hmoveto", "vstemhm", "rcurveline",\
191 "rlinecurve", "vvcurveto", "hhcurveto", "shortint", "callgsubr",\
192 "vhcurveto", "hvcurveto"
195 * Extended (escape) commands in Type 1 charstrings.
204 ce1_undoc15
= 15, /* An obsolete and undocumented */
205 /* command used in some very old */
207 ce1_callothersubr
= 16,
209 ce1_setcurrentpoint
= 33
210 } char1_extended_command
;
212 #define char1_extended_command_count 34
213 #define char1_extended_command_names\
214 "dotsection", "vstem3", "hstem3", 0, 0,\
215 0, "seac", "sbw", 0, 0,\
217 "undoc15", "callothersubr", "pop", 0, 0,\
220 0, 0, 0, "setcurrentpoint"
223 * Extended (escape) commands in Type 2 charstrings.
233 ce2_div
= 12, /* same as ce1_div */
252 } char2_extended_command
;
254 #define char2_extended_command_count 38
255 #define char2_extended_command_names\
256 0, 0, 0, "and", "or",\
257 "not", 0, 0, "store", "abs",\
258 "add", "sub", "div", "load", "neg",\
259 "eq", 0, 0, "drop", 0,\
260 "put", "get", "ifelse", "random", "mul",\
261 0, "sqrt", "dup", "exch", "index",\
262 "roll", 0, 0, 0, "hflex",\
263 "flex", "hflex1", "flex1"
265 #endif /* gstype1_INCLUDED */