summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r--core/fpdfapi/font/cpdf_type1font.cpp88
1 files changed, 44 insertions, 44 deletions
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 21d9da42c8..77987bb5dc 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -154,9 +154,9 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
}
FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE);
- if (m_BaseEncoding == 0) {
+ if (m_BaseEncoding == 0)
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
- }
+
for (int charcode = 0; charcode < 256; charcode++) {
const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
@@ -193,7 +193,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
+ FXFT_Get_Name_Index(m_Font.GetFace(), const_cast<char*>(name));
SetExtGID(name, charcode);
} else {
m_GlyphIndex[charcode] =
@@ -208,46 +208,46 @@ void CPDF_Type1Font::LoadGlyphMap() {
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
name_glyph, 256);
name_glyph[255] = 0;
- if (unicode == 0 && name_glyph[0] != 0) {
+ if (unicode == 0 && name_glyph[0] != 0)
unicode = PDF_UnicodeFromAdobeName(name_glyph);
- }
+
m_Encoding.m_Unicodes[charcode] = unicode;
SetExtGID(name_glyph, charcode);
}
}
return;
}
- bool bUnicode = false;
- if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) {
- bUnicode = true;
- }
+
+ bool bUnicode =
+ FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE) == 0;
for (int charcode = 0; charcode < 256; charcode++) {
const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
- if (!name) {
+ if (!name)
continue;
- }
+
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
const char* pStrUnicode = GlyphNameRemap(name);
if (pStrUnicode &&
- 0 == FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name)) {
+ FXFT_Get_Name_Index(m_Font.GetFace(), const_cast<char*>(name)) == 0) {
name = pStrUnicode;
}
m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
+ FXFT_Get_Name_Index(m_Font.GetFace(), const_cast<char*>(name));
SetExtGID(name, charcode);
- if (m_GlyphIndex[charcode] == 0) {
- if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
- m_Font.GetFace(),
- bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
- CalcExtGID(charcode);
- } else {
- m_Encoding.m_Unicodes[charcode] = 0x20;
- m_GlyphIndex[charcode] =
- bUnicode ? FXFT_Get_Char_Index(m_Font.GetFace(), 0x20) : 0xffff;
- CalcExtGID(charcode);
- }
+ if (m_GlyphIndex[charcode] != 0)
+ continue;
+
+ if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_Font.GetFace(),
+ bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
+ CalcExtGID(charcode);
+ } else {
+ m_Encoding.m_Unicodes[charcode] = 0x20;
+ m_GlyphIndex[charcode] =
+ bUnicode ? FXFT_Get_Char_Index(m_Font.GetFace(), 0x20) : 0xffff;
+ CalcExtGID(charcode);
}
}
return;
@@ -260,7 +260,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
+ FXFT_Get_Name_Index(m_Font.GetFace(), const_cast<char*>(name));
} else {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
@@ -273,9 +273,8 @@ void CPDF_Type1Font::LoadGlyphMap() {
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
name_glyph, 256);
name_glyph[255] = 0;
- if (name_glyph[0] != 0) {
+ if (name_glyph[0] != 0)
unicode = PDF_UnicodeFromAdobeName(name_glyph);
- }
}
m_Encoding.m_Unicodes[charcode] = unicode;
}
@@ -288,26 +287,27 @@ void CPDF_Type1Font::LoadGlyphMap() {
#endif
return;
}
- bool bUnicode = false;
- if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) {
- bUnicode = true;
- }
+
+ bool bUnicode =
+ FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE) == 0;
for (int charcode = 0; charcode < 256; charcode++) {
const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
- if (!name) {
+ if (!name)
continue;
- }
+
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
- m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
- if (m_GlyphIndex[charcode] == 0) {
- if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
- m_Font.GetFace(),
- bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
- } else {
- m_Encoding.m_Unicodes[charcode] = 0x20;
- m_GlyphIndex[charcode] = 0xffff;
- }
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Name_Index(m_Font.GetFace(), const_cast<char*>(name));
+ if (m_GlyphIndex[charcode] != 0)
+ continue;
+
+ if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_Font.GetFace(),
+ bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
+ } else {
+ m_Encoding.m_Unicodes[charcode] = 0x20;
+ m_GlyphIndex[charcode] = 0xffff;
}
}
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_