summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp42
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.h10
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp16
-rw-r--r--core/fpdfapi/font/cpdf_font.h16
-rw-r--r--core/fpdfapi/font/cpdf_fontencoding.cpp29
-rw-r--r--core/fpdfapi/font/cpdf_fontencoding.h19
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.h2
-rw-r--r--core/fpdfapi/font/cpdf_truetypefont.cpp7
-rw-r--r--core/fpdfapi/font/cpdf_type1font.cpp33
-rw-r--r--core/fpdfapi/font/cpdf_type1font.h2
-rw-r--r--core/fpdfapi/font/cpdf_type3font.cpp2
-rw-r--r--core/fpdfapi/font/font_int.h10
-rw-r--r--core/fpdfapi/font/fpdf_font.cpp12
-rw-r--r--core/fpdfapi/font/fpdf_font_cid.cpp18
15 files changed, 109 insertions, 113 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index b0ae05c8c5..6e050c4bc7 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -136,9 +136,9 @@ bool IsValidEmbeddedCharcodeFromUnicodeCharset(CIDSet charset) {
}
}
-FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
- CIDSet charset,
- uint32_t charcode) {
+wchar_t EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
+ CIDSet charset,
+ uint32_t charcode) {
if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
return 0;
@@ -151,7 +151,7 @@ FX_WCHAR EmbeddedUnicodeFromCharcode(const FXCMAP_CMap* pEmbedMap,
uint32_t EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap,
CIDSet charset,
- FX_WCHAR unicode) {
+ wchar_t unicode) {
if (!IsValidEmbeddedCharcodeFromUnicodeCharset(charset))
return 0;
@@ -239,15 +239,15 @@ CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
if (!str.IsEmpty())
return str;
- FX_WCHAR ret = GetUnicodeFromCharCode(charcode);
+ wchar_t ret = GetUnicodeFromCharCode(charcode);
return ret ? ret : CFX_WideString();
}
-FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
+wchar_t CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
switch (m_pCMap->m_Coding) {
case CIDCODING_UCS2:
case CIDCODING_UTF16:
- return static_cast<FX_WCHAR>(charcode);
+ return static_cast<wchar_t>(charcode);
case CIDCODING_CID:
if (!m_pCID2UnicodeMap || !m_pCID2UnicodeMap->IsLoaded())
return 0;
@@ -257,15 +257,15 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
return m_pCID2UnicodeMap->UnicodeFromCID(CIDFromCharCode(charcode));
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
- FX_WCHAR unicode;
+ wchar_t unicode;
int charsize = 1;
if (charcode > 255) {
charcode = (charcode % 256) * 256 + (charcode / 256);
charsize = 2;
}
- int ret = FXSYS_MultiByteToWideChar(
- g_CharsetCPs[m_pCMap->m_Coding], 0,
- reinterpret_cast<const FX_CHAR*>(&charcode), charsize, &unicode, 1);
+ int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->m_Coding], 0,
+ reinterpret_cast<const char*>(&charcode),
+ charsize, &unicode, 1);
return ret == 1 ? unicode : 0;
#else
if (!m_pCMap->m_pEmbedMap)
@@ -275,7 +275,7 @@ FX_WCHAR CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
#endif
}
-uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
+uint32_t CPDF_CIDFont::CharCodeFromUnicode(wchar_t unicode) const {
uint32_t charcode = CPDF_Font::CharCodeFromUnicode(unicode);
if (charcode)
return charcode;
@@ -290,7 +290,7 @@ uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
return 0;
uint32_t CID = 0;
while (CID < 65536) {
- FX_WCHAR this_unicode =
+ wchar_t this_unicode =
m_pCID2UnicodeMap->UnicodeFromCID(static_cast<uint16_t>(CID));
if (this_unicode == unicode)
return CID;
@@ -611,7 +611,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (!m_pFontFile && !m_pStreamAcc) {
uint16_t cid = CIDFromCharCode(charcode);
- FX_WCHAR unicode = 0;
+ wchar_t unicode = 0;
if (m_bCIDIsGID) {
#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
return cid;
@@ -649,7 +649,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
iBaseEncoding = PDFFONT_ENCODING_WINANSI;
else if (bMacRoman)
iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
- const FX_CHAR* name = GetAdobeCharName(
+ const char* name = GetAdobeCharName(
iBaseEncoding, std::vector<CFX_ByteString>(), charcode);
if (!name)
return charcode ? static_cast<int>(charcode) : -1;
@@ -693,16 +693,16 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
for (i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) {
uint32_t ret = FT_CharCodeFromUnicode(
FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]),
- static_cast<FX_WCHAR>(charcode));
+ static_cast<wchar_t>(charcode));
if (ret == 0)
continue;
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]);
- unicode = static_cast<FX_WCHAR>(ret);
+ unicode = static_cast<wchar_t>(ret);
break;
}
if (i == FXFT_Get_Face_CharmapCount(face) && i) {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
- unicode = static_cast<FX_WCHAR>(charcode);
+ unicode = static_cast<wchar_t>(charcode);
}
}
if (FXFT_Get_Face_Charmap(face)) {
@@ -744,7 +744,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
return pdata[0] * 256 + pdata[1];
}
-uint32_t CPDF_CIDFont::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_CIDFont::GetNextChar(const char* pString,
int nStrLen,
int& offset) const {
return m_pCMap->GetNextChar(pString, nStrLen, offset);
@@ -754,11 +754,11 @@ int CPDF_CIDFont::GetCharSize(uint32_t charcode) const {
return m_pCMap->GetCharSize(charcode);
}
-int CPDF_CIDFont::CountChar(const FX_CHAR* pString, int size) const {
+int CPDF_CIDFont::CountChar(const char* pString, int size) const {
return m_pCMap->CountChar(pString, size);
}
-int CPDF_CIDFont::AppendChar(FX_CHAR* str, uint32_t charcode) const {
+int CPDF_CIDFont::AppendChar(char* str, uint32_t charcode) const {
return m_pCMap->AppendChar(str, charcode);
}
diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h
index 79ec7cbb35..e256be1af5 100644
--- a/core/fpdfapi/font/cpdf_cidfont.h
+++ b/core/fpdfapi/font/cpdf_cidfont.h
@@ -45,16 +45,16 @@ class CPDF_CIDFont : public CPDF_Font {
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
int GetCharWidthF(uint32_t charcode) override;
FX_RECT GetCharBBox(uint32_t charcode) override;
- uint32_t GetNextChar(const FX_CHAR* pString,
+ uint32_t GetNextChar(const char* pString,
int nStrLen,
int& offset) const override;
- int CountChar(const FX_CHAR* pString, int size) const override;
- int AppendChar(FX_CHAR* str, uint32_t charcode) const override;
+ int CountChar(const char* pString, int size) const override;
+ int AppendChar(char* str, uint32_t charcode) const override;
bool IsVertWriting() const override;
bool IsUnicodeCompatible() const override;
bool Load() override;
CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
- uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
+ uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
uint16_t CIDFromCharCode(uint32_t charcode) const;
const uint8_t* GetCIDTransform(uint16_t CID) const;
@@ -70,7 +70,7 @@ class CPDF_CIDFont : public CPDF_Font {
std::vector<uint32_t>* result,
int nElements);
void LoadSubstFont();
- FX_WCHAR GetUnicodeFromCharCode(uint32_t charcode) const;
+ wchar_t GetUnicodeFromCharCode(uint32_t charcode) const;
CFX_MaybeOwned<CPDF_CMap> m_pCMap;
CPDF_CID2UnicodeMap* m_pCID2UnicodeMap;
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 36d7d6aeeb..7988ec7124 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -118,7 +118,7 @@ bool CPDF_Font::IsUnicodeCompatible() const {
return false;
}
-int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const {
+int CPDF_Font::CountChar(const char* pString, int size) const {
return size;
}
@@ -131,8 +131,8 @@ bool CPDF_Font::IsVertWriting() const {
return pCIDFont ? pCIDFont->IsVertWriting() : m_Font.IsVertical();
}
-int CPDF_Font::AppendChar(FX_CHAR* buf, uint32_t charcode) const {
- *buf = static_cast<FX_CHAR>(charcode);
+int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const {
+ *buf = static_cast<char>(charcode);
return 1;
}
@@ -153,7 +153,7 @@ CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : CFX_WideString();
}
-uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const {
+uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const {
if (!m_bToUnicodeLoaded)
LoadUnicodeMap();
@@ -281,7 +281,7 @@ void CPDF_Font::LoadUnicodeMap() const {
m_pToUnicodeMap->Load(pStream);
}
-int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) {
+int CPDF_Font::GetStringWidth(const char* pString, int size) {
int offset = 0;
int width = 0;
while (offset < size) {
@@ -341,7 +341,7 @@ std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc,
return pFont->Load() ? std::move(pFont) : nullptr;
}
-uint32_t CPDF_Font::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_Font::GetNextChar(const char* pString,
int nStrLen,
int& offset) const {
if (offset < 0 || nStrLen < 1) {
@@ -429,7 +429,7 @@ bool CPDF_Font::IsStandardFont() const {
return true;
}
-const FX_CHAR* CPDF_Font::GetAdobeCharName(
+const char* CPDF_Font::GetAdobeCharName(
int iBaseEncoding,
const std::vector<CFX_ByteString>& charnames,
int charcode) {
@@ -441,7 +441,7 @@ const FX_CHAR* CPDF_Font::GetAdobeCharName(
if (!charnames.empty() && !charnames[charcode].IsEmpty())
return charnames[charcode].c_str();
- const FX_CHAR* name = nullptr;
+ const char* name = nullptr;
if (iBaseEncoding)
name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode);
return name && name[0] ? name : nullptr;
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 6025a82d7a..6dac3f2778 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -50,15 +50,15 @@ class CPDF_Font {
virtual bool IsVertWriting() const;
virtual bool IsUnicodeCompatible() const;
- virtual uint32_t GetNextChar(const FX_CHAR* pString,
+ virtual uint32_t GetNextChar(const char* pString,
int nStrLen,
int& offset) const;
- virtual int CountChar(const FX_CHAR* pString, int size) const;
- virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const;
+ virtual int CountChar(const char* pString, int size) const;
+ virtual int AppendChar(char* buf, uint32_t charcode) const;
virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
virtual int GlyphFromCharCodeExt(uint32_t charcode);
virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const;
- virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const;
+ virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
@@ -71,7 +71,7 @@ class CPDF_Font {
void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
int GetTypeAscent() const { return m_Ascent; }
int GetTypeDescent() const { return m_Descent; }
- int GetStringWidth(const FX_CHAR* pString, int size);
+ int GetStringWidth(const char* pString, int size);
uint32_t FallbackFontFromCharcode(uint32_t charcode);
int FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode);
@@ -96,9 +96,9 @@ class CPDF_Font {
void LoadFontDescriptor(CPDF_Dictionary* pDict);
void CheckFontMetrics();
- const FX_CHAR* GetAdobeCharName(int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
- int charcode);
+ const char* GetAdobeCharName(int iBaseEncoding,
+ const std::vector<CFX_ByteString>& charnames,
+ int charcode);
CFX_ByteString m_BaseFont;
CPDF_StreamAcc* m_pFontFile;
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index 88b2c8d6a5..be4eaff13b 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -236,7 +236,7 @@ const uint16_t ZapfEncoding[256] = {
0x27BC, 0x27BD, 0x27BE, 0x0000,
};
-const FX_CHAR* const StandardEncodingNames[224] = {
+const char* const StandardEncodingNames[224] = {
"space",
"exclam",
"quotedbl",
@@ -463,7 +463,7 @@ const FX_CHAR* const StandardEncodingNames[224] = {
nullptr,
};
-const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = {
+const char* const AdobeWinAnsiEncodingNames[224] = {
"space",
"exclam",
"quotedbl",
@@ -690,7 +690,7 @@ const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = {
"ydieresis",
};
-const FX_CHAR* const MacRomanEncodingNames[224] = {
+const char* const MacRomanEncodingNames[224] = {
"space",
"exclam",
"quotedbl",
@@ -917,7 +917,7 @@ const FX_CHAR* const MacRomanEncodingNames[224] = {
"caron",
};
-const FX_CHAR* const MacExpertEncodingNames[224] = {
+const char* const MacExpertEncodingNames[224] = {
"space",
"exclamsmall",
"Hungarumlautsmall",
@@ -1144,7 +1144,7 @@ const FX_CHAR* const MacExpertEncodingNames[224] = {
nullptr,
};
-const FX_CHAR* const PDFDocEncodingNames[232] = {
+const char* const PDFDocEncodingNames[232] = {
"breve",
"caron",
"circumflex",
@@ -1379,7 +1379,7 @@ const FX_CHAR* const PDFDocEncodingNames[232] = {
"ydieresis",
};
-const FX_CHAR* const AdobeSymbolEncodingNames[224] = {
+const char* const AdobeSymbolEncodingNames[224] = {
"space",
"exclam",
"universal",
@@ -1606,7 +1606,7 @@ const FX_CHAR* const AdobeSymbolEncodingNames[224] = {
nullptr,
};
-const FX_CHAR* const ZapfEncodingNames[224] = {
+const char* const ZapfEncodingNames[224] = {
"space", "a1", "a2", "a202", "a3", "a4", "a5", "a119",
"a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16",
"a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23",
@@ -1649,7 +1649,7 @@ CPDF_FontEncoding::CPDF_FontEncoding() {
FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes));
}
-int CPDF_FontEncoding::CharCodeFromUnicode(FX_WCHAR unicode) const {
+int CPDF_FontEncoding::CharCodeFromUnicode(wchar_t unicode) const {
for (int i = 0; i < 256; i++)
if (m_Unicodes[i] == unicode) {
return i;
@@ -1717,7 +1717,7 @@ std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize(
return std::move(pDict);
}
-uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode) {
+uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode) {
switch (encoding) {
case FXFT_ENCODING_UNICODE:
return unicode;
@@ -1758,18 +1758,17 @@ const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding) {
return nullptr;
}
-FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) {
- return (FX_WCHAR)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
+wchar_t PDF_UnicodeFromAdobeName(const char* name) {
+ return (wchar_t)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
}
-CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode) {
+CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
char glyph_name[64];
FXFT_adobe_name_from_unicode(glyph_name, unicode);
return CFX_ByteString(glyph_name);
}
-const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
- uint8_t charcode) {
+const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) {
if (encoding == PDFFONT_ENCODING_PDFDOC) {
if (charcode < 24)
return nullptr;
@@ -1800,7 +1799,7 @@ const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
return nullptr;
}
-FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode) {
+wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode) {
switch (encoding) {
case FXFT_ENCODING_UNICODE:
return (uint16_t)charcode;
diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h
index 6c0de909e1..7a94db9f0e 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.h
+++ b/core/fpdfapi/font/cpdf_fontencoding.h
@@ -24,15 +24,14 @@
#define PDFFONT_ENCODING_MS_SYMBOL 8
#define PDFFONT_ENCODING_UNICODE 9
-uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode);
-FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
+uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode);
+wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
-FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name);
-CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode);
+wchar_t PDF_UnicodeFromAdobeName(const char* name);
+CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding);
-const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding,
- uint8_t charcode);
+const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode);
class CPDF_Object;
@@ -45,19 +44,19 @@ class CPDF_FontEncoding {
bool IsIdentical(CPDF_FontEncoding* pAnother) const;
- FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const {
+ wchar_t UnicodeFromCharCode(uint8_t charcode) const {
return m_Unicodes[charcode];
}
- int CharCodeFromUnicode(FX_WCHAR unicode) const;
+ int CharCodeFromUnicode(wchar_t unicode) const;
- void SetUnicode(uint8_t charcode, FX_WCHAR unicode) {
+ void SetUnicode(uint8_t charcode, wchar_t unicode) {
m_Unicodes[charcode] = unicode;
}
std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool);
public:
- FX_WCHAR m_Unicodes[256];
+ wchar_t m_Unicodes[256];
};
#endif // CORE_FPDFAPI_FONT_CPDF_FONTENCODING_H_
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index c414270068..94a690f221 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -198,13 +198,13 @@ CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
if (!unicode.IsEmpty())
return unicode;
- FX_WCHAR ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
+ wchar_t ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
if (ret == 0)
return CFX_WideString();
return ret;
}
-uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
+uint32_t CPDF_SimpleFont::CharCodeFromUnicode(wchar_t unicode) const {
uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode);
if (ret)
return ret;
diff --git a/core/fpdfapi/font/cpdf_simplefont.h b/core/fpdfapi/font/cpdf_simplefont.h
index 592290b99b..3e414fa788 100644
--- a/core/fpdfapi/font/cpdf_simplefont.h
+++ b/core/fpdfapi/font/cpdf_simplefont.h
@@ -25,7 +25,7 @@ class CPDF_SimpleFont : public CPDF_Font {
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
bool IsUnicodeCompatible() const override;
CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
- uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
+ uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
CPDF_FontEncoding* GetEncoding() { return &m_Encoding; }
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index b8bee2968e..a87370f971 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -96,8 +96,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
bool bToUnicode = m_pFontDict->KeyExist("ToUnicode");
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
- GetAdobeCharName(baseEncoding, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(baseEncoding, m_CharNames, charcode);
if (!name) {
m_GlyphIndex[charcode] =
m_pFontFile ? FXFT_Get_Char_Index(m_Font.GetFace(), charcode) : -1;
@@ -170,7 +169,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (bFound) {
if (baseEncoding != PDFFONT_ENCODING_BUILTIN) {
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(baseEncoding, m_CharNames, charcode);
if (name)
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -204,7 +203,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (m_pFontFile) {
m_Encoding.m_Unicodes[charcode] = charcode;
} else {
- const FX_CHAR* name = GetAdobeCharName(0, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(0, m_CharNames, charcode);
if (name)
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
else if (pUnicodes)
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 1a37555a50..4c7b86a567 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -19,8 +19,8 @@ namespace {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
struct GlyphNameMap {
- const FX_CHAR* m_pStrAdobe;
- const FX_CHAR* m_pStrUnicode;
+ const char* m_pStrAdobe;
+ const char* m_pStrUnicode;
};
const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"},
@@ -30,11 +30,11 @@ const GlyphNameMap g_GlyphNameSubsts[] = {{"ff", "uniFB00"},
{"fl", "uniFB02"}};
int compareString(const void* key, const void* element) {
- return FXSYS_stricmp(static_cast<const FX_CHAR*>(key),
+ return FXSYS_stricmp(static_cast<const char*>(key),
static_cast<const GlyphNameMap*>(element)->m_pStrAdobe);
}
-const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) {
+const char* GlyphNameRemap(const char* pStrAdobe) {
const GlyphNameMap* found = static_cast<const GlyphNameMap*>(FXSYS_bsearch(
pStrAdobe, g_GlyphNameSubsts, FX_ArraySize(g_GlyphNameSubsts),
sizeof(GlyphNameMap), compareString));
@@ -161,7 +161,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
}
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name)
continue;
@@ -191,7 +191,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (bCoreText) {
if (m_Flags & FXFONT_SYMBOLIC) {
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -201,12 +201,12 @@ void CPDF_Type1Font::LoadGlyphMap() {
} else {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
- FX_WCHAR unicode = 0;
+ wchar_t unicode = 0;
if (m_GlyphIndex[charcode]) {
unicode =
FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode);
}
- FX_CHAR name_glyph[256];
+ char name_glyph[256];
FXSYS_memset(name_glyph, 0, sizeof(name_glyph));
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
name_glyph, 256);
@@ -225,13 +225,13 @@ void CPDF_Type1Font::LoadGlyphMap() {
bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name) {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
- const FX_CHAR* pStrUnicode = GlyphNameRemap(name);
+ const char* pStrUnicode = GlyphNameRemap(name);
if (pStrUnicode &&
0 == FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name)) {
name = pStrUnicode;
@@ -259,7 +259,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_Flags & FXFONT_SYMBOLIC) {
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
+ const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -269,10 +269,10 @@ void CPDF_Type1Font::LoadGlyphMap() {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
if (m_GlyphIndex[charcode]) {
- FX_WCHAR unicode =
+ wchar_t unicode =
FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode);
if (unicode == 0) {
- FX_CHAR name_glyph[256];
+ char name_glyph[256];
FXSYS_memset(name_glyph, 0, sizeof(name_glyph));
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
name_glyph, 256);
@@ -297,8 +297,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode++) {
- const FX_CHAR* name =
- GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name) {
continue;
}
@@ -323,7 +322,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
-void CPDF_Type1Font::SetExtGID(const FX_CHAR* name, int charcode) {
+void CPDF_Type1Font::SetExtGID(const char* name, int charcode) {
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull);
m_ExtGID[charcode] =
@@ -333,7 +332,7 @@ void CPDF_Type1Font::SetExtGID(const FX_CHAR* name, int charcode) {
}
void CPDF_Type1Font::CalcExtGID(int charcode) {
- FX_CHAR name_glyph[256];
+ char name_glyph[256];
FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph,
256);
name_glyph[255] = 0;
diff --git a/core/fpdfapi/font/cpdf_type1font.h b/core/fpdfapi/font/cpdf_type1font.h
index f5f378561d..8039583d8e 100644
--- a/core/fpdfapi/font/cpdf_type1font.h
+++ b/core/fpdfapi/font/cpdf_type1font.h
@@ -30,7 +30,7 @@ class CPDF_Type1Font : public CPDF_SimpleFont {
void LoadGlyphMap() override;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- void SetExtGID(const FX_CHAR* name, int charcode);
+ void SetExtGID(const char* name, int charcode);
void CalcExtGID(int charcode);
#endif
diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp
index f6cd6ecf26..b7ff8c9cf0 100644
--- a/core/fpdfapi/font/cpdf_type3font.cpp
+++ b/core/fpdfapi/font/cpdf_type3font.cpp
@@ -89,7 +89,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) {
if (it != m_CacheMap.end())
return it->second.get();
- const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
+ const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name)
return nullptr;
diff --git a/core/fpdfapi/font/font_int.h b/core/fpdfapi/font/font_int.h
index 41d821ec81..23513d4e90 100644
--- a/core/fpdfapi/font/font_int.h
+++ b/core/fpdfapi/font/font_int.h
@@ -148,9 +148,9 @@ class CPDF_CMap {
bool IsVertWriting() const;
uint16_t CIDFromCharCode(uint32_t charcode) const;
int GetCharSize(uint32_t charcode) const;
- uint32_t GetNextChar(const FX_CHAR* pString, int nStrLen, int& offset) const;
- int CountChar(const FX_CHAR* pString, int size) const;
- int AppendChar(FX_CHAR* str, uint32_t charcode) const;
+ uint32_t GetNextChar(const char* pString, int nStrLen, int& offset) const;
+ int CountChar(const char* pString, int size) const;
+ int AppendChar(char* str, uint32_t charcode) const;
private:
friend class CPDF_CMapParser;
@@ -176,7 +176,7 @@ class CPDF_CID2UnicodeMap {
bool IsLoaded();
void Load(CPDF_CMapManager* pMgr, CIDSet charset, bool bPromptCJK);
- FX_WCHAR UnicodeFromCID(uint16_t CID);
+ wchar_t UnicodeFromCID(uint16_t CID);
private:
CIDSet m_Charset;
@@ -192,7 +192,7 @@ class CPDF_ToUnicodeMap {
void Load(CPDF_Stream* pStream);
CFX_WideString Lookup(uint32_t charcode) const;
- uint32_t ReverseLookup(FX_WCHAR unicode) const;
+ uint32_t ReverseLookup(wchar_t unicode) const;
private:
friend class fpdf_font_StringToCode_Test;
diff --git a/core/fpdfapi/font/fpdf_font.cpp b/core/fpdfapi/font/fpdf_font.cpp
index 86beccaeb4..706ae62cd9 100644
--- a/core/fpdfapi/font/fpdf_font.cpp
+++ b/core/fpdfapi/font/fpdf_font.cpp
@@ -100,11 +100,11 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
auto it = m_Map.find(charcode);
if (it != m_Map.end()) {
uint32_t value = it->second;
- FX_WCHAR unicode = (FX_WCHAR)(value & 0xffff);
+ wchar_t unicode = (wchar_t)(value & 0xffff);
if (unicode != 0xffff) {
return unicode;
}
- const FX_WCHAR* buf = m_MultiCharBuf.GetBuffer();
+ const wchar_t* buf = m_MultiCharBuf.GetBuffer();
uint32_t buf_len = m_MultiCharBuf.GetLength();
if (!buf || buf_len == 0) {
return CFX_WideString();
@@ -125,7 +125,7 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
return CFX_WideString();
}
-uint32_t CPDF_ToUnicodeMap::ReverseLookup(FX_WCHAR unicode) const {
+uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
for (const auto& pair : m_Map) {
if (pair.second == static_cast<uint32_t>(unicode))
return pair.first;
@@ -155,9 +155,9 @@ uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
static CFX_WideString StringDataAdd(CFX_WideString str) {
CFX_WideString ret;
int len = str.GetLength();
- FX_WCHAR value = 1;
+ wchar_t value = 1;
for (int i = len - 1; i >= 0; --i) {
- FX_WCHAR ch = str[i] + value;
+ wchar_t ch = str[i] + value;
if (ch < str[i]) {
ret.Insert(0, 0);
} else {
@@ -181,7 +181,7 @@ CFX_WideString CPDF_ToUnicodeMap::StringToWideString(
CFX_WideString result;
if (str[0] == '<') {
int byte_pos = 0;
- FX_WCHAR ch = 0;
+ wchar_t ch = 0;
for (int i = 1; i < len && std::isxdigit(str[i]); ++i) {
ch = ch * 16 + FXSYS_toHexDigit(str[i]);
byte_pos++;
diff --git a/core/fpdfapi/font/fpdf_font_cid.cpp b/core/fpdfapi/font/fpdf_font_cid.cpp
index afb186d070..e6be712a13 100644
--- a/core/fpdfapi/font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/font/fpdf_font_cid.cpp
@@ -23,12 +23,12 @@
namespace {
-const FX_CHAR* const g_CharsetNames[CIDSET_NUM_SETS] = {
- nullptr, "GB1", "CNS1", "Japan1", "Korea1", "UCS"};
+const char* const g_CharsetNames[CIDSET_NUM_SETS] = {nullptr, "GB1", "CNS1",
+ "Japan1", "Korea1", "UCS"};
class CPDF_PredefinedCMap {
public:
- const FX_CHAR* m_pName;
+ const char* m_pName;
CIDSet m_Charset;
CIDCoding m_Coding;
CPDF_CMap::CodingScheme m_CodingScheme;
@@ -306,7 +306,7 @@ std::unique_ptr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
const CFX_ByteString& name,
bool bPromptCJK) {
auto pCMap = pdfium::MakeUnique<CPDF_CMap>();
- const FX_CHAR* pname = name.c_str();
+ const char* pname = name.c_str();
if (*pname == '/')
pname++;
@@ -451,7 +451,7 @@ uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
}
for (int i = 0; i < word.GetLength() && std::isdigit(word.GetAt(i)); ++i) {
- num = num * 10 + FXSYS_toDecimalDigit(static_cast<FX_WCHAR>(word.GetAt(i)));
+ num = num * 10 + FXSYS_toDecimalDigit(static_cast<wchar_t>(word.GetAt(i)));
if (!num.IsValid())
return 0;
}
@@ -610,7 +610,7 @@ uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const {
return m_pMapping[charcode];
}
-uint32_t CPDF_CMap::GetNextChar(const FX_CHAR* pString,
+uint32_t CPDF_CMap::GetNextChar(const char* pString,
int nStrLen,
int& offset) const {
switch (m_CodingScheme) {
@@ -676,7 +676,7 @@ int CPDF_CMap::GetCharSize(uint32_t charcode) const {
}
return 1;
}
-int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const {
+int CPDF_CMap::CountChar(const char* pString, int size) const {
switch (m_CodingScheme) {
case OneByte:
return size;
@@ -704,7 +704,7 @@ int CPDF_CMap::CountChar(const FX_CHAR* pString, int size) const {
return size;
}
-int CPDF_CMap::AppendChar(FX_CHAR* str, uint32_t charcode) const {
+int CPDF_CMap::AppendChar(char* str, uint32_t charcode) const {
switch (m_CodingScheme) {
case OneByte:
str[0] = (uint8_t)charcode;
@@ -757,7 +757,7 @@ bool CPDF_CID2UnicodeMap::IsLoaded() {
return m_EmbeddedCount != 0;
}
-FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) {
+wchar_t CPDF_CID2UnicodeMap::UnicodeFromCID(uint16_t CID) {
if (m_Charset == CIDSET_UNICODE) {
return CID;
}