Package: libpoppler46 Version: 0.26.4-1 Severity: wishlist Tags: patch Forwarded: https://bugs.freedesktop.org/show_bug.cgi?id=80093
Hi, evince, i.e. the PDF rendering engine behind it and thus poppler, fails to render fi/fl ligatures for certain documents. This happens, if the document has been created with the Times Type 1 font and then rendered with the TeX Gyre Termes OTF font, which is a metric compatible substitute. The reason is that in the Type 1 font the ligature glyphs are called "fi" and "fl" whereas they are called "f_i" and "f_l" in the OTF font. Since both nomenclatures are right according to the Adobe specs, poppler should search for the respective other if it canot find the requested ligature glyph in the current font. The attached patch does exactly that and I can confirm that it works. It has also been submitted upstream [1], but they have shown no reaction recently. Thus I am asking you to include it in the Debian package, which inturn might raise the incentive for upstream to merge it as well. Best Regards, Fabian PS: This bug has been reported upstream against poppler [0] https://bugs.freedesktop.org/show_bug.cgi?id=73291 [1] https://bugs.freedesktop.org/show_bug.cgi?id=80093 and in Debian against the fonts-texgyre package [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742767 -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (990, 'testing'), (900, 'unstable'), (800, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.14-2-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libpoppler46 depends on: ii libc6 2.19-10 ii libfontconfig1 2.11.0-6.1 ii libfreetype6 2.5.2-1.1 ii libjpeg8 8d1-1 ii liblcms2-2 2.6-3 ii libopenjpeg5 1.5.2-2 ii libpng12-0 1.2.50-2 ii libstdc++6 4.9.1-12 ii libtiff5 4.0.3-9 ii multiarch-support 2.19-10 Versions of packages libpoppler46 recommends: ii poppler-data 0.4.7-1 libpoppler46 suggests no packages. -- no debconf information
From 419a0b803c0663490258cb1f6f23d2334cd08489 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath <fab...@greffrath.com> Date: Mon, 25 Aug 2014 18:21:32 +0200 Subject: [PATCH] if glyph name lookup failed, try alternate naming scheme for ligatures According to the Adobe spec., ligature glyphs may be named either e.g. "fi" ot "f_i". If text has been set with a font using the one naming scheme but is rendered with a font using the other, ligature glyphs may be missing from the rendering. Therefore, if a glyph name lookup failed, try again using the other naming scheme. This happened e.g. for the "fl" and "fi" ligatures in texts set in Times but rendered in Tex Gyre Termes. Closes Bug #73291, Bug #80093. --- poppler/CairoFontEngine.cc | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index 1546594..c30c7da 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -458,6 +458,47 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref, codeToGID[i] = 0; if ((name = enc[i])) { codeToGID[i] = FT_Get_Name_Index(face, name); + + // glyph lookup failed, try alternate naming scheme for ligatures + if (!codeToGID[i]) + { + size_t j, k; + char newname[14]; + const size_t namelen = strlen(name); + + // unusual glyph name size for a ligature + if (namelen < 2 || namelen > 7) + continue; + + if (!strchr(name, '_')) + { + // glyph name contains no underscores, + // now try with interleaving them + newname[0] = name[0]; + for (j = k = 1; j < namelen; j++) + { + newname[k++] = '_'; + newname[k++] = name[j]; + } + newname[k] = '\0'; + } + else + { + // glyph name already contains underscores, + // now try without them + for (j = k = 0; j < namelen; j++) + { + if (name[j] != '_') + { + newname[k++] = name[j]; + } + } + newname[k] = '\0'; + } + + // repeat glyph lookup for the alternate name + codeToGID[i] = FT_Get_Name_Index(face, newname); + } } } break; -- 2.1.0