2 |
- |
1 |
/* Copyright (C) 2000, 2001 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: gxfcid.h,v 1.14 2005/01/13 16:58:07 igor Exp $ */
|
|
|
18 |
/* Definitions for CID-keyed fonts */
|
|
|
19 |
|
|
|
20 |
#ifndef gxfcid_INCLUDED
|
|
|
21 |
# define gxfcid_INCLUDED
|
|
|
22 |
|
|
|
23 |
#include "gxcid.h" /* for CIDSystemInfo */
|
|
|
24 |
#include "gxfont.h"
|
|
|
25 |
#include "gxfont42.h"
|
|
|
26 |
|
|
|
27 |
/* ---------------- Structures ---------------- */
|
|
|
28 |
|
|
|
29 |
/*
|
|
|
30 |
* Define the data common to CIDFontType 0 (FontType 9, analogous to 1)
|
|
|
31 |
* and 2 (FontType 11, analogous to 42).
|
|
|
32 |
*/
|
|
|
33 |
#define MAX_GDBytes 4
|
|
|
34 |
typedef struct gs_font_cid_data_s {
|
|
|
35 |
gs_cid_system_info_t CIDSystemInfo;
|
|
|
36 |
int CIDCount;
|
|
|
37 |
int GDBytes; /* optional, for standard glyph_data */
|
|
|
38 |
/*int PaintType;*/
|
|
|
39 |
/*float StrokeWidth;*/
|
|
|
40 |
} gs_font_cid_data;
|
|
|
41 |
|
|
|
42 |
extern_st(st_gs_font_cid_data);
|
|
|
43 |
#define public_st_gs_font_cid_data() /* in gsfcid.c */\
|
|
|
44 |
gs_public_st_suffix_add0_final(st_gs_font_cid_data,\
|
|
|
45 |
gs_font_cid_data, "gs_font_cid_data",\
|
|
|
46 |
font_cid_data_enum_ptrs, font_cid_data_reloc_ptrs,\
|
|
|
47 |
gs_font_finalize, st_cid_system_info)
|
|
|
48 |
#define st_gs_font_cid_data_num_ptrs\
|
|
|
49 |
st_cid_system_info_num_ptrs
|
|
|
50 |
|
|
|
51 |
/*
|
|
|
52 |
* Define the structures for CIDFontType 0, 1, and 2 fonts. In principle,
|
|
|
53 |
* each of these should be in its own header file, but they're so small
|
|
|
54 |
* that we include them here.
|
|
|
55 |
*/
|
|
|
56 |
|
|
|
57 |
/* CIDFontType 0 references an array of (partial) FontType 1 fonts. */
|
|
|
58 |
|
|
|
59 |
#ifndef gs_font_type1_DEFINED
|
|
|
60 |
# define gs_font_type1_DEFINED
|
|
|
61 |
typedef struct gs_font_type1_s gs_font_type1;
|
|
|
62 |
#endif
|
|
|
63 |
|
|
|
64 |
#ifndef gs_font_cid0_DEFINED
|
|
|
65 |
# define gs_font_cid0_DEFINED
|
|
|
66 |
typedef struct gs_font_cid0_s gs_font_cid0;
|
|
|
67 |
#endif
|
|
|
68 |
|
|
|
69 |
#define MAX_FDBytes 4
|
|
|
70 |
typedef struct gs_font_cid0_data_s {
|
|
|
71 |
gs_font_cid_data common;
|
|
|
72 |
ulong CIDMapOffset; /* optional, for standard glyph_data */
|
|
|
73 |
gs_font_type1 **FDArray;
|
|
|
74 |
uint FDArray_size;
|
|
|
75 |
int FDBytes; /* optional, for standard glyph_data */
|
|
|
76 |
/*
|
|
|
77 |
* The third argument of glyph_data may be NULL if only the font number
|
|
|
78 |
* is wanted.
|
|
|
79 |
*/
|
|
|
80 |
int (*glyph_data)(gs_font_base *, gs_glyph, gs_glyph_data_t *, int *);
|
|
|
81 |
void *proc_data;
|
|
|
82 |
} gs_font_cid0_data;
|
|
|
83 |
struct gs_font_cid0_s {
|
|
|
84 |
gs_font_base_common;
|
|
|
85 |
gs_font_cid0_data cidata;
|
|
|
86 |
};
|
|
|
87 |
|
|
|
88 |
extern_st(st_gs_font_cid0);
|
|
|
89 |
#define public_st_gs_font_cid0() /* in gsfcid.c */\
|
|
|
90 |
gs_public_st_composite_use_final(st_gs_font_cid0,\
|
|
|
91 |
gs_font_cid0, "gs_font_cid0",\
|
|
|
92 |
font_cid0_enum_ptrs, font_cid0_reloc_ptrs, gs_font_finalize)
|
|
|
93 |
#define st_gs_font_cid0_max_ptrs\
|
|
|
94 |
(st_gs_font_max_ptrs + st_gs_font_cid_data_num_ptrs + 2)
|
|
|
95 |
|
|
|
96 |
/* Define a GC descriptor for allocating FDArray. */
|
|
|
97 |
extern_st(st_gs_font_type1_ptr_element); /* in gsfcid.c */
|
|
|
98 |
|
|
|
99 |
/* CIDFontType 1 doesn't reference any additional structures. */
|
|
|
100 |
|
|
|
101 |
typedef struct gs_font_cid1_data_s {
|
|
|
102 |
gs_cid_system_info_t CIDSystemInfo;
|
|
|
103 |
} gs_font_cid1_data;
|
|
|
104 |
typedef struct gs_font_cid1_s {
|
|
|
105 |
gs_font_base_common;
|
|
|
106 |
gs_font_cid1_data cidata;
|
|
|
107 |
} gs_font_cid1;
|
|
|
108 |
|
|
|
109 |
extern_st(st_gs_font_cid1);
|
|
|
110 |
#define public_st_gs_font_cid1() /* in gsfcid.c */\
|
|
|
111 |
gs_public_st_composite_use_final(st_gs_font_cid1,\
|
|
|
112 |
gs_font_cid1, "gs_font_cid1",\
|
|
|
113 |
font_cid1_enum_ptrs, font_cid1_reloc_ptrs, gs_font_finalize)
|
|
|
114 |
#define st_gs_font_cid1_max_ptrs\
|
|
|
115 |
(st_gs_font_max_ptrs + st_cid_system_info_num_ptrs)
|
|
|
116 |
|
|
|
117 |
/* CIDFontType 2 is a subclass of FontType 42. */
|
|
|
118 |
|
|
|
119 |
#ifndef gs_font_cid2_DEFINED
|
|
|
120 |
# define gs_font_cid2_DEFINED
|
|
|
121 |
typedef struct gs_font_cid2_s gs_font_cid2;
|
|
|
122 |
#endif
|
|
|
123 |
typedef struct gs_font_cid2_data_s {
|
|
|
124 |
gs_font_cid_data common;
|
|
|
125 |
int MetricsCount;
|
|
|
126 |
int (*CIDMap_proc)(gs_font_cid2 *, gs_glyph);
|
|
|
127 |
/*
|
|
|
128 |
* "Wrapper" get_outline and glyph_info procedures are needed, to
|
|
|
129 |
* handle MetricsCount. Save the original ones here.
|
|
|
130 |
*/
|
|
|
131 |
struct o_ {
|
|
|
132 |
int (*get_outline)(gs_font_type42 *, uint, gs_glyph_data_t *);
|
|
|
133 |
int (*get_metrics)(gs_font_type42 *, uint, int, float [4]);
|
|
|
134 |
} orig_procs;
|
|
|
135 |
} gs_font_cid2_data;
|
|
|
136 |
struct gs_font_cid2_s {
|
|
|
137 |
gs_font_type42_common;
|
|
|
138 |
gs_font_cid2_data cidata;
|
|
|
139 |
};
|
|
|
140 |
|
|
|
141 |
extern_st(st_gs_font_cid2);
|
|
|
142 |
#define public_st_gs_font_cid2() /* in gsfcid.c */\
|
|
|
143 |
gs_public_st_composite_use_final(st_gs_font_cid2,\
|
|
|
144 |
gs_font_cid2, "gs_font_cid2",\
|
|
|
145 |
font_cid2_enum_ptrs, font_cid2_reloc_ptrs, gs_font_finalize)
|
|
|
146 |
#define st_gs_font_cid2_max_ptrs\
|
|
|
147 |
(st_gs_font_type42_max_ptrs + st_gs_font_cid_data_num_ptrs)
|
|
|
148 |
|
|
|
149 |
/* ---------------- Procedures ---------------- */
|
|
|
150 |
|
|
|
151 |
/*
|
|
|
152 |
* Get the CIDSystemInfo of a font. If the font is not a CIDFont,
|
|
|
153 |
* return NULL.
|
|
|
154 |
*/
|
|
|
155 |
const gs_cid_system_info_t *gs_font_cid_system_info(const gs_font *);
|
|
|
156 |
|
|
|
157 |
/*
|
|
|
158 |
* Provide a default enumerate_glyph procedure for CIDFontType 0 fonts.
|
|
|
159 |
* Built for simplicity, not for speed.
|
|
|
160 |
*/
|
|
|
161 |
font_proc_enumerate_glyph(gs_font_cid0_enumerate_glyph);
|
|
|
162 |
|
|
|
163 |
/*
|
|
|
164 |
* Check CIDSystemInfo compatibility.
|
|
|
165 |
*/
|
|
|
166 |
bool gs_is_CIDSystemInfo_compatible(const gs_cid_system_info_t *info0,
|
|
|
167 |
const gs_cid_system_info_t *info1);
|
|
|
168 |
|
|
|
169 |
/* Return the font from the FDArray at the given index */
|
|
|
170 |
const gs_font *gs_cid0_indexed_font(const gs_font *, int);
|
|
|
171 |
|
|
|
172 |
/* Check whether a CID font has a Type 2 subfont. */
|
|
|
173 |
bool gs_cid0_has_type2(const gs_font *font);
|
|
|
174 |
|
|
|
175 |
#endif /* gxfcid_INCLUDED */
|