summaryrefslogtreecommitdiff
path: root/pdf/pdf_fmap.c
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2022-05-19 15:16:32 +0100
committerRobin Watts <Robin.Watts@artifex.com>2022-06-03 11:46:29 +0100
commit1911b064d3fa2c14d6fbdd971c8c55a59fcc141f (patch)
treed5f94e984f875b20d42cb8dc9470cf24cb250d66 /pdf/pdf_fmap.c
parent1149c5ab914c7695caa8951bb8213f4241c51104 (diff)
downloadghostpdl-1911b064d3fa2c14d6fbdd971c8c55a59fcc141f.tar.gz
Bug 705298: Change priority of font mapsghostpdl-9.56.1-backport
The pdfi fontmap code prioritized explicit mappings from the Fontmap file, over mappings generated automatically from the FONTPATH option. Turns out, it should be the other way around. Secondly, the pdfi code would "sanitize" the font name to look for before consulting either font map, where we should check the name as read from the PDF before trying the sanitized version.
Diffstat (limited to 'pdf/pdf_fmap.c')
-rw-r--r--pdf/pdf_fmap.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/pdf/pdf_fmap.c b/pdf/pdf_fmap.c
index ee05af1c5..25da9d21f 100644
--- a/pdf/pdf_fmap.c
+++ b/pdf/pdf_fmap.c
@@ -814,22 +814,7 @@ pdf_fontmap_lookup_font(pdf_context *ctx, pdf_name *fname, pdf_obj **mapname, in
return code;
}
- code = pdfi_dict_get_by_key(ctx, ctx->pdffontmap, fname, &mname);
- if (code >= 0) {
- /* Fontmap can map in multiple "jump" i.e.
- name -> substitute name
- subsitute name -> file name
- So we want to loop until we no more hits.
- */
- while(1) {
- pdf_obj *mname2;
- code = pdfi_dict_get_by_key(ctx, ctx->pdffontmap, (pdf_name *)mname, &mname2);
- if (code < 0) break;
- pdfi_countdown(mname);
- mname = mname2;
- }
- }
- else if (ctx->pdfnativefontmap != NULL) {
+ if (ctx->pdfnativefontmap != NULL) {
pdf_obj *record;
code = pdfi_dict_get_by_key(ctx, ctx->pdfnativefontmap, fname, &record);
if (code < 0)
@@ -850,7 +835,27 @@ pdf_fontmap_lookup_font(pdf_context *ctx, pdf_name *fname, pdf_obj **mapname, in
}
}
}
+ else {
+ code = gs_error_undefined;
+ }
+ if (code < 0) {
+ code = pdfi_dict_get_by_key(ctx, ctx->pdffontmap, fname, &mname);
+ if (code >= 0) {
+ /* Fontmap can map in multiple "jump" i.e.
+ name -> substitute name
+ subsitute name -> file name
+ So we want to loop until we no more hits.
+ */
+ while(1) {
+ pdf_obj *mname2;
+ code = pdfi_dict_get_by_key(ctx, ctx->pdffontmap, (pdf_name *)mname, &mname2);
+ if (code < 0) break;
+ pdfi_countdown(mname);
+ mname = mname2;
+ }
+ }
+ }
if (mname != NULL && mname->type == PDF_STRING && pdfi_fmap_file_exists(ctx, (pdf_string *)mname)) {
*mapname = mname;
code = 0;