Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 2002 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: gxfcmap1.h,v 1.1 2002/04/08 21:02:44 lpd Exp $ */
18
/* Adobe CMapType 1 CMap structure definitions */
19
 
20
#ifndef gxfcmap1_INCLUDED
21
#  define gxfcmap1_INCLUDED
22
 
23
#include "gxfcmap.h"
24
 
25
/*
26
 * This is the concrete subclass of gs_cmap_t that directly implements
27
 * the Adobe CMapType 1/2 specification.
28
 *
29
 * In this implementation, the two maps (defs and notdefs) each consist of
30
 * two separate parts:
31
 *
32
 *	- A key map, which maps a parsed character to an index in a value
33
 *	table.
34
 *
35
 *	- A value table in which each entry specifies a string, a name, or a
36
 *	CID, as described in gxfcmap.h.
37
 *
38
 * We separate the value tables from the key maps so that large, closely
39
 * related CMaps such as UniCNS-UCS2-H and UniCNS-UTF8-H can (someday)
40
 * share the value tables but not the code space or key maps.
41
 */
42
typedef struct gs_cmap_adobe1_s gs_cmap_adobe1_t;
43
 
44
/*
45
 * To save space in lookup tables, all keys within each lookup range share
46
 * a prefix (which may be empty).
47
 *
48
 * The strings in this structure are all const after initialization.
49
 */
50
typedef struct gx_cmap_lookup_range_s {
51
    gs_cmap_adobe1_t *cmap;	/* back pointer for glyph marking */
52
    int num_entries;
53
    /* Keys */
54
    byte key_prefix[MAX_CMAP_CODE_SIZE];
55
    int key_prefix_size;	/* 0 .. MAX_CMAP_CODE_SIZE */
56
    int key_size;		/* 0 .. MAX_CMAP_CODE_SIZE - key_prefix_s' */
57
    bool key_is_range;
58
    gs_string keys;		/* [num_entries * key_size * (key_is_range+1)] */
59
    /* Values */
60
    gx_cmap_code_value_type_t value_type;
61
    int value_size;		/* bytes per value */
62
    gs_string values;		/* [num_entries * value_size] */
63
    int font_index;
64
} gx_cmap_lookup_range_t;
65
/*
66
 * The GC descriptor for lookup ranges is complex, because it must mark
67
 * names.
68
 */
69
extern_st(st_cmap_lookup_range_element);
70
#define public_st_cmap_lookup_range() /* in gsfcmap.c */\
71
  gs_public_st_composite(st_cmap_lookup_range, gx_cmap_lookup_range_t,\
72
    "gx_cmap_lookup_range_t", cmap_lookup_range_enum_ptrs,\
73
    cmap_lookup_range_reloc_ptrs)
74
#define public_st_cmap_lookup_range_element() /* in gsfcmap.c */\
75
  gs_public_st_element(st_cmap_lookup_range_element, gx_cmap_lookup_range_t,\
76
    "gx_cmap_lookup_range_t[]", cmap_lookup_range_elt_enum_ptrs,\
77
    cmap_lookup_range_elt_reloc_ptrs, st_cmap_lookup_range)
78
 
79
/*
80
 * The main body of data in a CMap is two code maps, one for defined
81
 * characters, one for notdefs.
82
 */
83
typedef struct gx_code_space_s {
84
    gx_code_space_range_t *ranges;
85
    int num_ranges;
86
} gx_code_space_t;
87
typedef struct gx_code_map_s {
88
    gx_cmap_lookup_range_t *lookup;
89
    int num_lookup;
90
} gx_code_map_t;
91
struct gs_cmap_adobe1_s {
92
    GS_CMAP_COMMON;
93
    gx_code_space_t code_space;
94
    gx_code_map_t def;		/* defined characters */
95
    gx_code_map_t notdef;	/* notdef characters */
96
    gs_glyph_mark_proc_t mark_glyph;	/* glyph marking procedure for GC */
97
    void *mark_glyph_data;	/* closure data */
98
};
99
 
100
extern_st(st_cmap_adobe1);
101
#define public_st_cmap_adobe1()	/* in gsfcmap1.c */\
102
  gs_public_st_suffix_add4(st_cmap_adobe1, gs_cmap_adobe1_t,\
103
    "gs_cmap_adobe1_t", cmap_adobe1_enum_ptrs, cmap_adobe1_reloc_ptrs,\
104
    st_cmap,\
105
    code_space.ranges, def.lookup, notdef.lookup, mark_glyph_data)
106
 
107
/* ---------------- Procedures ---------------- */
108
 
109
/*
110
 * Allocate and initialize an Adobe1 CMap.  The caller must still fill in
111
 * the code space ranges, lookup tables, keys, and values.
112
 */
113
int gs_cmap_adobe1_alloc(gs_cmap_adobe1_t **ppcmap, int wmode,
114
			 const byte *map_name, uint name_size,
115
			 uint num_fonts, uint num_ranges, uint num_lookups,
116
			 uint keys_size, uint values_size,
117
			 const gs_cid_system_info_t *pcidsi, gs_memory_t *mem);
118
 
119
#endif /* gxfcmap1_INCLUDED */