summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2023-02-14 11:15:10 +0000
committerChris Liddell <chris.liddell@artifex.com>2023-02-14 17:51:26 +0000
commit4edf4a7dc86e39a2882cd391936bb6a14694c65d (patch)
tree7a811f353cba9cfe3947fb9f7352a758bc1e6bcd /pdf
parent025be6a7f44655e3725f5a8119cdce523f75aabd (diff)
downloadghostpdl-4edf4a7dc86e39a2882cd391936bb6a14694c65d.tar.gz
Bug 706411: Refine Type 1 font Encoding "rules"
The interaction between the FontDescriptor flags, the font's native encoding, and the PDF font encoding is not very well defined, this is just a tweak based on the example file.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_font1.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/pdf/pdf_font1.c b/pdf/pdf_font1.c
index 9ef8b18e0..e276d8b39 100644
--- a/pdf/pdf_font1.c
+++ b/pdf/pdf_font1.c
@@ -593,7 +593,6 @@ pdfi_read_type1_font(pdf_context *ctx, pdf_dict *font_dict, pdf_dict *stream_dic
pdfi_countup(basefont);
}
- t1f->descflags = 0;
if (t1f->FontDescriptor != NULL) {
code = pdfi_dict_get_int(ctx, t1f->FontDescriptor, "Flags", &t1f->descflags);
if (code >= 0) {
@@ -646,18 +645,16 @@ pdfi_read_type1_font(pdf_context *ctx, pdf_dict *font_dict, pdf_dict *stream_dic
else
code = gs_error_undefined;
if (code == 1) {
- if ((pdfi_type_of(tmp) == PDF_NAME || pdfi_type_of(tmp) == PDF_DICT) && (t1f->descflags & 4) == 0) {
- code = pdfi_create_Encoding(ctx, tmp, NULL, (pdf_obj **) & t1f->Encoding);
+ if (pdfi_type_of(tmp) == PDF_DICT && (t1f->descflags & 4) != 0) {
+ code = pdfi_create_Encoding(ctx, tmp, (pdf_obj *)fpriv.u.t1.Encoding, (pdf_obj **) & t1f->Encoding);
if (code >= 0)
code = 1;
}
- else if (pdfi_type_of(tmp) == PDF_DICT && (t1f->descflags & 4) != 0) {
- code = pdfi_create_Encoding(ctx, tmp, (pdf_obj *)fpriv.u.t1.Encoding, (pdf_obj **) & t1f->Encoding);
+ else {
+ code = pdfi_create_Encoding(ctx, tmp, NULL, (pdf_obj **) & t1f->Encoding);
if (code >= 0)
code = 1;
}
- else
- code = gs_error_undefined;
pdfi_countdown(tmp);
tmp = NULL;
if (code == 1) {