summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorNicolás Peña <npm@chromium.org>2017-05-17 00:14:40 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-05-17 00:14:57 +0000
commitb332581e185760597e8f0160011b1e6094634ed8 (patch)
tree7abf577760633850fa22c08f12f31fd471872aac /core
parentfe91c6c8211cec39f871d9202556e1957bf81983 (diff)
downloadpdfium-b332581e185760597e8f0160011b1e6094634ed8.tar.xz
Revert "Small fix in CPDF_TrueTypeFont load"
This reverts commit dde95d8be9bc2817e34429fc38ee6d89d6d5ab75. Reason for revert: the test added is flaky Original change's description: > Small fix in CPDF_TrueTypeFont load > > The ToUnicode map should not be ignored when it exists. Doing so can cause a > charcode to be assigned an incorrect glyph index, and will result in garbled > text. > > Bug: chromium:665467 > Change-Id: I21c1bf560a0731d974191d4189ea730ef9868334 > Reviewed-on: https://pdfium-review.googlesource.com/5512 > Reviewed-by: Lei Zhang <thestig@chromium.org> > Commit-Queue: Nicolás Peña <npm@chromium.org> > TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,npm@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Bug: chromium:665467 Change-Id: I704a34f326d31018061bcfd857fb25f7e4ee4cc2 Reviewed-on: https://pdfium-review.googlesource.com/5493 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/font/cpdf_truetypefont.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index 7f4512da05..d78a5e0eb2 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -125,24 +125,28 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
}
}
- if ((m_GlyphIndex[charcode] != 0 && m_GlyphIndex[charcode] != 0xffff) ||
- !name) {
- continue;
- }
- if (strcmp(name, ".notdef") == 0) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 32);
- continue;
- }
- m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
- if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
- continue;
-
- CFX_WideString wsUnicode = UnicodeFromCharCode(charcode);
- if (!wsUnicode.IsEmpty()) {
- m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.GetFace(), wsUnicode[0]);
- m_Encoding.m_Unicodes[charcode] = wsUnicode[0];
+ if ((m_GlyphIndex[charcode] == 0 || m_GlyphIndex[charcode] == 0xffff) &&
+ name) {
+ if (name[0] == '.' && strcmp(name, ".notdef") == 0) {
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 32);
+ } else {
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
+ if (m_GlyphIndex[charcode] == 0) {
+ if (bToUnicode) {
+ CFX_WideString wsUnicode = UnicodeFromCharCode(charcode);
+ if (!wsUnicode.IsEmpty()) {
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Char_Index(m_Font.GetFace(), wsUnicode[0]);
+ m_Encoding.m_Unicodes[charcode] = wsUnicode[0];
+ }
+ }
+ if (m_GlyphIndex[charcode] == 0) {
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
+ }
+ }
+ }
}
}
return;