2 |
- |
1 |
/* Copyright (C) 1989, 1995, 1997, 1998, 1999 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: gxchar.h,v 1.14 2003/08/11 19:14:07 igor Exp $ */
|
|
|
18 |
/* Internal character definition for Ghostscript library */
|
|
|
19 |
/* Requires gsmatrix.h, gxfixed.h */
|
|
|
20 |
|
|
|
21 |
#ifndef gxchar_INCLUDED
|
|
|
22 |
# define gxchar_INCLUDED
|
|
|
23 |
|
|
|
24 |
#include "gschar.h"
|
|
|
25 |
#include "gxtext.h"
|
|
|
26 |
|
|
|
27 |
/* The type of cached characters is opaque. */
|
|
|
28 |
#ifndef cached_char_DEFINED
|
|
|
29 |
# define cached_char_DEFINED
|
|
|
30 |
typedef struct cached_char_s cached_char;
|
|
|
31 |
#endif
|
|
|
32 |
|
|
|
33 |
/* The type of cached font/matrix pairs is opaque. */
|
|
|
34 |
#ifndef cached_fm_pair_DEFINED
|
|
|
35 |
# define cached_fm_pair_DEFINED
|
|
|
36 |
typedef struct cached_fm_pair_s cached_fm_pair;
|
|
|
37 |
#endif
|
|
|
38 |
|
|
|
39 |
/* The type of font objects is opaque. */
|
|
|
40 |
#ifndef gs_font_DEFINED
|
|
|
41 |
# define gs_font_DEFINED
|
|
|
42 |
typedef struct gs_font_s gs_font;
|
|
|
43 |
#endif
|
|
|
44 |
|
|
|
45 |
/* The type of text enum objects is opaque. */
|
|
|
46 |
#ifndef gs_text_enum_DEFINED
|
|
|
47 |
# define gs_text_enum_DEFINED
|
|
|
48 |
typedef struct gs_text_enum_s gs_text_enum_t;
|
|
|
49 |
#endif
|
|
|
50 |
|
|
|
51 |
/* The types of memory and null devices may be opaque. */
|
|
|
52 |
#ifndef gx_device_memory_DEFINED
|
|
|
53 |
# define gx_device_memory_DEFINED
|
|
|
54 |
typedef struct gx_device_memory_s gx_device_memory;
|
|
|
55 |
#endif
|
|
|
56 |
#ifndef gx_device_null_DEFINED
|
|
|
57 |
# define gx_device_null_DEFINED
|
|
|
58 |
typedef struct gx_device_null_s gx_device_null;
|
|
|
59 |
#endif
|
|
|
60 |
|
|
|
61 |
/* An enumeration object for string display. */
|
|
|
62 |
typedef enum {
|
|
|
63 |
sws_none,
|
|
|
64 |
sws_cache, /* setcachedevice[2] */
|
|
|
65 |
sws_no_cache, /* setcharwidth */
|
|
|
66 |
sws_cache_width_only, /* setcharwidth for xfont char */
|
|
|
67 |
sws_retry /* retry setcachedevice[2] */
|
|
|
68 |
} show_width_status;
|
|
|
69 |
struct gs_show_enum_s {
|
|
|
70 |
/* Put this first for subclassing. */
|
|
|
71 |
gs_text_enum_common; /* (procs, text, index) */
|
|
|
72 |
/* Following are set at creation time */
|
|
|
73 |
bool auto_release; /* true if old API, false if new */
|
|
|
74 |
gs_state *pgs;
|
|
|
75 |
int level; /* save the level of pgs */
|
|
|
76 |
gs_char_path_mode charpath_flag;
|
|
|
77 |
gs_state *show_gstate; /* for setting pgs->show_gstate */
|
|
|
78 |
/* at returns/callouts */
|
|
|
79 |
int can_cache; /* -1 if can't use cache at all, */
|
|
|
80 |
/* 0 if can read but not load, */
|
|
|
81 |
/* 1 if can read and load */
|
|
|
82 |
gs_int_rect ibox; /* int version of quick-check */
|
|
|
83 |
/* (inner) clipping box */
|
|
|
84 |
gs_int_rect obox; /* int version of (outer) clip box */
|
|
|
85 |
int ftx, fty; /* transformed font translation */
|
|
|
86 |
/* Following are updated dynamically */
|
|
|
87 |
gs_glyph (*encode_char)(gs_font *, gs_char, gs_glyph_space_t); /* copied from font */
|
|
|
88 |
gs_log2_scale_point fapi_log2_scale; /* scaling factors for oversampling with FAPI, -1 = not valid */
|
|
|
89 |
gs_point fapi_glyph_shift; /* glyph shift for FAPI-handled font */
|
|
|
90 |
gx_device_memory *dev_cache; /* cache device */
|
|
|
91 |
gx_device_memory *dev_cache2; /* underlying alpha memory device, */
|
|
|
92 |
/* if dev_cache is an alpha buffer */
|
|
|
93 |
gx_device_null *dev_null; /* null device for stringwidth */
|
|
|
94 |
/*uint index; */ /* index within string */
|
|
|
95 |
/*uint xy_index;*/ /* index within X/Y widths */
|
|
|
96 |
/*gs_char returned.current_char;*/ /* current char for render or move */
|
|
|
97 |
/*gs_glyph returned.current_glyph;*/ /* current glyph ditto */
|
|
|
98 |
gs_fixed_point wxy; /* width of current char */
|
|
|
99 |
/* in device coords */
|
|
|
100 |
gs_fixed_point origin; /* unrounded origin of current char */
|
|
|
101 |
/* in device coords, needed for */
|
|
|
102 |
/* charpath and WMode=1 */
|
|
|
103 |
cached_char *cc; /* being accumulated */
|
|
|
104 |
/*gs_point returned.total_width;*/ /* total width of string, set at end */
|
|
|
105 |
show_width_status width_status;
|
|
|
106 |
/*gs_log2_scale_point log2_scale;*/
|
|
|
107 |
int (*continue_proc) (gs_show_enum *); /* continuation procedure */
|
|
|
108 |
};
|
|
|
109 |
#define gs_show_enum_s_DEFINED
|
|
|
110 |
/* The structure descriptor is public for gschar.c. */
|
|
|
111 |
#define public_st_gs_show_enum() /* in gxchar.c */\
|
|
|
112 |
gs_public_st_composite(st_gs_show_enum, gs_show_enum, "gs_show_enum",\
|
|
|
113 |
show_enum_enum_ptrs, show_enum_reloc_ptrs)
|
|
|
114 |
|
|
|
115 |
/* Get the current character code. */
|
|
|
116 |
int gx_current_char(const gs_text_enum_t * pte);
|
|
|
117 |
|
|
|
118 |
/* Cached character procedures (in gxccache.c and gxccman.c) */
|
|
|
119 |
#ifndef gs_font_dir_DEFINED
|
|
|
120 |
# define gs_font_dir_DEFINED
|
|
|
121 |
typedef struct gs_font_dir_s gs_font_dir;
|
|
|
122 |
|
|
|
123 |
#endif
|
|
|
124 |
cached_char *
|
|
|
125 |
gx_alloc_char_bits(gs_font_dir *, gx_device_memory *, gx_device_memory *, ushort, ushort, const gs_log2_scale_point *, int);
|
|
|
126 |
void gx_open_cache_device(gx_device_memory *, cached_char *);
|
|
|
127 |
void gx_free_cached_char(gs_font_dir *, cached_char *);
|
|
|
128 |
void gx_add_cached_char(gs_font_dir *, gx_device_memory *, cached_char *, cached_fm_pair *, const gs_log2_scale_point *);
|
|
|
129 |
void gx_add_char_bits(gs_font_dir *, cached_char *, const gs_log2_scale_point *);
|
|
|
130 |
cached_char *
|
|
|
131 |
gx_lookup_cached_char(const gs_font *, const cached_fm_pair *, gs_glyph, int, int, gs_fixed_point *);
|
|
|
132 |
cached_char *
|
|
|
133 |
gx_lookup_xfont_char(const gs_state *, cached_fm_pair *, gs_char, gs_glyph, int);
|
|
|
134 |
int gx_image_cached_char(gs_show_enum *, cached_char *);
|
|
|
135 |
void gx_compute_text_oversampling(const gs_show_enum * penum, const gs_font *pfont,
|
|
|
136 |
int alpha_bits, gs_log2_scale_point *p_log2_scale);
|
|
|
137 |
int set_char_width(gs_show_enum *penum, gs_state *pgs, floatp wx, floatp wy);
|
|
|
138 |
int gx_default_text_restore_state(gs_text_enum_t *pte);
|
|
|
139 |
int gx_hld_stringwidth_begin(gs_imager_state * pis, gx_path **path);
|
|
|
140 |
|
|
|
141 |
#endif /* gxchar_INCLUDED */
|