Commit | Line | Data |
---|---|---|
300418c5 WJ |
1 | /* Copyright (C) 1989, 1992 Aladdin Enterprises. All rights reserved. |
2 | Distributed by Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of Ghostscript. | |
5 | ||
6 | Ghostscript is distributed in the hope that it will be useful, but | |
7 | WITHOUT ANY WARRANTY. No author or distributor accepts responsibility | |
8 | to anyone for the consequences of using it or for whether it serves any | |
9 | particular purpose or works at all, unless he says so in writing. Refer | |
10 | to the Ghostscript General Public License for full details. | |
11 | ||
12 | Everyone is granted permission to copy, modify and redistribute | |
13 | Ghostscript, but only under the conditions described in the Ghostscript | |
14 | General Public License. A copy of this license is supposed to have been | |
15 | given to you along with Ghostscript so you can know your rights and | |
16 | responsibilities. It should be in a file named COPYING. Among other | |
17 | things, the copyright notice and this notice must be preserved on all | |
18 | copies. */ | |
19 | ||
20 | /* gxfont.h */ | |
21 | /* Internal font definition for Ghostscript library */ | |
22 | /* Requires gsmatrix.h, gxdevice.h */ | |
23 | #include "gsfont.h" | |
24 | ||
25 | /* A font object as seen by clients. */ | |
26 | /* See the PostScript Language Reference Manual for details. */ | |
27 | ||
28 | #ifndef gs_show_enum_s_DEFINED | |
29 | struct gs_show_enum_s; | |
30 | #endif | |
31 | ||
32 | typedef int (*gs_proc_build_char) | |
33 | (P5(struct gs_show_enum_s *, struct gs_state_s *, struct gs_font_s *, | |
34 | char_code, char * /* build_char_data */)); | |
35 | ||
36 | int gs_no_build_char_proc | |
37 | (P5(struct gs_show_enum_s *, struct gs_state_s *, struct gs_font_s *, | |
38 | char_code, char *)); | |
39 | ||
40 | /* Define the known font types. */ | |
41 | /* These numbers must be the same as the values of FontType */ | |
42 | /* in font dictionaries. */ | |
43 | typedef enum { | |
44 | ft_composite = 0, | |
45 | ft_encrypted = 1, | |
46 | ft_user_defined = 3 | |
47 | } font_type; | |
48 | ||
49 | /* Define the composite font mapping types. */ | |
50 | /* These numbers must be the same as the values of FMapType */ | |
51 | /* in type 0 font dictionaries. */ | |
52 | typedef enum { | |
53 | fmap_8_8 = 2, | |
54 | fmap_escape = 3, | |
55 | fmap_1_7 = 4, | |
56 | fmap_9_7 = 5, | |
57 | fmap_SubsVector = 6, | |
58 | fmap_double_escape = 7, | |
59 | fmap_shift = 8 | |
60 | } fmap_type; | |
61 | #define fmap_type_min 2 | |
62 | #define fmap_type_max 8 | |
63 | #define fmap_type_is_modal(fmt)\ | |
64 | ((fmt) == fmap_escape || (fmt) == fmap_double_escape || (fmt) == fmap_shift) | |
65 | ||
66 | /* This is the type-specific information for a type 0 (composite) gs_font. */ | |
67 | typedef struct gs_type0_data_s gs_type0_data; | |
68 | struct gs_type0_data_s { | |
69 | fmap_type FMapType; | |
70 | byte EscChar, ShiftIn, ShiftOut; | |
71 | byte *SubsVector; | |
72 | uint subs_size; /* bytes per entry */ | |
73 | uint subs_width; /* # of entries */ | |
74 | uint *Encoding; | |
75 | uint encoding_size; | |
76 | gs_font **FDepVector; | |
77 | uint fdep_size; | |
78 | }; | |
79 | ||
80 | /* This is the type-specific information for a type 1 (encrypted) gs_font. */ | |
81 | #define zone_table(tname, size)\ | |
82 | struct {\ | |
83 | int count;\ | |
84 | int data[(size)*2];\ | |
85 | } tname | |
86 | #define stem_table(tname, size)\ | |
87 | struct {\ | |
88 | int count;\ | |
89 | float data[size];\ | |
90 | } tname | |
91 | typedef struct gs_type1_data_s gs_type1_data; | |
92 | struct gs_type1_data_s { | |
93 | int PaintType; /* PaintType */ | |
94 | int (*subr_proc)(P3(gs_type1_data *pdata, | |
95 | int index, byte **pcharstring)); | |
96 | int (*pop_proc)(P2(gs_type1_data *, fixed *)); | |
97 | char *proc_data; /* data for subr_proc */ | |
98 | int lenIV; /* # of leading garbage bytes */ | |
99 | /* The following hint information is not used yet. */ | |
100 | /* See chapter 5 of the "Adobe Type 1 Font Format" book. */ | |
101 | int BlueFuzz; | |
102 | float BlueScale; | |
103 | int BlueShift; | |
104 | #define max_BlueValues 7 | |
105 | zone_table(BlueValues, max_BlueValues); | |
106 | float ExpansionFactor; | |
107 | int ForceBold; | |
108 | #define max_FamilyBlues 7 | |
109 | zone_table(FamilyBlues, max_FamilyBlues); | |
110 | #define max_FamilyOtherBlues 5 | |
111 | zone_table(FamilyOtherBlues, max_FamilyOtherBlues); | |
112 | int LanguageGroup; | |
113 | #define max_OtherBlues 5 | |
114 | zone_table(OtherBlues, max_OtherBlues); | |
115 | int RndStemUp; | |
116 | stem_table(StdHW, 1); | |
117 | stem_table(StdVW, 1); | |
118 | #define max_StemSnap 12 | |
119 | stem_table(StemSnapH, max_StemSnap); | |
120 | stem_table(StemSnapV, max_StemSnap); | |
121 | }; | |
122 | #define gs_type1_data_s_DEFINED | |
123 | ||
124 | /* Even though it costs a little extra space, it's more convenient to */ | |
125 | /* include all the necessary information for >>all<< known font types */ | |
126 | /* (user-defined, encrypted, and composite) in the font structure. */ | |
127 | struct gs_font_s { | |
128 | gs_font *next, *prev; /* chain for scaled font cache */ | |
129 | gs_font *base; /* original (unscaled) base font */ | |
130 | gs_font_dir *dir; /* directory where registered */ | |
131 | char *client_data; /* additional client data */ | |
132 | gs_matrix FontMatrix; | |
133 | font_type FontType; | |
134 | int WMode; /* 0 or 1 */ | |
135 | gs_proc_build_char build_char_proc; /* BuildChar */ | |
136 | char *build_char_data; /* private data for BuildChar */ | |
137 | union _d { | |
138 | /* Composite (type 0) fonts */ | |
139 | gs_type0_data type0_data; | |
140 | /* Base (non-type 0) fonts */ | |
141 | struct _b { | |
142 | gs_rect FontBBox; | |
143 | long UniqueID; | |
144 | /* Type 1 data */ | |
145 | gs_type1_data type1_data; | |
146 | } base; | |
147 | } data; | |
148 | }; |