diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2015-02-21 19:37:28 +0000 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2015-02-21 19:37:28 +0000 |
commit | 1492fca62bda37ab26dc864e19c49cfabc909969 (patch) | |
tree | 62fcdb18601511ba14976ed7a1537193919c326b /Build/source/texk | |
parent | 26d05f98df73cfe45cccdfa13ba70975b5e1a9df (diff) |
Return the newly inserted fontmap record
git-svn-id: svn://tug.org/texlive/trunk@36343 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 3 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dvi.c | 5 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/fontmap.c | 16 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/fontmap.h | 4 |
4 files changed, 15 insertions, 13 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index a6f78b509e0..fceb813f3c4 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -13,6 +13,9 @@ metrics. * configure.ac, Makefile.am: drop FreeType dependency. * dvi.c, fontmap.c, fontmap.h: remove the nonop pdf_load_native_font. + * fontmap.c, fontmap.h (pdf_insert_{native_}fontmap_record): return + the newly inserted record. + * dvi.c: adapt. 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 13833ed1b21..33eab251ae5 100644 --- a/Build/source/texk/dvipdfm-x/dvi.c +++ b/Build/source/texk/dvipdfm-x/dvi.c @@ -951,12 +951,9 @@ dvi_locate_native_font (const char *filename, uint32_t index, 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_insert_native_fontmap_record(path, index, layout_dir, extend, slant, embolden) == -1) { + if ((mrec = pdf_insert_native_fontmap_record(path, index, layout_dir, extend, slant, embolden)) == NULL) { ERROR("Cannot proceed without the font: %s", filename); } - mrec = pdf_lookup_fontmap_record(fontmap_key); - /* FIXME: would be more efficient if pdf_load_native_font returned the mrec ptr (or NULL for error) - so we could avoid doing a second lookup for the item we just inserted */ } memset(&loaded_fonts[cur_id], 0, sizeof (struct loaded_font)); diff --git a/Build/source/texk/dvipdfm-x/fontmap.c b/Build/source/texk/dvipdfm-x/fontmap.c index 400d41e3725..d4210ad36d5 100644 --- a/Build/source/texk/dvipdfm-x/fontmap.c +++ b/Build/source/texk/dvipdfm-x/fontmap.c @@ -816,7 +816,7 @@ pdf_remove_fontmap_record (const char *kp) return 0; } -int +fontmap_rec * pdf_insert_fontmap_record (const char *kp, const fontmap_rec *vp) { fontmap_rec *mrec; @@ -824,7 +824,7 @@ pdf_insert_fontmap_record (const char *kp, const fontmap_rec *vp) if (!kp || fontmap_invalid(vp)) { WARN("Invalid fontmap record..."); - return -1; + return NULL; } if (verbose > 3) @@ -839,7 +839,8 @@ pdf_insert_fontmap_record (const char *kp, const fontmap_rec *vp) if (!subfont_ids) { RELEASE(fnt_name); RELEASE(sfd_name); - return -1; + WARN("Could not open SFD file: %s", sfd_name); + return NULL; } if (verbose > 3) MESG("\nfontmap>> Expand @%s@:", sfd_name); @@ -872,7 +873,7 @@ pdf_insert_fontmap_record (const char *kp, const fontmap_rec *vp) if (verbose > 3) MESG("\n"); - return 0; + return mrec; } @@ -1035,12 +1036,13 @@ pdf_load_fontmap_file (const char *filename, int mode) } #ifdef XETEX -int +fontmap_rec * pdf_insert_native_fontmap_record (const char *path, uint32_t index, int layout_dir, int extend, int slant, int embolden) { char *fontmap_key; fontmap_rec *mrec; + fontmap_rec *ret; ASSERT(path); @@ -1066,14 +1068,14 @@ pdf_insert_native_fontmap_record (const char *path, uint32_t index, mrec->opt.slant = slant / 65536.0; mrec->opt.bold = embolden / 65536.0; - pdf_insert_fontmap_record(mrec->map_name, mrec); + ret = pdf_insert_fontmap_record(mrec->map_name, mrec); pdf_clear_fontmap_record(mrec); RELEASE(mrec); if (verbose) MESG(">"); - return 0; + return ret; } #endif /* XETEX */ diff --git a/Build/source/texk/dvipdfm-x/fontmap.h b/Build/source/texk/dvipdfm-x/fontmap.h index c0d095b2643..a4cbbc06973 100644 --- a/Build/source/texk/dvipdfm-x/fontmap.h +++ b/Build/source/texk/dvipdfm-x/fontmap.h @@ -88,13 +88,13 @@ extern int pdf_read_fontmap_line (fontmap_rec *mrec, const char *ml extern int pdf_append_fontmap_record (const char *kp, const fontmap_rec *mrec); extern int pdf_remove_fontmap_record (const char *kp); -extern int pdf_insert_fontmap_record (const char *kp, const fontmap_rec *mrec); +extern fontmap_rec *pdf_insert_fontmap_record (const char *kp, const fontmap_rec *mrec); extern fontmap_rec *pdf_lookup_fontmap_record (const char *kp); extern int is_pdfm_mapline (const char *mline); #ifdef XETEX -extern int pdf_insert_native_fontmap_record (const char *filename, uint32_t index, +extern fontmap_rec *pdf_insert_native_fontmap_record (const char *filename, uint32_t index, int layout_dir, int extend, int slant, int embolden); #endif |