/src/ghostpdl/pdf/pdf_font.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright (C) 2018-2022 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 | | /* Font operations for the PDF interpreter */ |
17 | | |
18 | | #include "pdf_font_types.h" |
19 | | #include "pdf_stack.h" |
20 | | |
21 | | #ifndef PDF_FONT_OPERATORS |
22 | | #define PDF_FONT_OPERATORS |
23 | | |
24 | | int pdfi_d0(pdf_context *ctx); |
25 | | int pdfi_d1(pdf_context *ctx); |
26 | | int pdfi_Tf(pdf_context *ctx, pdf_dict *stream_dict, pdf_dict *page_dict); |
27 | | int pdfi_free_font(pdf_obj *font); |
28 | | |
29 | | static inline void pdfi_countup_current_font(pdf_context *ctx) |
30 | 0 | { |
31 | 0 | pdf_font *font; |
32 | 0 |
|
33 | 0 | if (ctx->pgs->font != NULL) { |
34 | 0 | font = (pdf_font *)ctx->pgs->font->client_data; |
35 | 0 | pdfi_countup(font); |
36 | 0 | } |
37 | 0 | } Unexecuted instantiation: ghostpdf.c:pdfi_countup_current_font Unexecuted instantiation: pdf_int.c:pdfi_countup_current_font Unexecuted instantiation: pdf_gstate.c:pdfi_countup_current_font Unexecuted instantiation: pdf_annot.c:pdfi_countup_current_font Unexecuted instantiation: pdf_font.c:pdfi_countup_current_font Unexecuted instantiation: pdf_font0.c:pdfi_countup_current_font Unexecuted instantiation: pdf_font1.c:pdfi_countup_current_font Unexecuted instantiation: pdf_font1C.c:pdfi_countup_current_font Unexecuted instantiation: pdf_fontps.c:pdfi_countup_current_font Unexecuted instantiation: pdf_font3.c:pdfi_countup_current_font Unexecuted instantiation: pdf_fontTT.c:pdfi_countup_current_font Unexecuted instantiation: pdf_font11.c:pdfi_countup_current_font Unexecuted instantiation: pdf_text.c:pdfi_countup_current_font Unexecuted instantiation: pdf_obj.c:pdfi_countup_current_font Unexecuted instantiation: pdf_fapi.c:pdfi_countup_current_font |
38 | | |
39 | | static inline void pdfi_countdown_current_font(pdf_context *ctx) |
40 | 0 | { |
41 | 0 | pdf_font *font; |
42 | |
|
43 | 0 | if (ctx->pgs->font != NULL) { |
44 | 0 | font = (pdf_font *)ctx->pgs->font->client_data; |
45 | 0 | pdfi_countdown(font); |
46 | 0 | } |
47 | 0 | } Unexecuted instantiation: ghostpdf.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_int.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_gstate.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_annot.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_font.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_font0.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_font1.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_font1C.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_fontps.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_font3.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_fontTT.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_font11.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_text.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_obj.c:pdfi_countdown_current_font Unexecuted instantiation: pdf_fapi.c:pdfi_countdown_current_font |
48 | | |
49 | | static inline pdf_font *pdfi_get_current_pdf_font(pdf_context *ctx) |
50 | 14.6M | { |
51 | 14.6M | pdf_font *font; |
52 | | |
53 | 14.6M | if (ctx->pgs->font != NULL) { |
54 | 14.6M | font = (pdf_font *)ctx->pgs->font->client_data; |
55 | 14.6M | return(font); |
56 | 14.6M | } |
57 | 2.85k | return NULL; |
58 | 14.6M | } Unexecuted instantiation: ghostpdf.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_int.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_gstate.c:pdfi_get_current_pdf_font pdf_annot.c:pdfi_get_current_pdf_font Line | Count | Source | 50 | 14.4k | { | 51 | 14.4k | pdf_font *font; | 52 | | | 53 | 14.4k | if (ctx->pgs->font != NULL) { | 54 | 14.4k | font = (pdf_font *)ctx->pgs->font->client_data; | 55 | 14.4k | return(font); | 56 | 14.4k | } | 57 | 8 | return NULL; | 58 | 14.4k | } |
Unexecuted instantiation: pdf_font.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_font0.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_font1.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_font1C.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_fontps.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_font3.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_fontTT.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_font11.c:pdfi_get_current_pdf_font pdf_text.c:pdfi_get_current_pdf_font Line | Count | Source | 50 | 14.6M | { | 51 | 14.6M | pdf_font *font; | 52 | | | 53 | 14.6M | if (ctx->pgs->font != NULL) { | 54 | 14.5M | font = (pdf_font *)ctx->pgs->font->client_data; | 55 | 14.5M | return(font); | 56 | 14.5M | } | 57 | 2.84k | return NULL; | 58 | 14.6M | } |
Unexecuted instantiation: pdf_obj.c:pdfi_get_current_pdf_font Unexecuted instantiation: pdf_fapi.c:pdfi_get_current_pdf_font |
59 | | |
60 | | int pdfi_create_Widths(pdf_context *ctx, pdf_dict *font_dict, pdf_font *pdffont); |
61 | | int pdfi_create_Encoding(pdf_context *ctx, pdf_obj *pdf_Encoding, pdf_obj *font_Encoding, pdf_obj **Encoding); |
62 | | gs_glyph pdfi_encode_char(gs_font * pfont, gs_char chr, gs_glyph_space_t not_used); |
63 | | int pdfi_glyph_index(gs_font *pfont, byte *str, uint size, uint *glyph); |
64 | | int pdfi_glyph_name(gs_font * pfont, gs_glyph glyph, gs_const_string * pstr); |
65 | | int pdfi_tounicode_char_to_unicode(pdf_context *ctx, pdf_cmap *tounicode, gs_glyph glyph, int ch, ushort *unicode_return, unsigned int length); |
66 | | int pdfi_decode_glyph(gs_font * font, gs_glyph glyph, int ch, ushort *unicode_return, unsigned int length); |
67 | | |
68 | | /* This is in pdf_fapi.c, but since it is the only exported function |
69 | | from that module (so far) it doesn't seem worth a new header |
70 | | */ |
71 | | int pdfi_fapi_passfont(pdf_font *font, int subfont, char *fapi_request, |
72 | | char *file_name, byte * font_data, int font_data_len); |
73 | | |
74 | | int pdfi_fapi_check_cmap_for_GID(gs_font *pfont, uint c, uint *g); |
75 | | |
76 | | int pdfi_map_glyph_name_via_agl(pdf_dict *cstrings, pdf_name *gname, pdf_string **cstring); |
77 | | |
78 | | int pdfi_init_font_directory(pdf_context *ctx); |
79 | | |
80 | | int pdfi_load_font(pdf_context *ctx, pdf_dict *stream_dict, pdf_dict *page_dict, pdf_dict *font_dict, gs_font **ppfont, bool cidfont); |
81 | | |
82 | | int pdfi_load_dict_font(pdf_context *ctx, pdf_dict *stream_dict, pdf_dict *page_dict, pdf_dict *font_dict, double point_size); |
83 | | |
84 | | /* Loads a (should be!) non-embedded font by name |
85 | | Only currently works for the Type 1 font set from romfs. |
86 | | */ |
87 | | int pdfi_load_font_by_name_string(pdf_context *ctx, const byte *fontname, size_t length, pdf_obj **ppdffont); |
88 | | |
89 | | /* Convenience function for using fonts created by |
90 | | pdfi_load_font_by_name_string |
91 | | */ |
92 | | int pdfi_set_font_internal(pdf_context *ctx, pdf_obj *fontobj, double point_size); |
93 | | |
94 | | int pdfi_font_set_internal_string(pdf_context *ctx, const char *fontname, double point_size); |
95 | | int pdfi_font_set_internal_name(pdf_context *ctx, pdf_name *fontname, double point_size); |
96 | | bool pdfi_font_known_symbolic(pdf_obj *basefont); |
97 | | |
98 | | |
99 | | enum { |
100 | | GLYPH_W0_WIDTH_INDEX = 0, |
101 | | GLYPH_W0_HEIGHT_INDEX = 1, |
102 | | GLYPH_W1_WIDTH_INDEX = 2, |
103 | | GLYPH_W1_HEIGHT_INDEX = 3, |
104 | | GLYPH_W1_V_X_INDEX = 4, |
105 | | GLYPH_W1_V_Y_INDEX = 5 |
106 | | }; |
107 | | |
108 | | int pdfi_get_cidfont_glyph_metrics(gs_font *pfont, gs_glyph cid, double *widths, bool vertical); |
109 | | int pdfi_font_create_widths(pdf_context *ctx, pdf_dict *fontdict, pdf_font *font, double wscale); |
110 | | void pdfi_font_set_first_last_char(pdf_context *ctx, pdf_dict *fontdict, pdf_font *font); |
111 | | int pdfi_font_generate_pseudo_XUID(pdf_context *ctx, pdf_dict *fontdict, gs_font_base *pfont); |
112 | | #endif |