~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to base/gdevpdtf.h

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
 
2
   All Rights Reserved.
 
3
  
 
4
   This software is provided AS-IS with no warranty, either express or
 
5
   implied.
 
6
 
 
7
   This software is distributed under license and may not be copied, modified
 
8
   or distributed except as expressly authorized under the terms of that
 
9
   license.  Refer to licensing information at http://www.artifex.com/
 
10
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
 
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
 
12
*/
 
13
 
 
14
/* $Id: gdevpdtf.h 8621 2008-04-04 08:39:33Z ken $ */
 
15
/* Font and CMap resource structure and API for pdfwrite */
 
16
 
 
17
#ifndef gdevpdtf_INCLUDED
 
18
#  define gdevpdtf_INCLUDED
 
19
 
 
20
#include "gdevpdtx.h"
 
21
 
 
22
/* ================ Types and structures ================ */
 
23
 
 
24
/* ---------------- Font resources ---------------- */
 
25
 
 
26
/*
 
27
 * pdfwrite manages several different flavors of font resources:
 
28
 *
 
29
 *  Those that have neither a FontDescriptor nor a base_font:
 
30
 *      Type 0 (composite) fonts
 
31
 *  Those that have no FontDescriptor, but do have a base_font:
 
32
 *      Standard 14 fonts
 
33
 *  Those that have a FontDescriptor but no base_font:
 
34
 *      Type 3 bitmap fonts
 
35
 *  Those that have a FontDescriptor with a base_font:
 
36
 *      Type 1 / Type 2 fonts
 
37
 *      Type 42 (TrueType) fonts
 
38
 *      CIDFontType 0 (Type 1/2) CIDFonts
 
39
 *      CIDFontType 2 (TrueType) CIDFonts
 
40
 */
 
41
/*
 
42
 * Font names in PDF files have caused an enormous amount of trouble, so we
 
43
 * document specifically how they are handled in each structure.
 
44
 *
 
45
 * The PDF Reference specifies the BaseFont of a font resource as follows,
 
46
 * depending on the font type:
 
47
 *
 
48
 *   Type 0 - if the descendant font is CIDFontType 0, the descendant font
 
49
 *     name followed by a hyphen and the CMap name (the value of Encoding,
 
50
 *     if a name, otherwise the CMapName from the CMap); if the descendant
 
51
 *     font is CIDFontType 2, the descendant font name.
 
52
 *
 
53
 *   Type 1 - "usually" the same as the FontName in the base font.
 
54
 *
 
55
 *   MM Type 1 - if embedded, the same as Type 1; if not embedded, spaces
 
56
 *     in the font name are replaced with underscores.
 
57
 *
 
58
 *   Type 3 - not used.
 
59
 *
 
60
 *   TrueType - initially, the PostScript name from the 'name' table in
 
61
 *     the font; if none, the "name by which the font is known in the host
 
62
 *     operating system".  Spaces are removed.  Then, under circumstances
 
63
 *     not defined, the string ",Bold", ",Italic", or ",BoldItalic" is
 
64
 *     appended if the font has the corresponding style properties.
 
65
 *     [We do not do this: we simply use the key_name or font_name.]
 
66
 *
 
67
 *   CIDFontType 0 - "usually" the same as the CIDFontName in the base font.
 
68
 *
 
69
 *   CIDFontType 2 - the same as TrueType.
 
70
 *
 
71
 * In addition, the BaseFont has a XXXXXX+ prefix if the font is a subset
 
72
 * (whether embedded or not).
 
73
 *
 
74
 * We would like to compute the BaseFont at the time that we create the font
 
75
 * resource object.  The font descriptor (which is needed to provide
 
76
 * information about embedding) and the base font are both available at that
 
77
 * time.  Unfortunately, the information as to whether the font will be
 
78
 * subsetted is not available.  Therefore, we do compute the BaseFont from
 
79
 * the base font name when the font resource is created, to allow checking
 
80
 * for duplicate names and for standard font names, but we compute it again
 
81
 * after writing out the base font.
 
82
 */
 
83
 
 
84
#ifndef gs_cmap_DEFINED
 
85
#  define gs_cmap_DEFINED
 
86
typedef struct gs_cmap_s gs_cmap_t;
 
87
#endif
 
88
 
 
89
#ifndef gs_font_type0_DEFINED
 
90
#  define gs_font_type0_DEFINED
 
91
typedef struct gs_font_type0_s gs_font_type0;
 
92
#endif
 
93
 
 
94
#ifndef pdf_base_font_DEFINED
 
95
#  define pdf_base_font_DEFINED
 
96
typedef struct pdf_base_font_s pdf_base_font_t;
 
97
#endif
 
98
 
 
99
#ifndef pdf_font_descriptor_DEFINED
 
100
#  define pdf_font_descriptor_DEFINED
 
101
typedef struct pdf_font_descriptor_s pdf_font_descriptor_t;
 
102
#endif
 
103
 
 
104
#ifndef pdf_char_glyph_pair_DEFINED
 
105
#  define pdf_char_glyph_pair_DEFINED
 
106
typedef struct pdf_char_glyph_pair_s pdf_char_glyph_pair_t;
 
107
#endif
 
108
 
 
109
struct pdf_char_glyph_pair_s {
 
110
    gs_char chr;
 
111
    gs_glyph glyph;
 
112
};
 
113
 
 
114
/*
 
115
 * The write_contents procedure is set by the implementation when the
 
116
 * font resource is created.  It is called after generic code has opened
 
117
 * the resource object and written the Type, BaseFont (if any),
 
118
 * FontDescriptor reference (if any), ToUnicode CMap reference (if any),
 
119
 * and additional dictionary entries (if any).
 
120
 * The write_contents procedure must write any remaining entries specific
 
121
 * to the FontType, followed by the closing ">>", and then call
 
122
 * pdf_end_separate.  The reason for this division of function is to allow
 
123
 * the write_contents procedure to write additional objects that the
 
124
 * resource object references, after closing the resource object.
 
125
 */
 
126
typedef int (*pdf_font_write_contents_proc_t)
 
127
     (gx_device_pdf *, pdf_font_resource_t *);
 
128
 
 
129
/*
 
130
 * Define an element of an Encoding.  The element is unused if glyph ==
 
131
 * GS_NO_GLYPH.
 
132
 */
 
133
typedef struct pdf_encoding_element_s {
 
134
    gs_glyph glyph;
 
135
    gs_const_string str;
 
136
    bool is_difference;         /* true if must be written in Differences */
 
137
} pdf_encoding_element_t;
 
138
#define private_st_pdf_encoding1() /* gdevpdtf.c */\
 
139
  gs_private_st_const_strings1(st_pdf_encoding1,\
 
140
    pdf_encoding_element_t, "pdf_encoding_element_t",\
 
141
    pdf_encoding1_enum_ptrs, pdf_encoding1_reloc_ptrs, str)
 
142
#define private_st_pdf_encoding_element() /* gdevpdtf.c */\
 
143
  gs_private_st_element(st_pdf_encoding_element, pdf_encoding_element_t,\
 
144
    "pdf_encoding_element_t[]", pdf_encoding_elt_enum_ptrs,\
 
145
    pdf_encoding_elt_reloc_ptrs, st_pdf_encoding1)
 
146
 
 
147
 
 
148
struct pdf_base_font_s {
 
149
    /*
 
150
     * For the standard 14 fonts, copied == complete is a complete copy
 
151
     * of the font, and DO_SUBSET = NO.
 
152
     *
 
153
     * For fonts that MAY be subsetted, copied is a partial copy,
 
154
     * complete is a complete copy, and DO_SUBSET = UNKNOWN until
 
155
     * pdf_font_do_subset is called.
 
156
     *
 
157
     * For fonts that MUST be subsetted, copied == complete is a partial
 
158
     * copy, and DO_SUBSET = YES.
 
159
     */
 
160
    gs_font_base *copied;
 
161
    gs_font_base *complete;
 
162
    enum {
 
163
        DO_SUBSET_UNKNOWN = 0,
 
164
        DO_SUBSET_NO,
 
165
        DO_SUBSET_YES
 
166
    } do_subset;
 
167
    bool is_standard;
 
168
    /*
 
169
     * For CIDFonts, which are always subsetted, num_glyphs is CIDCount.
 
170
     * For optionally subsetted fonts, num_glyphs is the count of glyphs
 
171
     * in the font when originally copied.  Note that if the font is
 
172
     * downloaded incrementally, num_glyphs may be 0.
 
173
     */
 
174
    int num_glyphs;
 
175
    byte *CIDSet;               /* for CIDFonts */
 
176
    gs_string font_name;
 
177
    bool written;
 
178
    cos_dict_t *FontFile;
 
179
};
 
180
#define private_st_pdf_base_font()\
 
181
BASIC_PTRS(pdf_base_font_ptrs) {\
 
182
    GC_OBJ_ELT(pdf_base_font_t, copied),\
 
183
    GC_OBJ_ELT(pdf_base_font_t, complete),\
 
184
    GC_OBJ_ELT(pdf_base_font_t, CIDSet),\
 
185
    GC_OBJ_ELT(pdf_base_font_t, FontFile),\
 
186
    GC_STRING_ELT(pdf_base_font_t, font_name)\
 
187
};\
 
188
 
 
189
 
 
190
typedef struct {
 
191
    gs_id id;
 
192
    pdf_resource_type_t type;
 
193
} pdf_resource_ref_t;
 
194
 
 
195
/*
 
196
 * Widths are the widths in the outlines: this is what PDF interpreters
 
197
 * use, and what will be written in the PDF file.  real_widths are the
 
198
 * widths possibly modified by Metrics[2] and CDevProc: these define the
 
199
 * actual advance widths of the characters in the PostScript text.
 
200
 */
 
201
struct pdf_font_resource_s {
 
202
    pdf_resource_common(pdf_font_resource_t);
 
203
    font_type FontType;         /* copied from font, if any */
 
204
    pdf_font_write_contents_proc_t write_contents;
 
205
    gs_string BaseFont;         /* (not used for Type 3) */
 
206
    pdf_font_descriptor_t *FontDescriptor; /* (not used for Type 0, Type 3, */
 
207
                                /* or standard 14 fonts) */
 
208
    /*
 
209
     * The base_font member is only used for
 
210
     * the standard 14 fonts, which do not have a FontDescriptor.
 
211
     */
 
212
    pdf_base_font_t *base_font; /* == FontDescriptor->base_font */
 
213
    uint count;                 /* # of chars/CIDs */
 
214
    double *Widths;             /* [count] (not used for Type 0) */
 
215
    byte *used;                 /* [ceil(count/8)] bitmap of chars/CIDs used */
 
216
                                /* (not used for Type 0 or Type 3) */
 
217
    pdf_resource_t *res_ToUnicode; /* CMap (not used for CIDFonts) */
 
218
    gs_cmap_t *cmap_ToUnicode;     /* CMap (not used for CIDFonts) */
 
219
    gs_glyph_mark_proc_t mark_glyph;
 
220
    void *mark_glyph_data;      /* closure data */
 
221
    union {
 
222
 
 
223
        struct /*type0*/ {
 
224
 
 
225
            pdf_font_resource_t *DescendantFont; /* CIDFont */
 
226
            /*
 
227
             * The Encoding_name must be long enough to hold either the
 
228
             * longest standard CMap name defined in the PDF Reference,
 
229
             * or the longest reference to an embedded CMap (# 0 R).
 
230
             */
 
231
            char Encoding_name[max( /* standard name or <id> 0 R */
 
232
                      17,       /* /UniJIS-UCS2-HW-H */
 
233
                      sizeof(long) * 8 / 3 + 1 + 4 /* <id> 0 R */
 
234
                      ) + 1     /* \0 terminator */
 
235
            ];
 
236
            gs_const_string CMapName; /* copied from the original CMap, */
 
237
                                /* or references the table of standard names */
 
238
            uint font_index;    /* The index of the descendent font in the source CMap. */
 
239
            bool cmap_is_standard;
 
240
            int WMode;          /* of CMap */
 
241
 
 
242
        } type0;
 
243
 
 
244
        struct /*cidfont*/ {
 
245
 
 
246
            /* [D]W[2] is Widths. */
 
247
            long CIDSystemInfo_id; /* (written when font is allocated) */
 
248
            ushort *CIDToGIDMap; /* (CIDFontType 2 only) [count] */
 
249
            gs_id glyphshow_font_id;
 
250
            double *Widths2;    /* [count * 2] (x, y) */
 
251
            double *v;          /* [count] */
 
252
            byte *used2;        /* [(count + 7) / 8] */
 
253
            pdf_font_resource_t *parent;
 
254
 
 
255
        } cidfont;
 
256
 
 
257
        struct /*simple*/ {
 
258
 
 
259
            int FirstChar, LastChar; /* 0 <= FirstChar <= LastChar <= 255 */
 
260
            /*
 
261
             * The BaseEncoding can only be ENCODING_INDEX_WINANSI,
 
262
             * ENCODING_INDEX_MACROMAN, ENCODING_INDEX_MACEXPERT, or -1.
 
263
             */
 
264
            gs_encoding_index_t BaseEncoding;
 
265
            gs_encoding_index_t preferred_encoding_index;
 
266
            pdf_encoding_element_t *Encoding; /* [256], not for Type 3 */
 
267
            gs_point *v; /* [256], glyph origin for WMode 1 */
 
268
            int last_reserved_char; /* Except for synthesised Type 3, 
 
269
                                           which stores such data in LastChar */
 
270
 
 
271
            union {
 
272
 
 
273
                struct /*type1*/ {
 
274
                    bool is_MM_instance;
 
275
                } type1;
 
276
 
 
277
                struct /*truetype*/ {
 
278
                    /*
 
279
                     * No extra info needed, but the ANSI standard doesn't
 
280
                     * allow empty structs.
 
281
                     */
 
282
                    int _dummy;
 
283
                } truetype;
 
284
 
 
285
                struct /*type3*/ {
 
286
                    gs_rect FontBBox;
 
287
                    gs_matrix FontMatrix;
 
288
                    pdf_char_proc_ownership_t *char_procs;
 
289
                    int max_y_offset;
 
290
                    bool bitmap_font;
 
291
                    cos_dict_t *Resources;
 
292
                    byte *cached;
 
293
                } type3;
 
294
 
 
295
            } s;
 
296
 
 
297
        } simple;
 
298
 
 
299
    } u;
 
300
};
 
301
/* The GC descriptor for resource types must be public. */
 
302
#define public_st_pdf_font_resource() /* gdevpdtf.c */\
 
303
  gs_public_st_composite(st_pdf_font_resource, pdf_font_resource_t,\
 
304
    "pdf_font_resource_t", pdf_font_resource_enum_ptrs,\
 
305
    pdf_font_resource_reloc_ptrs)
 
306
 
 
307
/*
 
308
 * Define the possible embedding statuses of a font.
 
309
 */
 
310
typedef enum {
 
311
    FONT_EMBED_STANDARD,        /* 14 standard fonts */
 
312
    FONT_EMBED_NO,
 
313
    FONT_EMBED_YES
 
314
} pdf_font_embed_t;
 
315
 
 
316
/* ---------------- Global structures ---------------- */
 
317
 
 
318
/*
 
319
 * Define a structure for keeping track of the (unique) resource for
 
320
 * each standard font.  Note that standard fonts do not have descriptors:
 
321
 * the base_font and copied_font members of the font resource provide the
 
322
 * necessary information.
 
323
 */
 
324
typedef struct pdf_standard_font_s {
 
325
    pdf_font_resource_t *pdfont;
 
326
    gs_matrix orig_matrix;      /* ****** do we need this? */
 
327
} pdf_standard_font_t;
 
328
#define private_st_pdf_standard_font() /* gdevpdtf.c */\
 
329
  gs_private_st_ptrs1(st_pdf_standard_font, pdf_standard_font_t,\
 
330
    "pdf_standard_font_t", pdf_std_font_enum_ptrs, pdf_std_font_reloc_ptrs,\
 
331
    pdfont)
 
332
#define private_st_pdf_standard_font_element() /* gdevpdtf.c */\
 
333
  gs_private_st_element(st_pdf_standard_font_element, pdf_standard_font_t,\
 
334
    "pdf_standard_font_t[]", pdf_std_font_elt_enum_ptrs,\
 
335
    pdf_std_font_elt_reloc_ptrs, st_pdf_standard_font)
 
336
 
 
337
/*
 
338
 * There is a single instance (per device) of a structure that tracks global
 
339
 * information about outline fonts.  It is defined here, rather than
 
340
 * opaquely in the implementation file, because the text processing code
 
341
 * needs access to it.
 
342
 */
 
343
 
 
344
/*typedef struct pdf_outline_fonts_s pdf_outline_fonts_t;*/  /* gdevpdtx.h */
 
345
struct pdf_outline_fonts_s {
 
346
    pdf_standard_font_t *standard_fonts; /* [PDF_NUM_STANDARD_FONTS] */
 
347
};
 
348
#define private_st_pdf_outline_fonts() /* gdevpdtf.c */\
 
349
  gs_private_st_ptrs1(st_pdf_outline_fonts, pdf_outline_fonts_t,\
 
350
    "pdf_outline_fonts_t", pdf_outline_fonts_enum_ptrs,\
 
351
    pdf_outline_fonts_reloc_ptrs, standard_fonts)
 
352
 
 
353
/* ================ Procedures ================ */
 
354
 
 
355
/* ---------------- Font resources ---------------- */
 
356
 
 
357
/*
 
358
 * Allocate and initialize bookkeeping for outline fonts.
 
359
 */
 
360
pdf_outline_fonts_t *pdf_outline_fonts_alloc(gs_memory_t *mem);
 
361
 
 
362
/*
 
363
 * Return the standard fonts array.
 
364
 */
 
365
pdf_standard_font_t *pdf_standard_fonts(const gx_device_pdf *pdev);
 
366
 
 
367
/*
 
368
 * Clean the standard fonts array.
 
369
 */
 
370
void pdf_clean_standard_fonts(const gx_device_pdf *pdev);
 
371
 
 
372
/* Free font cache. */
 
373
int pdf_free_font_cache(gx_device_pdf *pdev);
 
374
 
 
375
/*
 
376
 * Allocate specific types of font resource.
 
377
 */
 
378
int pdf_font_type0_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
 
379
                         gs_id rid, pdf_font_resource_t *DescendantFont,
 
380
                         const gs_const_string *CMapName);
 
381
int pdf_font_type3_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
 
382
                         pdf_font_write_contents_proc_t write_contents);
 
383
int pdf_font_std_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
 
384
                   bool is_original, gs_id rid, gs_font_base *pfont, int index);
 
385
int pdf_font_simple_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
 
386
                          gs_id rid, pdf_font_descriptor_t *pfd);
 
387
int pdf_font_cidfont_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
 
388
                           gs_id rid, pdf_font_descriptor_t *pfd);
 
389
int pdf_obtain_cidfont_widths_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, 
 
390
                    int wmode, double **w, double **w0, double **v);
 
391
int font_resource_encoded_alloc(gx_device_pdf *pdev, pdf_font_resource_t **ppfres,
 
392
                            gs_id rid, font_type ftype,
 
393
                            pdf_font_write_contents_proc_t write_contents);
 
394
int pdf_assign_font_object_id(gx_device_pdf *pdev, pdf_font_resource_t *pdfont);
 
395
 
 
396
/* Resize font resource arrays. */
 
397
int pdf_resize_resource_arrays(gx_device_pdf *pdev, pdf_font_resource_t *pfres, 
 
398
        int chars_count);
 
399
 
 
400
/*
 
401
 * Return the (copied, subset or complete) font associated with a font resource.
 
402
 * If this font resource doesn't have a descriptor (Type 0, Type 3, or
 
403
 * standard 14), return 0.
 
404
 */
 
405
gs_font_base *pdf_font_resource_font(const pdf_font_resource_t *pdfont, bool complete);
 
406
 
 
407
/*
 
408
 * Determine the embedding status of a font.  If the font is in the base
 
409
 * 14, store its index (0..13) in *pindex and its similarity to the base
 
410
 * font (as determined by the font's same_font procedure) in *psame.
 
411
 * (pindex and/or psame may be NULL.)
 
412
 */
 
413
pdf_font_embed_t pdf_font_embed_status(gx_device_pdf *pdev, gs_font *font,
 
414
                                       int *pindex,
 
415
                                       pdf_char_glyph_pair_t *pairs, int num_glyphs);
 
416
 
 
417
/*
 
418
 * Compute the BaseFont of a font according to the algorithm described
 
419
 * above.
 
420
 */
 
421
int pdf_compute_BaseFont(gx_device_pdf *pdev, pdf_font_resource_t *pdfont, bool finish);
 
422
 
 
423
/*
 
424
 * Close the text-related parts of a document, including writing out font
 
425
 * and related resources.
 
426
 */
 
427
int pdf_close_text_document(gx_device_pdf *pdev); /* in gdevpdtw.c */
 
428
 
 
429
/*
 
430
 * Convert True Type fonts into CID fonts for PDF/A.
 
431
 */
 
432
int pdf_convert_truetype_font(gx_device_pdf *pdev,  pdf_resource_t *pres);
 
433
 
 
434
/*
 
435
 * Convert True Type font descriptor into CID font descriptor for PDF/A.
 
436
 */
 
437
int pdf_convert_truetype_font_descriptor(gx_device_pdf *pdev, pdf_font_resource_t *pdfont);
 
438
 
 
439
/* ---------------- CMap resources ---------------- */
 
440
 
 
441
/*
 
442
 * Allocate a CMap resource.
 
443
 */
 
444
int pdf_cmap_alloc(gx_device_pdf *pdev, const gs_cmap_t *pcmap,
 
445
                   pdf_resource_t **ppres /* CMap */, int font_index_only);
 
446
 
 
447
/*
 
448
 * Add a CID-to-GID mapping to a CIDFontType 2 font resource.
 
449
 */
 
450
int pdf_font_add_cid_to_gid(pdf_font_resource_t *pdfont, uint cid, uint gid);
 
451
 
 
452
#endif /* gdevpdtf_INCLUDED */