diff options
Diffstat (limited to 'Build/source/texk/xdvipdfmx/src/fontmap.c')
-rw-r--r-- | Build/source/texk/xdvipdfmx/src/fontmap.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/Build/source/texk/xdvipdfmx/src/fontmap.c b/Build/source/texk/xdvipdfmx/src/fontmap.c index 58b47aa8fde..267767f5aaa 100644 --- a/Build/source/texk/xdvipdfmx/src/fontmap.c +++ b/Build/source/texk/xdvipdfmx/src/fontmap.c @@ -1,4 +1,4 @@ -/* $Header: /home/cvsroot/dvipdfmx/src/fontmap.c,v 1.33 2005/07/30 11:44:18 hirata Exp $ +/* $Header: /home/cvsroot/dvipdfmx/src/fontmap.c,v 1.35 2007/01/21 15:17:53 chofchof Exp $ This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. @@ -980,7 +980,8 @@ pdf_load_fontmap_file (const char *filename, int mode) #ifdef XETEX static int -pdf_insert_native_fontmap_record (const char *name, const char *path, int index, FT_Face face, int layout_dir) +pdf_insert_native_fontmap_record (const char *name, const char *path, int index, FT_Face face, + int layout_dir, int extend, int slant) { char *fontmap_key; fontmap_rec *mrec; @@ -988,8 +989,8 @@ pdf_insert_native_fontmap_record (const char *name, const char *path, int index, ASSERT(name); ASSERT(path || face); - fontmap_key = malloc(strlen(name) + 3); - sprintf(fontmap_key, "%s/%c", name, layout_dir == 0 ? 'H' : 'V'); + fontmap_key = malloc(strlen(name) + 30); // CHECK + sprintf(fontmap_key, "%s/%c/%d/%d", name, layout_dir == 0 ? 'H' : 'V', extend, slant); if (verbose) MESG("<NATIVE-FONTMAP:%s", fontmap_key); @@ -1007,6 +1008,10 @@ pdf_insert_native_fontmap_record (const char *name, const char *path, int index, mrec->opt.flags |= FONTMAP_OPT_VERT; fill_in_defaults(mrec, fontmap_key); + + mrec->opt.extend = extend / 65536.0; + mrec->opt.slant = slant / 65536.0; + pdf_insert_fontmap_record(mrec->map_name, mrec); pdf_clear_fontmap_record(mrec); RELEASE(mrec); @@ -1020,7 +1025,7 @@ pdf_insert_native_fontmap_record (const char *name, const char *path, int index, static FT_Library ftLib; static int -pdf_load_native_font_from_path(const char *ps_name, int layout_dir) +pdf_load_native_font_from_path(const char *ps_name, int layout_dir, int extend, int slant) { const char *p; char *filename = NEW(strlen(ps_name), char); @@ -1059,15 +1064,20 @@ pdf_load_native_font_from_path(const char *ps_name, int layout_dir) } if (error == 0) - return pdf_insert_native_fontmap_record(ps_name, filename, index, face, layout_dir); + return pdf_insert_native_fontmap_record(ps_name, filename, index, face, + layout_dir, extend, slant); else return error; } +FT_Int ft_major; /* global so that dvi.c can check the version */ +FT_Int ft_minor; +FT_Int ft_patch; + int pdf_load_native_font (const char *ps_name, const char *fam_name, const char *sty_name, - int layout_dir) + int layout_dir, int extend, int slant) { static int sInitialized = 0; int error = -1; @@ -1079,11 +1089,12 @@ pdf_load_native_font (const char *ps_name, WARN("FreeType initialization failed."); return error; } + FT_Library_Version(ftLib, &ft_major, &ft_minor, &ft_patch); sInitialized = 1; } if (ps_name[0] == '[') { - error = pdf_load_native_font_from_path(ps_name, layout_dir); + error = pdf_load_native_font_from_path(ps_name, layout_dir, extend, slant); } else { ATSFontRef fontRef; @@ -1105,7 +1116,8 @@ pdf_load_native_font (const char *ps_name, FT_Face face; ftErr = FT_New_Face_From_FSSpec(ftLib, &pathSpec, index, &face); if (ftErr == 0) { - error = pdf_insert_native_fontmap_record(ps_name, NULL, 0, face, layout_dir); + error = pdf_insert_native_fontmap_record(ps_name, NULL, 0, face, + layout_dir, extend, slant); } } } @@ -1132,11 +1144,12 @@ pdf_load_native_font (const char *ps_name, WARN("FreeType initialization failed."); return error; } + FT_Library_Version(ftLib, &ft_major, &ft_minor, &ft_patch); sInitialized = 1; } if (ps_name[0] == '[') { - error = pdf_load_native_font_from_path(ps_name, layout_dir); + error = pdf_load_native_font_from_path(ps_name, layout_dir, extend, slant); } else { os = FcObjectSetBuild(FC_FILE, FC_INDEX, FC_FAMILY, FC_STYLE, NULL); @@ -1159,7 +1172,8 @@ pdf_load_native_font (const char *ps_name, FT_New_Face(ftLib, (char*)path, index, &face); name = (char *)FT_Get_Postscript_Name(face); if (!strcmp(name, ps_name)) { - error = pdf_insert_native_fontmap_record(ps_name, (char*)path, index, face, layout_dir); + error = pdf_insert_native_fontmap_record(ps_name, (char*)path, index, face, + layout_dir, extend, slant); /* don't dispose of the FT_Face, as we'll be using it to retrieve font data */ break; } |