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

« back to all changes in this revision

Viewing changes to base/gxfcopy.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: gxfcopy.h 9263 2008-12-08 08:17:55Z ken $ */
 
15
/* Font copying for high-level output */
 
16
 
 
17
#ifndef gxfcopy_INCLUDED
 
18
#  define gxfcopy_INCLUDED
 
19
 
 
20
#include "gsccode.h"
 
21
 
 
22
#ifndef gs_font_DEFINED
 
23
#  define gs_font_DEFINED
 
24
typedef struct gs_font_s gs_font;
 
25
#endif
 
26
 
 
27
#ifndef gs_matrix_DEFINED
 
28
#  define gs_matrix_DEFINED
 
29
typedef struct gs_matrix_s gs_matrix;
 
30
#endif
 
31
 
 
32
/*
 
33
 * Copy a font, aside from its glyphs.  Note that PostScript-specific data
 
34
 * -- that is, data that do not appear in the C structure that is the
 
35
 * relevant subclass of gs_font -- are NOT copied.  In particular,
 
36
 * Metrics[2], CDevProc, and FontInfo are not copied, except for the
 
37
 * information returned by font->procs.font_info (see the definition of
 
38
 * gs_font_info_t in gxfont.h).
 
39
 *
 
40
 * Note that in some cases the font must have a definition for the "not
 
41
 * defined" glyph, as noted below, or a rangecheck error occurs.
 
42
 *
 
43
 * The following FontTypes are supported:
 
44
 *
 
45
 *      Type 1, Type 2 - Encoding and CharStrings are not copied.  Subrs and
 
46
 *      GlobalSubrs (for CFFs) are copied; OtherSubrs are not copied.  The
 
47
 *      font must have a glyph named .notdef; its definition is copied.
 
48
 *
 
49
 *      Type 42 (TrueType) - Encoding and CharStrings are not copied.  The
 
50
 *      TrueType glyf and loca tables are not copied, nor are the bogus
 
51
 *      Adobe gdir, glyx, and locx "tables".  If the font has a definition
 
52
 *      for a glyph named .notdef (in the CharStrings dictionary), the
 
53
 *      definition is copied.
 
54
 *
 
55
 *      CIDFontType 0 (Type 1/2-based CIDFonts) - the glyph data are not
 
56
 *      copied.  The Type 1/2 subfonts *are* copied, as are the Subrs (both
 
57
 *      local and global).
 
58
 *
 
59
 *      CIDFontType 2 (TrueType-based CIDFonts) - the glyph data and CIDMap
 
60
 *      are not copied.
 
61
 *
 
62
 * The resulting font supports querying (font_info, glyph_info, etc.) and
 
63
 * rendering (glyph_outline, etc.), but it does not support make_font.
 
64
 *
 
65
 * max_reserved_glyphs limits the maount of space allocated for the glyph names
 
66
 * and glyph outlines of type 1 or 2 fonts. -1 reserves as many as required for 
 
67
 * a full copy of the original font. This is used by pdfwrite to limit the size 
 
68
 * of a copy when creating a subset font.
 
69
 */
 
70
int gs_copy_font(gs_font *font, const gs_matrix *orig_matrix, 
 
71
                    gs_memory_t *mem, gs_font **pfont_new, 
 
72
                    int max_reserved_glyphs);
 
73
 
 
74
/*
 
75
 * Copy a glyph, including any sub-glyphs.  The destination font ("copied"
 
76
 * argument) must be a font created by gs_copy_font.  The source font
 
77
 * ("font" argument) must have the same FontType as the destination, and in
 
78
 * addition must be "compatible" with it as described under the individual
 
79
 * FontTypes just below; however, gs_copy_glyph does not check
 
80
 * compatibility.
 
81
 *
 
82
 * If any glyph has already been copied but does not have the same
 
83
 * definition as the one being copied now, gs_copy_glyph returns an
 
84
 * invalidaccess error.  If the top-level glyph has already been copied
 
85
 * (with the same definition), gs_copy_glyph returns 1.  Otherwise,
 
86
 * gs_copy_glyph returns 0.
 
87
 *
 
88
 *      Type 1, Type 2 - the destination and source must have the same
 
89
 *      Subrs.  glyph must be a name (not an integer).  Copies the
 
90
 *      CharString entry.  Note that the Type 1/2 'seac' operator requires
 
91
 *      copying not only the sub-glyphs but their Encoding entries as well.
 
92
 *
 
93
 *      Type 42 - the destination and source must have compatible tables
 
94
 *      other than glyf and loca.  In practice this means that the source
 
95
 *      must be the same font that was passed to gs_copy_font.  If glyph is
 
96
 *      an integer, it is interpreted as a GID; if glyph is a name, both
 
97
 *      the CharString entry and the glyph data are copied.
 
98
 *
 
99
 *      CIDFontType 0 - the destination and source must have the same Subrs,
 
100
 *      and the Type 1/2 subfont(s) referenced by the glyph(s) being copied
 
101
 *      must be compatible.  glyph must be a CID.  Copies the CharString.
 
102
 *
 
103
 *      CIDFontType 2 - compatibility is as for Type 42.  glyph must be a
 
104
 *      CID (integer), not a GID.  Copies the glyph data and the CIDMap
 
105
 *      entry.
 
106
 *
 
107
 * Metrics[2] and CDevProc in the source font are ignored.  Currently,
 
108
 * for CIDFontType 2 fonts with MetricsCount != 0, the metrics attached to
 
109
 * the individual glyph outlines are also ignored (not copied).
 
110
 */
 
111
int gs_copy_glyph(gs_font *font, gs_glyph glyph, gs_font *copied);
 
112
 
 
113
/*
 
114
 * Copy a glyph with additional checking options.  If options includes
 
115
 * COPY_GLYPH_NO_OLD, then if the top-level glyph has already been copied,
 
116
 * return an invalidaccess error rather than 1.  If options includes
 
117
 * COPY_GLYPH_NO_NEW, then if the top-level glyph has *not* already been
 
118
 * copied, return an undefined error rather than 0.
 
119
 *
 
120
 * Returns an error if a glyph is added after calling copied_order_font.
 
121
 */
 
122
#define COPY_GLYPH_NO_OLD 1
 
123
#define COPY_GLYPH_NO_NEW 2
 
124
#define COPY_GLYPH_BY_INDEX 4
 
125
int gs_copy_glyph_options(gs_font *font, gs_glyph glyph, gs_font *copied,
 
126
                          int options);
 
127
 
 
128
/*
 
129
 * Add an encoding entry to a copied font.  If the given encoding entry is
 
130
 * not empty and is not the same as the new value, gs_copied_font_encode
 
131
 * returns an invalidaccess error.
 
132
 *
 
133
 * The action depends on FontType as follows:
 
134
 *
 
135
 *      Type 1, Type 2 - glyph must be a name, not a CID (integer).  Makes
 
136
 *      an entry in the font's Encoding.  A glyph by that name must exist
 
137
 *      in the copied font.
 
138
 *
 
139
 *      Type 42 - same as Type 1.
 
140
 *
 
141
 *      CIDFontType 0 - gives an error.
 
142
 *
 
143
 *      CIDFontType 2 - gives an error.
 
144
 */
 
145
int gs_copied_font_add_encoding(gs_font *copied, gs_char chr, gs_glyph glyph);
 
146
 
 
147
/*
 
148
 * Copy all the glyphs and, if relevant, Encoding entries from a font.  This
 
149
 * is equivalent to copying the glyphs and Encoding entries individually,
 
150
 * and returns errors under the same conditions.
 
151
 */
 
152
int gs_copy_font_complete(gs_font *font, gs_font *copied);
 
153
 
 
154
 
 
155
/*
 
156
 * Check whether specified glyphs can be copied from another font.
 
157
 * It means that (1) fonts have same hinting parameters and 
 
158
 * (2) font subsets for the specified glyph set don't include different 
 
159
 * outlines or metrics. Possible returned values : 
 
160
 * 0 (incompatible), 1 (compatible), < 0 (error)
 
161
 */
 
162
int gs_copied_can_copy_glyphs(const gs_font *cfont, const gs_font *ofont, 
 
163
                    gs_glyph *glyphs, int num_glyphs, int glyphs_step, 
 
164
                    bool check_hinting);
 
165
 
 
166
/* Extension glyphs may be added to a font to resolve 
 
167
   glyph name conflicts while conwerting a PDF Widths into Metrics.
 
168
   This function drops them before writing out an embedded font. */
 
169
int copied_drop_extension_glyphs(gs_font *cfont);
 
170
 
 
171
/* Order font to avoid a serialization indeterminism. 
 
172
   An indeterminizm can happen due to PS name indices 
 
173
   depend on memory allocation.
 
174
   Must not add glyphs after calling this function.
 
175
   After calling this function, enumerate_glyph 
 
176
   enumerates glyphs in the alphabetic order of glyph names.
 
177
   Currently works for Type 1,2 only,
 
178
   because other fonts type don't use PS name indices
 
179
   when enumerate glyphs.
 
180
*/
 
181
int copied_order_font(gs_font *font);
 
182
 
 
183
/* Get .notdef glyph. */
 
184
gs_glyph copied_get_notdef(const gs_font *font);
 
185
 
 
186
#endif /* gxfcopy_INCLUDED */