xref: /plan9/sys/src/cmd/gs/src/bfont.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1992, 1995, 1996, 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: bfont.h,v 1.10 2004/08/04 19:36:12 stefan Exp $ */
18 /* Interpreter internal routines and data needed for building fonts */
19 /* Requires gxfont.h */
20 
21 #ifndef bfont_INCLUDED
22 #  define bfont_INCLUDED
23 
24 #include "ifont.h"
25 
26 /* In zfont.c */
27 int add_FID(i_ctx_t *i_ctx_p, ref *pfdict, gs_font *pfont,
28 	    gs_ref_memory_t *imem);
29 
30 font_proc_make_font(zdefault_make_font);
31 font_proc_make_font(zbase_make_font);
32 /* The global font directory */
33 extern gs_font_dir *ifont_dir;
34 
35 /* Structure for passing BuildChar and BuildGlyph procedures. */
36 typedef struct build_proc_refs_s {
37     ref BuildChar;
38     ref BuildGlyph;
39 } build_proc_refs;
40 
41 /* Options for collecting parameters from a font dictionary. */
42 /* The comment indicates where the option is tested. */
43 typedef enum {
44     bf_options_none = 0,
45     bf_Encoding_optional = 1,	/* build_gs_font */
46     bf_UniqueID_ignored = 4,	/* build_gs_simple_font */
47     bf_CharStrings_optional = 8,	/* build_gs_primitive_font */
48     bf_notdef_required = 16	/* build_gs_primitive_font */
49 } build_font_options_t;
50 
51 /* In zbfont.c */
52 int build_proc_name_refs(const gs_memory_t *mem,
53 			 build_proc_refs * pbuild,
54 			 const char *bcstr, const char *bgstr);
55 int build_gs_font_procs(os_ptr, build_proc_refs *);
56 #define BUILD_BASE_FONT_PROC(proc)\
57   int proc(i_ctx_t *, os_ptr, gs_font_base **, font_type,\
58 	   gs_memory_type_ptr_t, const build_proc_refs *,\
59 	   build_font_options_t)
60 typedef BUILD_BASE_FONT_PROC((*build_base_font_proc_t));
61 BUILD_BASE_FONT_PROC(build_gs_primitive_font);
62 int build_gs_FDArray_font(i_ctx_t *, /*const*/ ref *, gs_font_base **,
63 			  font_type, gs_memory_type_ptr_t,
64 			  const build_proc_refs *);
65 int build_gs_outline_font(i_ctx_t *, os_ptr, gs_font_base **, font_type,
66 			  gs_memory_type_ptr_t, const build_proc_refs *,
67 			  build_font_options_t, build_base_font_proc_t);
68 BUILD_BASE_FONT_PROC(build_gs_simple_font);
69 void init_gs_simple_font(gs_font_base *pfont, const double bbox[4],
70 			 const gs_uid *puid);
71 void lookup_gs_simple_font_encoding(gs_font_base *);
72 int build_gs_font(i_ctx_t *, os_ptr, gs_font **, font_type,
73 		  gs_memory_type_ptr_t, const build_proc_refs *,
74 		  build_font_options_t);
75 int build_gs_sub_font(i_ctx_t *, const ref *, gs_font **,
76 		      font_type, gs_memory_type_ptr_t,
77 		      const build_proc_refs *, const ref *, ref *);
78 int define_gs_font(gs_font *);
79 void get_font_name(const gs_memory_t *mem, ref *pfname, const ref *op);
80 void copy_font_name(gs_font_name * pfstr, const ref * pfname);
81 gs_glyph zfont_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t ignored);
82 gs_char gs_font_map_glyph_to_unicode(gs_font *font, gs_glyph glyph);
83 const ref *zfont_get_to_unicode_map(gs_font_dir *dir);
84 
85 #endif /* bfont_INCLUDED */
86