summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/dvipdfm-x/ChangeLog2
-rw-r--r--Build/source/texk/dvipdfm-x/dvi.c18
2 files changed, 17 insertions, 3 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog
index 035c985057e..79f54495b75 100644
--- a/Build/source/texk/dvipdfm-x/ChangeLog
+++ b/Build/source/texk/dvipdfm-x/ChangeLog
@@ -4,6 +4,8 @@
all members of loaded font struct are initialized, avoid crash in
dvi_close for simple fonts because hvmt member is not initialized.
Fixes the xdvipdfmx-bkm test.
+ * dvi.c (dvi_locate_native_font): fix loading files without absolute
+ paths.
2015-02-21 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
diff --git a/Build/source/texk/dvipdfm-x/dvi.c b/Build/source/texk/dvipdfm-x/dvi.c
index 19817d0a3f0..f9a079eeba3 100644
--- a/Build/source/texk/dvipdfm-x/dvi.c
+++ b/Build/source/texk/dvipdfm-x/dvi.c
@@ -61,6 +61,7 @@
#include "dvipdfmx.h"
#ifdef XETEX
+#include "dpxfile.h"
#include "pdfximage.h"
#include "tt_table.h"
#endif
@@ -921,6 +922,7 @@ dvi_locate_native_font (const char *filename, uint32_t index,
fontmap_rec *mrec;
char *fontmap_key = malloc(strlen(filename) + 40); // CHECK this is enough
FILE *fp;
+ char *path = strdup(filename);
sfnt *sfont;
struct tt_head_table *head;
struct tt_maxp_table *maxp;
@@ -929,14 +931,24 @@ dvi_locate_native_font (const char *filename, uint32_t index,
if (verbose)
MESG("<%s@%.2fpt", filename, ptsize * dvi2pts);
+ fp = fopen(path, "rb");
+ if (!fp &&
+ ((path = dpx_find_opentype_file(filename)) != NULL
+ || (path = dpx_find_truetype_file(filename)) != NULL
+ || (path = dpx_find_type1_file(filename)) != NULL
+ || (path = dpx_find_dfont_file(filename)) != NULL) ) {
+ fp = fopen(path, "rb");
+ } else {
+ ERROR("Cannot proceed without the \"native\" font: %s", filename);
+ }
need_more_fonts(1);
cur_id = num_loaded_fonts++;
- sprintf(fontmap_key, "%s/%u/%c/%d/%d/%d", filename, index, layout_dir == 0 ? 'H' : 'V', extend, slant, embolden);
+ sprintf(fontmap_key, "%s/%u/%c/%d/%d/%d", path, index, layout_dir == 0 ? 'H' : 'V', extend, slant, embolden);
mrec = pdf_lookup_fontmap_record(fontmap_key);
if (mrec == NULL) {
- if (pdf_load_native_font(filename, index, layout_dir, extend, slant, embolden) == -1) {
+ if (pdf_load_native_font(path, index, layout_dir, extend, slant, embolden) == -1) {
ERROR("Cannot proceed without the \"native\" font: %s", filename);
}
mrec = pdf_lookup_fontmap_record(fontmap_key);
@@ -951,7 +963,6 @@ dvi_locate_native_font (const char *filename, uint32_t index,
loaded_fonts[cur_id].type = NATIVE;
free(fontmap_key);
- fp = fopen(filename, "rb");
sfont = sfnt_open(fp);
sfnt_read_table_directory(sfont, 0);
head = tt_read_head_table(sfont);
@@ -967,6 +978,7 @@ dvi_locate_native_font (const char *filename, uint32_t index,
RELEASE(maxp);
RELEASE(head);
sfnt_close(sfont);
+ free(path);
fclose(fp);
loaded_fonts[cur_id].layout_dir = layout_dir;