diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-08-25 14:14:21 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-08-25 14:14:21 +0000 |
commit | 536a5d7ce8b45d12f371335d1356819a2879593c (patch) | |
tree | 827038c96152444043d42af0bd275ec6454aa8c6 /Build | |
parent | 9e79a59a9cd97513d54c3e6190d2391947daa14b (diff) |
web2c/xetexdir: support pair kerning for native type1 fonts
git-svn-id: svn://tug.org/texlive/trunk@38201 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp | 23 |
2 files changed, 18 insertions, 10 deletions
diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index b47f9106e21..e1ddf90978d 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,8 @@ +2015-08-25 Akira Kakuto <kakuto@fuk.kinidai.ac.jp> + + * XeTeXFontInst.cpp: Support pair kerning for native type1 fonts. + Thanks Werner Lemberg and Jiang Jiang. + 2015-08-19 Peter Breitenlohner <peb@mppmu.mpg.de> * am/xetex.am (xetex_CFLAGS): Enable compiler warnings. diff --git a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp index 30a9f5f1d23..fe1c8657cd4 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp +++ b/Build/source/texk/web2c/xetexdir/XeTeXFontInst.cpp @@ -40,6 +40,7 @@ authorization from the copyright holders. */ #include <w2c/config.h> +#include <kpathsea/kpathsea.h> #include "XeTeXFontInst.h" #include "XeTeXLayoutInterface.h" @@ -174,7 +175,7 @@ _get_glyph_h_kerning(hb_font_t*, void *font_data, hb_codepoint_t gid1, hb_codepo FT_Vector kerning; hb_position_t ret; - error = FT_Get_Kerning (face, gid1, gid2, FT_KERNING_UNFITTED, &kerning); + error = FT_Get_Kerning (face, gid1, gid2, FT_KERNING_UNSCALED, &kerning); if (error) ret = 0; else @@ -313,15 +314,17 @@ XeTeXFontInst::initialize(const char* pathname, int index, int &status) /* for non-sfnt-packaged fonts (presumably Type 1), see if there is an AFM file we can attach */ if (index == 0 && !FT_IS_SFNT(m_ftFace)) { - char* afm = new char[strlen((const char*)pathname) + 5]; // room to append ".afm" - strcpy(afm, (const char*)pathname); - char* p = strrchr(afm, '.'); - if (p == NULL || strlen(p) != 4 || tolower(*(p+1)) != 'p' || tolower(*(p+2)) != 'f') - strcat(afm, ".afm"); // append .afm if the extension didn't seem to be .pf[ab] - else - strcpy(p, ".afm"); // else replace extension with .afm - FT_Attach_File(m_ftFace, afm); // ignore error code; AFM might not exist - delete[] afm; + char* afm = xstrdup ((char *)xbasename (pathname)); + char* p = strrchr (afm, '.'); + if (p != NULL && strlen(p) == 4 && tolower(*(p+1)) == 'p' && + tolower(*(p+2)) == 'f') + strcpy(p, ".afm"); + char *fullafm = kpse_find_file (afm, kpse_afm_format, 0); + free (afm); + if (fullafm) { + FT_Attach_File(m_ftFace, fullafm); + free (fullafm); + } } m_filename = xstrdup(pathname); |