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

« back to all changes in this revision

Viewing changes to base/gxfont42.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: gxfont42.h 9212 2008-11-09 19:09:30Z leonardo $ */
 
15
/* Type 42 font data definition */
 
16
 
 
17
#ifndef gxfont42_INCLUDED
 
18
#  define gxfont42_INCLUDED
 
19
 
 
20
#ifndef gs_glyph_cache_DEFINED
 
21
#  define gs_glyph_cache_DEFINED
 
22
typedef struct gs_glyph_cache_s gs_glyph_cache;
 
23
#endif
 
24
 
 
25
#ifndef cached_fm_pair_DEFINED
 
26
#  define cached_fm_pair_DEFINED
 
27
typedef struct cached_fm_pair_s cached_fm_pair;
 
28
#endif
 
29
 
 
30
/* This is the type-specific information for a Type 42 (TrueType) font. */
 
31
#ifndef gs_type42_data_DEFINED
 
32
#define gs_type42_data_DEFINED
 
33
typedef struct gs_type42_data_s gs_type42_data;
 
34
#endif
 
35
#ifndef gs_font_type42_DEFINED
 
36
#  define gs_font_type42_DEFINED
 
37
typedef struct gs_font_type42_s gs_font_type42;
 
38
#endif
 
39
 
 
40
 
 
41
typedef enum gs_type42_metrics_options_s {
 
42
    gs_type42_metrics_options_WMODE0 = 0,
 
43
    gs_type42_metrics_options_WMODE1 = 1,
 
44
    gs_type42_metrics_options_BBOX = 2,
 
45
    gs_type42_metrics_options_WMODE0_AND_BBOX = 4,
 
46
    gs_type42_metrics_options_WMODE1_AND_BBOX = 5,
 
47
} gs_type42_metrics_options_t;
 
48
#define gs_type42_metrics_options_wmode(a)         ((a)&gs_type42_metrics_options_WMODE1)
 
49
#define gs_type42_metrics_options_sbw_requested(a) (~(a)&gs_type42_metrics_options_BBOX)
 
50
#define gs_type42_metrics_options_bbox_requested(a)((a)&6)
 
51
 
 
52
/* Export the default get_metrics procedure. 
 
53
   The length of sbw is >=4 when bbox in not requested,
 
54
   and 8 otherwise.
 
55
 */
 
56
int gs_type42_default_get_metrics(gs_font_type42 *pfont, uint glyph_index,
 
57
                                  gs_type42_metrics_options_t options, float *sbw);
 
58
 
 
59
typedef struct gs_type42_mtx_s {
 
60
    uint numMetrics;            /* num*Metrics from [hv]hea */
 
61
    ulong offset;               /* offset to [hv]mtx table */
 
62
    uint length;                /* length of [hv]mtx table */
 
63
} gs_type42_mtx_t;
 
64
struct gs_type42_data_s {
 
65
    /* The following are set by the client. */
 
66
    int (*string_proc) (gs_font_type42 *, ulong, uint, const byte **);
 
67
    void *proc_data;            /* data for procedures */
 
68
    /*
 
69
     * The following are initialized by ...font_init, but may be reset by
 
70
     * the client.
 
71
     */
 
72
    uint (*get_glyph_index)(gs_font_type42 *pfont, gs_glyph glyph);
 
73
    int (*get_outline)(gs_font_type42 *pfont, uint glyph_index,
 
74
                       gs_glyph_data_t *pgd);
 
75
    int (*get_metrics)(gs_font_type42 *pfont, uint glyph_index, 
 
76
                        gs_type42_metrics_options_t options,
 
77
                        float *sbw_bbox/* See comment for gs_type42_default_get_metrics */);
 
78
     uint (*substitute_glyph_index_vertical)(gs_font_type42 *pfont, uint glyph_index,
 
79
                                          int WMode, gs_glyph glyph);
 
80
 
 
81
    /* The following are cached values. */
 
82
    ulong cmap;                 /* offset to cmap table (not used by */
 
83
                                /* renderer, only here for clients) */
 
84
    ulong glyf;                 /* offset to glyf table */
 
85
    uint unitsPerEm;            /* from head */
 
86
    uint indexToLocFormat;      /* from head */
 
87
    gs_type42_mtx_t metrics[2]; /* hhea/hmtx, vhea/vmtx (indexed by WMode) */
 
88
    ulong loca;                 /* offset to loca table */
 
89
    ulong name_offset;          /* offset to name table */              
 
90
    ulong os2_offset;           /* offset to OS/2 table */              
 
91
    /*
 
92
     * TrueType fonts specify the number of glyphs in two different ways:
 
93
     * the size of the loca table, and an explicit value in maxp.  Currently
 
94
     * the value of numGlyphs in this structure is computed from the size of
 
95
     * loca.  This is wrong: incrementally downloaded TrueType (or
 
96
     * CIDFontType 2) fonts will have no loca table, but will have a
 
97
     * reasonable glyph count in maxp.  Unfortunately, a significant amount
 
98
     * of code now depends on the incorrect definition of numGlyphs.
 
99
     * Therefore, rather than run the risk of introducing bugs by changing
 
100
     * the definition and/or by changing the name of the data member, we add
 
101
     * another member trueNumGlyphs to hold the value from maxp.
 
102
     */
 
103
    uint numGlyphs;             /* from size of loca */
 
104
    uint trueNumGlyphs;         /* from maxp */
 
105
    uint *len_glyphs;           /* built from the loca table */
 
106
    gs_glyph_cache *gdcache;
 
107
    bool warning_patented;
 
108
    bool warning_bad_instruction;
 
109
    byte *gsub;                 /* GSUB */
 
110
    ulong gsub_size;
 
111
};
 
112
#define gs_font_type42_common\
 
113
    gs_font_base_common;\
 
114
    gs_type42_data data
 
115
struct gs_font_type42_s {
 
116
    gs_font_type42_common;
 
117
};
 
118
 
 
119
extern_st(st_gs_font_type42);
 
120
#define public_st_gs_font_type42()      /* in gstype42.c */\
 
121
  gs_public_st_suffix_add4_final(st_gs_font_type42, gs_font_type42,\
 
122
    "gs_font_type42", font_type42_enum_ptrs, font_type42_reloc_ptrs,\
 
123
    gs_font_finalize, st_gs_font_base, data.proc_data, data.len_glyphs, \
 
124
    data.gdcache, data.gsub)
 
125
 
 
126
/*
 
127
 * Because a Type 42 font contains so many cached values,
 
128
 * we provide a procedure to initialize them from the font data.
 
129
 * Note that this initializes the type42_data procedures other than
 
130
 * string_proc, and the font procedures as well.
 
131
 * USE_ttfReader subclasses gs_font_type42 with ttfReader or without.
 
132
 * FAPI will disable ttfReader as well. 
 
133
 */
 
134
int gs_type42_font_init(gs_font_type42 *pfont, int subfontid);
 
135
 
 
136
/* Read data from sfnts. */
 
137
int gs_type42_read_data(gs_font_type42 * pfont, ulong pos, uint length, byte *buf);
 
138
 
 
139
/* Read data from sfnts. */
 
140
/* A temporary macro for simplifying the old code change. */
 
141
#define READ_SFNTS(pfont, pos, length, buf)\
 
142
  BEGIN\
 
143
    if (length > sizeof(buf))\
 
144
        return_error(gs_error_unregistered);/* Must not happen. */\
 
145
    code = gs_type42_read_data(pfont, (ulong)(pos), length, buf);\
 
146
    if ( code < 0 ) return code;\
 
147
  END
 
148
 
 
149
#define MAX_NUM_TT_TABLES 40
 
150
 
 
151
/* Append the outline of a TrueType character to a path. */
 
152
int gs_type42_append(uint glyph_index, gs_state * pgs,
 
153
                 gx_path * ppath, gs_text_enum_t *penum, gs_font *pfont,
 
154
                 bool charpath_flag);
 
155
 
 
156
/* Get the metrics of a TrueType character. */
 
157
int gs_type42_get_metrics(gs_font_type42 * pfont, uint glyph_index,
 
158
                          float psbw[4]);
 
159
 
 
160
int gs_type42_get_outline_from_TT_file(gs_font_type42 * pfont, stream *s, uint glyph_index,
 
161
                gs_glyph_data_t *pgd);
 
162
 
 
163
/* Export the font procedures so they can be called from the interpreter. */
 
164
font_proc_enumerate_glyph(gs_type42_enumerate_glyph);
 
165
font_proc_glyph_info(gs_type42_glyph_info);
 
166
font_proc_glyph_outline(gs_type42_glyph_outline);
 
167
 
 
168
/* Get glyph info by glyph index. */
 
169
int gs_type42_glyph_info_by_gid(gs_font *font, gs_glyph glyph, const gs_matrix *pmat,
 
170
                     int members, gs_glyph_info_t *info, uint glyph_index);
 
171
 
 
172
int gs_type42_font_info(gs_font *font, const gs_point *pscale, int members,
 
173
           gs_font_info_t *info);
 
174
int gs_truetype_font_info(gs_font *font, const gs_point *pscale, int members,
 
175
           gs_font_info_t *info);
 
176
 
 
177
uint gs_type42_substitute_glyph_index_vertical(gs_font_type42 *pfont, uint glyph_index,
 
178
                                          int WMode, gs_glyph glyph);
 
179
#endif /* gxfont42_INCLUDED */