From 7bd6adefd8722dd0617830827e0864173e001d62 Mon Sep 17 00:00:00 2001 From: whitequark Date: Wed, 2 Nov 2016 08:40:38 +0000 Subject: [PATCH] TTF: actually use CID as GID when CID-to-GID mapping is absent. --- src/ttf.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ttf.cpp b/src/ttf.cpp index f287917..d79879b 100644 --- a/src/ttf.cpp +++ b/src/ttf.cpp @@ -247,11 +247,12 @@ void TtfFont::PlotString(const std::string &str, outlineFuncs.delta = 0; FT_Pos dx = 0; - for(char32_t chr : ReadUTF8(str)) { - uint32_t gid = FT_Get_Char_Index(fontFace, chr); + for(char32_t cid : ReadUTF8(str)) { + uint32_t gid = FT_Get_Char_Index(fontFace, cid); if (gid == 0) { dbp("freetype: CID-to-GID mapping for CID 0x%04x failed: %s; using CID as GID", - chr, ft_error_string(gid)); + cid, ft_error_string(gid)); + gid = cid; } /*