xref: /plan9/sys/src/cmd/gs/src/gscencs.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
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: gscencs.h,v 1.5 2003/10/23 09:49:31 igor Exp $ */
18 /* Compact C representation of built-in encodings */
19 
20 #ifndef gscencs_INCLUDED
21 #  define gscencs_INCLUDED
22 
23 #include "stdpre.h"
24 #include "gstypes.h"
25 #include "gsccode.h"
26 
27 /*
28  * This file defines an interface to a compact C representation of the
29  * built-in encodings.  This representation is currently used only by
30  * pdfwrite, but the PostScript interpreter could in principle use it too.
31  *
32  * This representation uses its own private numbering system for glyphs.
33  * gs_c_known_encode returns one of these private glyph numbers;
34  * gs_c_glyph_name converts a private glyph number to a string.
35  * For more information about glyph numbering, see gsccode.h.
36  *
37  * The data file for this representation, gscedata.c, is generated by a
38  * PostScript program, encs2c.ps.  If the representation changes, this file
39  * (src/gscencs.h), gscencs.c, and lib/encs2c.ps must be kept consistent.
40  */
41 
42 /*
43  * Define the minimum gs_glyph value for glyphs in these encodings.
44  * gs_glyph values from this value through gs_min_cid_glyph - 1 are reserved.
45  */
46 extern const gs_glyph gs_c_min_std_encoding_glyph;
47 
48 /*
49  * Encode a character in a known encoding.  The only use for glyph numbers
50  * returned by this procedure is to pass them to gs_c_glyph_name.
51  */
52 gs_glyph gs_c_known_encode(gs_char chr, int encoding_index);
53 
54 /*
55  * Decode a gs_c_glyph_name glyph with a known encoding.
56  */
57 gs_char gs_c_decode(gs_glyph glyph, int ei);
58 
59 /*
60  * Convert a glyph number returned by gs_c_known_encode to a string.
61  */
62 int gs_c_glyph_name(gs_glyph glyph, gs_const_string *pstr);
63 
64 /*
65  * Test whether a string is one that was returned by gs_c_glyph_name.
66  */
67 bool gs_is_c_glyph_name(const byte *str, uint len);
68 
69 /*
70  * Return the glyph number corresponding to a string (the inverse of
71  * gs_c_glyph_name), or GS_NO_GLYPH if the glyph name is not known.
72  */
73 gs_glyph gs_c_name_glyph(const byte *str, uint len);
74 
75 #endif /* gscencs_INCLUDED */
76