diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2023-02-22 16:28:58 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2023-02-23 13:10:09 +0000 |
commit | 42a4ff9ac99e365734a35a90beaa114ee2e81f39 (patch) | |
tree | ff463373ba73e9579c980d0b3fb556d178e3e2cf /pdf | |
parent | 0663e3d818ed8c4db087f416ec49a4c43820ddea (diff) | |
download | ghostpdl-42a4ff9ac99e365734a35a90beaa114ee2e81f39.tar.gz |
Bug 706316: Improve pdfi/pdfwrite font recognition
Originally, pdfi was extremely conservative in its font creation, ensuring
every font/CIDFont instance has a unique XUID, that ensures we don't have
clashes when a font stream in a PDF is used by multiple font objects with
differing encodings, widths arrays etc...
A side effect of that was that pdfwrite couldn't consolidate instances of fonts
loaded from file (which, unlike embedded subsets, it can do safely).
For fonts loaded from disk, we now skip the pseudo-XUID creation, allowing
pdfwrite to make its own decisions about compatible font instances.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/pdf_font1.c | 5 | ||||
-rw-r--r-- | pdf/pdf_font1C.c | 5 | ||||
-rw-r--r-- | pdf/pdf_fontTT.c | 7 |
3 files changed, 1 insertions, 16 deletions
diff --git a/pdf/pdf_font1.c b/pdf/pdf_font1.c index e276d8b39..563594d09 100644 --- a/pdf/pdf_font1.c +++ b/pdf/pdf_font1.c @@ -885,11 +885,6 @@ pdfi_copy_type1_font(pdf_context *ctx, pdf_font *spdffont, pdf_dict *font_dict, uid_free(&font->pfont->UID, font->pfont->memory, "pdfi_read_type1_font"); uid_set_invalid(&font->pfont->UID); - code = pdfi_font_generate_pseudo_XUID(ctx, font_dict, font->pfont); - if (code < 0) { - goto error; - } - if (ctx->args.ignoretounicode != true) { code = pdfi_dict_get(ctx, font_dict, "ToUnicode", (pdf_obj **)&tmp); if (code >= 0 && pdfi_type_of(tmp) == PDF_STREAM) { diff --git a/pdf/pdf_font1C.c b/pdf/pdf_font1C.c index c08a9457c..7c2466266 100644 --- a/pdf/pdf_font1C.c +++ b/pdf/pdf_font1C.c @@ -3018,11 +3018,6 @@ pdfi_copy_cff_font(pdf_context *ctx, pdf_font *spdffont, pdf_dict *font_dict, pd uid_free(&font->pfont->UID, font->pfont->memory, "pdfi_read_type1_font"); uid_set_invalid(&font->pfont->UID); - code = pdfi_font_generate_pseudo_XUID(ctx, font_dict, font->pfont); - if (code < 0) { - goto error; - } - if (ctx->args.ignoretounicode != true) { code = pdfi_dict_get(ctx, font_dict, "ToUnicode", (pdf_obj **)&tmp); if (code >= 0 && pdfi_type_of(tmp) == PDF_STREAM) { diff --git a/pdf/pdf_fontTT.c b/pdf/pdf_fontTT.c index e4540d244..3048869e6 100644 --- a/pdf/pdf_fontTT.c +++ b/pdf/pdf_fontTT.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019-2022 Artifex Software, Inc. +/* Copyright (C) 2019-2023 Artifex Software, Inc. All Rights Reserved. This software is provided AS-IS with no warranty, either express or @@ -715,11 +715,6 @@ pdfi_copy_truetype_font(pdf_context *ctx, pdf_font *spdffont, pdf_dict *font_dic uid_free(&font->pfont->UID, font->pfont->memory, "pdfi_read_type1_font"); uid_set_invalid(&font->pfont->UID); - code = pdfi_font_generate_pseudo_XUID(ctx, font_dict, font->pfont); - if (code < 0) { - goto error; - } - if (ctx->args.ignoretounicode != true) { code = pdfi_dict_get(ctx, font_dict, "ToUnicode", (pdf_obj **)&tmp); if (code >= 0 && pdfi_type_of(tmp) == PDF_STREAM) { |