11
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: gdevpsf.h 8622 2008-04-04 08:53:57Z ken $ */
15
15
/* PostScript/PDF font writing interface */
17
17
#ifndef gdevpsf_INCLUDED
44
44
struct psf_glyph_enum_s {
48
const gs_glyph *list; /* if subset given by a list */
49
const byte *bits; /* if CID or TT subset given by a bitmap */
48
const gs_glyph *list; /* if subset given by a list */
49
const byte *bits; /* if CID or TT subset given by a bitmap */
53
53
gs_glyph_space_t glyph_space;
61
61
* (as integer glyphs, i.e., offset by gs_min_cid_glyph).
63
63
void psf_enumerate_list_begin(psf_glyph_enum_t *ppge, gs_font *font,
64
const gs_glyph *subset_list,
66
gs_glyph_space_t glyph_space);
64
const gs_glyph *subset_list,
66
gs_glyph_space_t glyph_space);
67
67
/* Backward compatibility */
68
68
#define psf_enumerate_glyphs_begin psf_enumerate_list_begin
70
70
/* Begin enumerating CID or TT glyphs in a subset given by a bit vector. */
71
71
/* Note that subset_size is given in bits, not in bytes. */
72
72
void psf_enumerate_bits_begin(psf_glyph_enum_t *ppge, gs_font *font,
73
const byte *subset_bits, uint subset_size,
74
gs_glyph_space_t glyph_space);
73
const byte *subset_bits, uint subset_size,
74
gs_glyph_space_t glyph_space);
75
75
/* Backward compatibility */
76
76
#define psf_enumerate_cids_begin(ppge, font, bits, size)\
77
77
psf_enumerate_bits_begin(ppge, font, bits, size, GLYPH_SPACE_NAME)
96
96
int psf_add_subset_pieces(gs_glyph *glyphs, uint *pcount, uint max_count,
97
uint max_pieces, gs_font *font);
97
uint max_pieces, gs_font *font);
100
100
* Sort a list of glyphs and remove duplicates. Return the number of glyphs
107
107
* if the glyph is not present.
109
109
int psf_sorted_glyphs_index_of(const gs_glyph *glyphs, int count,
112
112
* Determine whether a sorted list of glyphs includes a given glyph.
114
114
bool psf_sorted_glyphs_include(const gs_glyph *glyphs, int count,
118
118
* Define the internal structure that holds glyph information for an
138
138
/* Define the type for the glyph data callback procedure. */
139
139
typedef int (*glyph_data_proc_t)(gs_font_base *, gs_glyph,
140
gs_glyph_data_t *, gs_font_type1 **);
140
gs_glyph_data_t *, gs_font_type1 **);
142
142
/* Check that all selected glyphs can be written. */
143
143
int psf_check_outline_glyphs(gs_font_base *pfont,
144
psf_glyph_enum_t *ppge,
145
glyph_data_proc_t glyph_data);
144
psf_glyph_enum_t *ppge,
145
glyph_data_proc_t glyph_data);
148
148
* Gather glyph information for a Type 1, Type 2, or CIDFontType 0 font.
153
153
* undefined glyphs from the list it builds.
155
155
int psf_get_outline_glyphs(psf_outline_glyphs_t *pglyphs,
156
gs_font_base *pfont, gs_glyph *subset_glyphs,
157
uint subset_size, glyph_data_proc_t glyph_data);
156
gs_font_base *pfont, gs_glyph *subset_glyphs,
157
uint subset_size, glyph_data_proc_t glyph_data);
159
159
/* ------ Exported by gdevpsf1.c ------ */
161
161
/* Gather glyph information for a Type 1 or Type 2 font. */
162
162
int psf_type1_glyph_data(gs_font_base *, gs_glyph, gs_glyph_data_t *,
164
164
int psf_get_type1_glyphs(psf_outline_glyphs_t *pglyphs,
165
gs_font_type1 *pfont,
166
gs_glyph *subset_glyphs, uint subset_size);
165
gs_font_type1 *pfont,
166
gs_glyph *subset_glyphs, uint subset_size);
169
169
* Write a Type 1 font definition. This procedure does not allocate
176
176
#define WRITE_TYPE1_POSTSCRIPT 16 /* don't observe ATM restrictions */
177
177
#define WRITE_TYPE1_WITH_LENIV 32 /* don't allow lenIV = -1 */
178
178
int psf_write_type1_font(stream *s, gs_font_type1 *pfont, int options,
179
gs_glyph *subset_glyphs, uint subset_size,
180
const gs_const_string *alt_font_name,
179
gs_glyph *subset_glyphs, uint subset_size,
180
const gs_const_string *alt_font_name,
183
183
/* ------ Exported by gdevpsf2.c ------ */
191
191
#define WRITE_TYPE2_AR3 4 /* work around bugs in Acrobat Reader 3 */
192
192
#define WRITE_TYPE2_NO_GSUBRS 8 /* omit GlobalSubrs */
193
193
int psf_write_type2_font(stream *s, gs_font_type1 *pfont, int options,
194
gs_glyph *subset_glyphs, uint subset_size,
195
const gs_const_string *alt_font_name,
196
gs_int_rect *FontBBox);
194
gs_glyph *subset_glyphs, uint subset_size,
195
const gs_const_string *alt_font_name,
196
gs_int_rect *FontBBox);
198
198
#ifndef gs_font_cid0_DEFINED
199
199
# define gs_font_cid0_DEFINED
207
207
* This procedure does not allocate or free any data.
209
209
int psf_write_cid0_font(stream *s, gs_font_cid0 *pfont, int options,
210
const byte *subset_cids, uint subset_size,
211
const gs_const_string *alt_font_name);
210
const byte *subset_cids, uint subset_size,
211
const gs_const_string *alt_font_name);
213
213
/* ------ Exported by gdevpsfm.c ------ */
223
223
typedef int (*psf_put_name_chars_proc_t)(stream *, const byte *, uint);
224
224
int psf_write_cmap(const gs_memory_t *mem, stream *s, const gs_cmap_t *pcmap,
225
psf_put_name_chars_proc_t put_name_chars,
226
const gs_const_string *alt_cmap_name, int font_index_only);
225
psf_put_name_chars_proc_t put_name_chars,
226
const gs_const_string *alt_cmap_name, int font_index_only);
227
227
/* ------ Exported by gdevpsft.c ------ */
229
229
extern const long default_defaultWidthX;
241
241
#define WRITE_TRUETYPE_POST 4 /* generate post if missing */
242
242
#define WRITE_TRUETYPE_NO_TRIMMED_TABLE 8 /* not OK to use cmap format 6 */
243
243
#define WRITE_TRUETYPE_HVMTX 16 /* generate [hv]mtx from glyph_info */
244
#define WRITE_TRUETYPE_UNICODE_CMAP 32 /* For PDF/A or other non-symbolic TT font,
245
* write a 3,1 (Windows Unicode) cmap instead of
244
#define WRITE_TRUETYPE_UNICODE_CMAP 32 /* For PDF/A or other non-symbolic TT font,
245
* write a 3,1 (Windows Unicode) cmap instead of
248
248
int psf_write_truetype_font(stream *s, gs_font_type42 *pfont, int options,
249
gs_glyph *subset_glyphs, uint subset_size,
250
const gs_const_string *alt_font_name);
249
gs_glyph *subset_glyphs, uint subset_size,
250
const gs_const_string *alt_font_name);
253
253
* Write a "stripped" TrueType font definition. All tables are written
285
285
* This procedure does not allocate or free any data.
287
287
int psf_write_cid2_font(stream *s, gs_font_cid2 *pfont, int options,
288
const byte *subset_glyphs, uint subset_size,
289
const gs_const_string *alt_font_name);
288
const byte *subset_glyphs, uint subset_size,
289
const gs_const_string *alt_font_name);
292
292
* Write a "stripped" CIDFontType 2 font definition. This is the same