1 /* Copyright (C) 1997, 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: zfont32.c,v 1.5 2004/08/04 19:36:13 stefan Exp $ */
18 /* Type 32 font operators */
19 #include "ghost.h"
20 #include "oper.h"
21 #include "gsccode.h" /* for gxfont.h */
22 #include "gsmatrix.h"
23 #include "gsutil.h"
24 #include "gxfont.h"
25 #include "bfont.h"
26 #include "store.h"
27
28 /* The encode_char procedure of a Type 32 font should never be called. */
29 private gs_glyph
zfont_no_encode_char(gs_font * pfont,gs_char chr,gs_glyph_space_t ignored)30 zfont_no_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t ignored)
31 {
32 return gs_no_glyph;
33 }
34
35 /* <string|name> <font_dict> .buildfont32 <string|name> <font> */
36 /* Build a type 32 (bitmap) font. */
37 private int
zbuildfont32(i_ctx_t * i_ctx_p)38 zbuildfont32(i_ctx_t *i_ctx_p)
39 {
40 os_ptr op = osp;
41 int code;
42 build_proc_refs build;
43 gs_font_base *pfont;
44
45 check_type(*op, t_dictionary);
46 code = build_proc_name_refs(imemory, &build, NULL, "%Type32BuildGlyph");
47 if (code < 0)
48 return code;
49 code = build_gs_simple_font(i_ctx_p, op, &pfont, ft_CID_bitmap,
50 &st_gs_font_base, &build,
51 bf_Encoding_optional);
52 if (code < 0)
53 return code;
54 /* Always transform cached bitmaps. */
55 pfont->BitmapWidths = true;
56 pfont->ExactSize = fbit_transform_bitmaps;
57 pfont->InBetweenSize = fbit_transform_bitmaps;
58 pfont->TransformedChar = fbit_transform_bitmaps;
59 /* The encode_char procedure of a Type 32 font */
60 /* should never be called. */
61 pfont->procs.encode_char = zfont_no_encode_char;
62 return define_gs_font((gs_font *) pfont);
63 }
64
65 /* ------ Initialization procedure ------ */
66
67 const op_def zfont32_op_defs[] =
68 {
69 {"2.buildfont32", zbuildfont32},
70 op_def_end(0)
71 };
72