Coverage Report

Created: 2022-10-31 07:00

/src/ghostpdl/psi/zfont32.c
Line
Count
Source (jump to first uncovered line)
1
/* Copyright (C) 2001-2021 Artifex Software, Inc.
2
   All Rights Reserved.
3
4
   This software is provided AS-IS with no warranty, either express or
5
   implied.
6
7
   This software is distributed under license and may not be copied,
8
   modified or distributed except as expressly authorized under the terms
9
   of the license contained in the file LICENSE in this distribution.
10
11
   Refer to licensing information at http://www.artifex.com or contact
12
   Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13
   CA 94945, U.S.A., +1(415)492-9861, for further information.
14
*/
15
16
17
/* Type 32 font operators */
18
#include "ghost.h"
19
#include "oper.h"
20
#include "gsccode.h"    /* for gxfont.h */
21
#include "gsmatrix.h"
22
#include "gsutil.h"
23
#include "gxfont.h"
24
#include "gxtext.h"
25
#include "bfont.h"
26
#include "store.h"
27
#include "ichar.h"
28
29
/* The encode_char procedure of a Type 32 font should never be called. */
30
static gs_glyph
31
zfont_no_encode_char(gs_font *pfont, gs_char chr, gs_glyph_space_t ignored)
32
0
{
33
0
    return GS_NO_GLYPH;
34
0
}
35
36
/* <string|name> <font_dict> .buildfont32 <string|name> <font> */
37
/* Build a type 32 (bitmap) font. */
38
static int
39
zbuildfont32(i_ctx_t *i_ctx_p)
40
6
{
41
6
    os_ptr op = osp;
42
6
    int code;
43
6
    build_proc_refs build;
44
6
    gs_font_base *pfont;
45
46
6
    check_type(*op, t_dictionary);
47
0
    code = build_proc_name_refs(imemory, &build, NULL, "%Type32BuildGlyph");
48
0
    if (code < 0)
49
0
        return code;
50
0
    code = build_gs_simple_font(i_ctx_p, op, &pfont, ft_CID_bitmap,
51
0
                                &st_gs_font_base, &build,
52
0
                                bf_Encoding_optional);
53
0
    if (code < 0)
54
0
        return code;
55
    /* Always transform cached bitmaps. */
56
0
    pfont->BitmapWidths = true;
57
0
    pfont->ExactSize = fbit_transform_bitmaps;
58
0
    pfont->InBetweenSize = fbit_transform_bitmaps;
59
0
    pfont->TransformedChar = fbit_transform_bitmaps;
60
    /* The encode_char procedure of a Type 32 font */
61
    /* should never be called. */
62
0
    pfont->procs.encode_char = zfont_no_encode_char;
63
0
    return define_gs_font(i_ctx_p, (gs_font *) pfont);
64
0
}
65
66
/* - .getshowoperator <oper|null> */
67
/* Get the calling operator for error reporting in %Type32BuildGlyph */
68
static int
69
zgetshowoperator(i_ctx_t *i_ctx_p)
70
0
{
71
0
    os_ptr op = osp;
72
0
    gs_text_enum_t *osenum = op_show_find(i_ctx_p);
73
74
0
    push(1);
75
0
    if (osenum == NULL)
76
0
        make_null(op);
77
0
    else {
78
0
        op_proc_t proc;
79
0
        *(void **)&proc = osenum->enum_client_data;
80
0
        make_oper(op, 0, proc);
81
0
    }
82
0
    return 0;
83
0
}
84
85
/* ------ Initialization procedure ------ */
86
87
const op_def zfont32_op_defs[] =
88
{
89
    {"2.buildfont32", zbuildfont32},
90
    {"0.getshowoperator", zgetshowoperator},
91
    op_def_end(0)
92
};