1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
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.
14
/* $Id: gxfcid.h 8022 2007-06-05 22:23:38Z giles $ */
15
/* Definitions for CID-keyed fonts */
17
#ifndef gxfcid_INCLUDED
18
# define gxfcid_INCLUDED
20
#include "gxcid.h" /* for CIDSystemInfo */
24
/* ---------------- Structures ---------------- */
27
* Define the data common to CIDFontType 0 (FontType 9, analogous to 1)
28
* and 2 (FontType 11, analogous to 42).
31
typedef struct gs_font_cid_data_s {
32
gs_cid_system_info_t CIDSystemInfo;
34
int GDBytes; /* optional, for standard glyph_data */
36
/*float StrokeWidth;*/
39
extern_st(st_gs_font_cid_data);
40
#define public_st_gs_font_cid_data() /* in gsfcid.c */\
41
gs_public_st_suffix_add0_final(st_gs_font_cid_data,\
42
gs_font_cid_data, "gs_font_cid_data",\
43
font_cid_data_enum_ptrs, font_cid_data_reloc_ptrs,\
44
gs_font_finalize, st_cid_system_info)
45
#define st_gs_font_cid_data_num_ptrs\
46
st_cid_system_info_num_ptrs
49
* Define the structures for CIDFontType 0, 1, and 2 fonts. In principle,
50
* each of these should be in its own header file, but they're so small
51
* that we include them here.
54
/* CIDFontType 0 references an array of (partial) FontType 1 fonts. */
56
#ifndef gs_font_type1_DEFINED
57
# define gs_font_type1_DEFINED
58
typedef struct gs_font_type1_s gs_font_type1;
61
#ifndef gs_font_cid0_DEFINED
62
# define gs_font_cid0_DEFINED
63
typedef struct gs_font_cid0_s gs_font_cid0;
67
typedef struct gs_font_cid0_data_s {
68
gs_font_cid_data common;
69
ulong CIDMapOffset; /* optional, for standard glyph_data */
70
gs_font_type1 **FDArray;
72
int FDBytes; /* optional, for standard glyph_data */
74
* The third argument of glyph_data may be NULL if only the font number
77
int (*glyph_data)(gs_font_base *, gs_glyph, gs_glyph_data_t *, int *);
80
struct gs_font_cid0_s {
82
gs_font_cid0_data cidata;
85
extern_st(st_gs_font_cid0);
86
#define public_st_gs_font_cid0() /* in gsfcid.c */\
87
gs_public_st_composite_use_final(st_gs_font_cid0,\
88
gs_font_cid0, "gs_font_cid0",\
89
font_cid0_enum_ptrs, font_cid0_reloc_ptrs, gs_font_finalize)
90
#define st_gs_font_cid0_max_ptrs\
91
(st_gs_font_max_ptrs + st_gs_font_cid_data_num_ptrs + 2)
93
/* Define a GC descriptor for allocating FDArray. */
94
extern_st(st_gs_font_type1_ptr_element); /* in gsfcid.c */
96
/* CIDFontType 1 doesn't reference any additional structures. */
98
typedef struct gs_font_cid1_data_s {
99
gs_cid_system_info_t CIDSystemInfo;
101
typedef struct gs_font_cid1_s {
103
gs_font_cid1_data cidata;
106
extern_st(st_gs_font_cid1);
107
#define public_st_gs_font_cid1() /* in gsfcid.c */\
108
gs_public_st_composite_use_final(st_gs_font_cid1,\
109
gs_font_cid1, "gs_font_cid1",\
110
font_cid1_enum_ptrs, font_cid1_reloc_ptrs, gs_font_finalize)
111
#define st_gs_font_cid1_max_ptrs\
112
(st_gs_font_max_ptrs + st_cid_system_info_num_ptrs)
114
/* CIDFontType 2 is a subclass of FontType 42. */
116
#ifndef gs_font_cid2_DEFINED
117
# define gs_font_cid2_DEFINED
118
typedef struct gs_font_cid2_s gs_font_cid2;
120
typedef struct gs_font_cid2_data_s {
121
gs_font_cid_data common;
123
int (*CIDMap_proc)(gs_font_cid2 *, gs_glyph);
125
* "Wrapper" get_outline and glyph_info procedures are needed, to
126
* handle MetricsCount. Save the original ones here.
129
int (*get_outline)(gs_font_type42 *, uint, gs_glyph_data_t *);
130
int (*get_metrics)(gs_font_type42 *, uint, gs_type42_metrics_options_t,
131
float * /* See comment for gs_type42_default_get_metrics. */);
134
struct gs_font_cid2_s {
135
gs_font_type42_common;
136
gs_font_cid2_data cidata;
139
extern_st(st_gs_font_cid2);
140
#define public_st_gs_font_cid2() /* in gsfcid.c */\
141
gs_public_st_composite_use_final(st_gs_font_cid2,\
142
gs_font_cid2, "gs_font_cid2",\
143
font_cid2_enum_ptrs, font_cid2_reloc_ptrs, gs_font_finalize)
144
#define st_gs_font_cid2_max_ptrs\
145
(st_gs_font_type42_max_ptrs + st_gs_font_cid_data_num_ptrs)
147
/* ---------------- Procedures ---------------- */
150
* Get the CIDSystemInfo of a font. If the font is not a CIDFont,
153
const gs_cid_system_info_t *gs_font_cid_system_info(const gs_font *);
156
* Provide a default enumerate_glyph procedure for CIDFontType 0 fonts.
157
* Built for simplicity, not for speed.
159
font_proc_enumerate_glyph(gs_font_cid0_enumerate_glyph);
162
* Check CIDSystemInfo compatibility.
164
bool gs_is_CIDSystemInfo_compatible(const gs_cid_system_info_t *info0,
165
const gs_cid_system_info_t *info1);
167
/* Return the font from the FDArray at the given index */
168
const gs_font *gs_cid0_indexed_font(const gs_font *, int);
170
/* Check whether a CID font has a Type 2 subfont. */
171
bool gs_cid0_has_type2(const gs_font *font);
173
#endif /* gxfcid_INCLUDED */