From 32e6a581e95b2da00a8183311f74dda817c4ce96 Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 19 Feb 2012 21:31:05 +1030 Subject: [PATCH] Expand glyph name ligatures such as "ff", "ffi" etc to normal form Bug 7002 --- poppler/GfxFont.cc | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index 4e29c36..7fdfc35 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -55,6 +55,7 @@ #include "CharCodeToUnicode.h" #include "FontEncodingTables.h" #include "BuiltinFontTables.h" +#include "UnicodeTypeTable.h" #include #include #include @@ -1228,6 +1229,16 @@ Gfx8BitFont::Gfx8BitFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA // construct the char code -> Unicode mapping object ctu = CharCodeToUnicode::make8BitToUnicode(toUnicode); + // pass 1a: Expand ligatures to normal form + for (code = 0; code < 256; ++code) { + if (toUnicode[code]) { + Unicode *normalized = unicodeNormalizeNFKC(&toUnicode[code], 1, &len, NULL); + if (len > 1) + ctu->setMapping((CharCode)code, normalized, len); + gfree(normalized); + } + } + // pass 2: try to fill in the missing chars, looking for ligatures, numeric // references and variants if (missing) { -- 1.7.5.4