2 |
- |
1 |
/* Copyright (C) 1994, 2000, 2001 Aladdin Enterprises. All rights reserved.
|
|
|
2 |
|
|
|
3 |
This software is provided AS-IS with no warranty, either express or
|
|
|
4 |
implied.
|
|
|
5 |
|
|
|
6 |
This software is distributed under license and may not be copied,
|
|
|
7 |
modified or distributed except as expressly authorized under the terms
|
|
|
8 |
of the license contained in the file LICENSE in this distribution.
|
|
|
9 |
|
|
|
10 |
For more information about licensing, please refer to
|
|
|
11 |
http://www.ghostscript.com/licensing/. For information on
|
|
|
12 |
commercial licensing, go to http://www.artifex.com/licensing/ or
|
|
|
13 |
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
|
|
|
14 |
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
/* $Id: gxfont1.h,v 1.13 2004/09/22 13:52:33 igor Exp $ */
|
|
|
18 |
/* Type 1 / Type 2 font data definition */
|
|
|
19 |
|
|
|
20 |
#ifndef gxfont1_INCLUDED
|
|
|
21 |
# define gxfont1_INCLUDED
|
|
|
22 |
|
|
|
23 |
#include "gstype1.h" /* for charstring_interpret_proc */
|
|
|
24 |
#include "gxfixed.h"
|
|
|
25 |
|
|
|
26 |
/*
|
|
|
27 |
* This is the type-specific information for Adobe Type 1 fonts.
|
|
|
28 |
* It also includes the information for Type 2 fonts, because
|
|
|
29 |
* there isn't very much of it and it's less trouble to include here.
|
|
|
30 |
*/
|
|
|
31 |
|
|
|
32 |
#ifndef gs_font_type1_DEFINED
|
|
|
33 |
# define gs_font_type1_DEFINED
|
|
|
34 |
typedef struct gs_font_type1_s gs_font_type1;
|
|
|
35 |
#endif
|
|
|
36 |
|
|
|
37 |
/*
|
|
|
38 |
* The zone_table values should be ints, according to the Adobe
|
|
|
39 |
* specification, but some fonts have arbitrary floats here.
|
|
|
40 |
*/
|
|
|
41 |
#define zone_table(size)\
|
|
|
42 |
struct {\
|
|
|
43 |
int count;\
|
|
|
44 |
float values[(size)*2];\
|
|
|
45 |
}
|
|
|
46 |
#define float_array(size)\
|
|
|
47 |
struct {\
|
|
|
48 |
int count;\
|
|
|
49 |
float values[size];\
|
|
|
50 |
}
|
|
|
51 |
#define stem_table(size)\
|
|
|
52 |
float_array(size)
|
|
|
53 |
|
|
|
54 |
#ifndef gs_type1_data_DEFINED
|
|
|
55 |
#define gs_type1_data_DEFINED
|
|
|
56 |
typedef struct gs_type1_data_s gs_type1_data;
|
|
|
57 |
#endif
|
|
|
58 |
|
|
|
59 |
typedef struct gs_type1_data_procs_s {
|
|
|
60 |
|
|
|
61 |
/* Get the data for any glyph. Return >= 0 or < 0 as usual. */
|
|
|
62 |
|
|
|
63 |
int (*glyph_data)(gs_font_type1 * pfont, gs_glyph glyph,
|
|
|
64 |
gs_glyph_data_t *pgd);
|
|
|
65 |
|
|
|
66 |
/* Get the data for a Subr. Return like glyph_data. */
|
|
|
67 |
|
|
|
68 |
int (*subr_data)(gs_font_type1 * pfont, int subr_num, bool global,
|
|
|
69 |
gs_glyph_data_t *pgd);
|
|
|
70 |
|
|
|
71 |
/*
|
|
|
72 |
* Get the data for a seac character, including the glyph and/or the
|
|
|
73 |
* outline data. Any of the pointers for the return values may be 0,
|
|
|
74 |
* indicating that the corresponding value is not needed.
|
|
|
75 |
* Return like glyph_data.
|
|
|
76 |
*/
|
|
|
77 |
|
|
|
78 |
int (*seac_data)(gs_font_type1 * pfont, int ccode,
|
|
|
79 |
gs_glyph * pglyph, gs_const_string *gstr, gs_glyph_data_t *pgd);
|
|
|
80 |
|
|
|
81 |
/*
|
|
|
82 |
* Push (a) value(s) onto the client ('PostScript') stack during
|
|
|
83 |
* interpretation. Note that this procedure and the next one take a
|
|
|
84 |
* closure pointer, not the font pointer, as the first argument.
|
|
|
85 |
*/
|
|
|
86 |
|
|
|
87 |
int (*push_values)(void *callback_data, const fixed *values,
|
|
|
88 |
int count);
|
|
|
89 |
|
|
|
90 |
/* Pop a value from the client stack. */
|
|
|
91 |
|
|
|
92 |
int (*pop_value)(void *callback_data, fixed *value);
|
|
|
93 |
|
|
|
94 |
} gs_type1_data_procs_t;
|
|
|
95 |
|
|
|
96 |
/*
|
|
|
97 |
* The garbage collector really doesn't want the client data pointer
|
|
|
98 |
* from a gs_type1_state to point to the gs_type1_data in the middle of
|
|
|
99 |
* a gs_font_type1, so we make the client data pointer (which is passed
|
|
|
100 |
* to the callback procedures) point to the gs_font_type1 itself.
|
|
|
101 |
*/
|
|
|
102 |
struct gs_type1_data_s {
|
|
|
103 |
/*int PaintType; *//* in gs_font_common */
|
|
|
104 |
gs_type1_data_procs_t procs;
|
|
|
105 |
charstring_interpret_proc((*interpret));
|
|
|
106 |
void *proc_data; /* data for procs */
|
|
|
107 |
gs_font_base *parent; /* the type 9 font, if this font is is a type 9 descendent. */
|
|
|
108 |
int lenIV; /* -1 means no encryption */
|
|
|
109 |
/* (undocumented feature!) */
|
|
|
110 |
uint subroutineNumberBias; /* added to operand of callsubr */
|
|
|
111 |
/* (undocumented feature!) */
|
|
|
112 |
/* Type 2 additions */
|
|
|
113 |
uint gsubrNumberBias; /* added to operand of callgsubr */
|
|
|
114 |
long initialRandomSeed;
|
|
|
115 |
fixed defaultWidthX;
|
|
|
116 |
fixed nominalWidthX;
|
|
|
117 |
/* End of Type 2 additions */
|
|
|
118 |
/* For a description of the following hint information, */
|
|
|
119 |
/* see chapter 5 of the "Adobe Type 1 Font Format" book. */
|
|
|
120 |
int BlueFuzz;
|
|
|
121 |
float BlueScale;
|
|
|
122 |
float BlueShift;
|
|
|
123 |
#define max_BlueValues 7
|
|
|
124 |
zone_table(max_BlueValues) BlueValues;
|
|
|
125 |
float ExpansionFactor;
|
|
|
126 |
bool ForceBold;
|
|
|
127 |
#define max_FamilyBlues 7
|
|
|
128 |
zone_table(max_FamilyBlues) FamilyBlues;
|
|
|
129 |
#define max_FamilyOtherBlues 5
|
|
|
130 |
zone_table(max_FamilyOtherBlues) FamilyOtherBlues;
|
|
|
131 |
int LanguageGroup;
|
|
|
132 |
#define max_OtherBlues 5
|
|
|
133 |
zone_table(max_OtherBlues) OtherBlues;
|
|
|
134 |
bool RndStemUp;
|
|
|
135 |
stem_table(1) StdHW;
|
|
|
136 |
stem_table(1) StdVW;
|
|
|
137 |
#define max_StemSnap 12
|
|
|
138 |
stem_table(max_StemSnap) StemSnapH;
|
|
|
139 |
stem_table(max_StemSnap) StemSnapV;
|
|
|
140 |
/* Additional information for Multiple Master fonts */
|
|
|
141 |
#define max_WeightVector 16
|
|
|
142 |
float_array(max_WeightVector) WeightVector;
|
|
|
143 |
};
|
|
|
144 |
|
|
|
145 |
#define gs_type1_data_s_DEFINED
|
|
|
146 |
|
|
|
147 |
struct gs_font_type1_s {
|
|
|
148 |
gs_font_base_common;
|
|
|
149 |
gs_type1_data data;
|
|
|
150 |
};
|
|
|
151 |
|
|
|
152 |
extern_st(st_gs_font_type1);
|
|
|
153 |
#define public_st_gs_font_type1() /* in gstype1.c */\
|
|
|
154 |
gs_public_st_suffix_add2_final(st_gs_font_type1, gs_font_type1,\
|
|
|
155 |
"gs_font_type1", font_type1_enum_ptrs, font_type1_reloc_ptrs,\
|
|
|
156 |
gs_font_finalize, st_gs_font_base, data.parent, data.proc_data)
|
|
|
157 |
|
|
|
158 |
/* Export font procedures so they can be called from the interpreter. */
|
|
|
159 |
font_proc_glyph_info(gs_type1_glyph_info);
|
|
|
160 |
|
|
|
161 |
/*
|
|
|
162 |
* If a Type 1 character is defined with 'seac', store the character codes
|
|
|
163 |
* in chars[0] and chars[1] and return 1; otherwise, return 0 or <0.
|
|
|
164 |
* This is exported only for the benefit of font copying.
|
|
|
165 |
*/
|
|
|
166 |
int gs_type1_piece_codes(/*const*/ gs_font_type1 *pfont,
|
|
|
167 |
const gs_glyph_data_t *pgd, gs_char *chars);
|
|
|
168 |
|
|
|
169 |
#endif /* gxfont1_INCLUDED */
|