summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_font')
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp22
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.h6
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_font.cpp24
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.cpp12
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.h4
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_truetypefont.h2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type1font.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type1font.h2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.cpp6
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.h2
-rw-r--r--core/fpdfapi/fpdf_font/font_int.h4
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp6
-rw-r--r--core/fpdfapi/fpdf_font/include/cpdf_font.h17
14 files changed, 55 insertions, 56 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index 27025ad1dc..35d30b3fe3 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -227,7 +227,7 @@ uint16_t CPDF_CIDFont::CIDFromCharCode(uint32_t charcode) const {
: static_cast<uint16_t>(charcode);
}
-FX_BOOL CPDF_CIDFont::IsVertWriting() const {
+bool CPDF_CIDFont::IsVertWriting() const {
return m_pCMap && m_pCMap->IsVertWriting();
}
@@ -318,19 +318,19 @@ uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
return 0;
}
-FX_BOOL CPDF_CIDFont::Load() {
+bool CPDF_CIDFont::Load() {
if (m_pFontDict->GetStringFor("Subtype") == "TrueType") {
LoadGB2312();
- return TRUE;
+ return true;
}
CPDF_Array* pFonts = m_pFontDict->GetArrayFor("DescendantFonts");
if (!pFonts || pFonts->GetCount() != 1)
- return FALSE;
+ return false;
CPDF_Dictionary* pCIDFontDict = pFonts->GetDictAt(0);
if (!pCIDFontDict)
- return FALSE;
+ return false;
m_BaseFont = pCIDFontDict->GetStringFor("BaseFont");
if ((m_BaseFont.Compare("CourierStd") == 0 ||
@@ -346,7 +346,7 @@ FX_BOOL CPDF_CIDFont::Load() {
CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
if (!pEncoding)
- return FALSE;
+ return false;
CFX_ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
m_bType1 = (subtype == "CIDFontType0");
@@ -357,7 +357,7 @@ FX_BOOL CPDF_CIDFont::Load() {
bool bPromptCJK = m_pFontFile && m_bType1;
m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK);
if (!m_pCMap)
- return FALSE;
+ return false;
} else if (CPDF_Stream* pStream = pEncoding->AsStream()) {
m_pCMap = new CPDF_CMap;
m_pAllocatedCMap.reset(m_pCMap);
@@ -365,7 +365,7 @@ FX_BOOL CPDF_CIDFont::Load() {
acc.LoadAllData(pStream, FALSE);
m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
} else {
- return FALSE;
+ return false;
}
m_Charset = m_pCMap->m_Charset;
@@ -425,7 +425,7 @@ FX_BOOL CPDF_CIDFont::Load() {
m_DefaultW1 = -1000;
}
}
- return TRUE;
+ return true;
}
FX_RECT CPDF_CIDFont::GetCharBBox(uint32_t charcode, int level) {
@@ -755,9 +755,9 @@ int CPDF_CIDFont::AppendChar(FX_CHAR* str, uint32_t charcode) const {
return m_pCMap->AppendChar(str, charcode);
}
-FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const {
+bool CPDF_CIDFont::IsUnicodeCompatible() const {
if (m_pCID2UnicodeMap && m_pCID2UnicodeMap->IsLoaded() && m_pCMap->IsLoaded())
- return TRUE;
+ return true;
return m_pCMap->m_Coding != CIDCODING_UNKNOWN;
}
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.h b/core/fpdfapi/fpdf_font/cpdf_cidfont.h
index 1a5ce07cf0..400bcca8c6 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.h
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.h
@@ -49,9 +49,9 @@ class CPDF_CIDFont : public CPDF_Font {
int CountChar(const FX_CHAR* pString, int size) const override;
int AppendChar(FX_CHAR* str, uint32_t charcode) const override;
int GetCharSize(uint32_t charcode) const override;
- FX_BOOL IsVertWriting() const override;
- FX_BOOL IsUnicodeCompatible() const override;
- FX_BOOL Load() 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;
diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp
index 64511c8025..e2eb2e567e 100644
--- a/core/fpdfapi/fpdf_font/cpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp
@@ -50,7 +50,7 @@ void GetPredefinedEncoding(const CFX_ByteString& value, int* basemap) {
CPDF_Font::CPDF_Font()
: m_pFontFile(nullptr),
m_pFontDict(nullptr),
- m_bToUnicodeLoaded(FALSE),
+ m_bToUnicodeLoaded(false),
m_Flags(0),
m_StemV(0),
m_Ascent(0),
@@ -112,8 +112,8 @@ CPDF_CIDFont* CPDF_Font::AsCIDFont() {
return nullptr;
}
-FX_BOOL CPDF_Font::IsUnicodeCompatible() const {
- return FALSE;
+bool CPDF_Font::IsUnicodeCompatible() const {
+ return false;
}
int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const {
@@ -128,7 +128,7 @@ int CPDF_Font::GlyphFromCharCodeExt(uint32_t charcode) {
return GlyphFromCharCode(charcode, nullptr);
}
-FX_BOOL CPDF_Font::IsVertWriting() const {
+bool CPDF_Font::IsVertWriting() const {
const CPDF_CIDFont* pCIDFont = AsCIDFont();
return pCIDFont ? pCIDFont->IsVertWriting() : m_Font.IsVertical();
}
@@ -276,7 +276,7 @@ void CPDF_Font::CheckFontMetrics() {
}
void CPDF_Font::LoadUnicodeMap() const {
- m_bToUnicodeLoaded = TRUE;
+ m_bToUnicodeLoaded = true;
CPDF_Stream* pStream = m_pFontDict->GetStreamFor("ToUnicode");
if (!pStream) {
return;
@@ -358,8 +358,8 @@ uint32_t CPDF_Font::GetNextChar(const FX_CHAR* pString,
void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
std::vector<CFX_ByteString>* pCharNames,
- FX_BOOL bEmbedded,
- FX_BOOL bTrueType) {
+ bool bEmbedded,
+ bool bTrueType) {
if (!pEncoding) {
if (m_BaseFont == "Symbol") {
iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL
@@ -424,14 +424,14 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
}
}
-FX_BOOL CPDF_Font::IsStandardFont() const {
+bool CPDF_Font::IsStandardFont() const {
if (!IsType1Font())
- return FALSE;
+ return false;
if (m_pFontFile)
- return FALSE;
+ return false;
if (AsType1Font()->GetBase14Font() < 0)
- return FALSE;
- return TRUE;
+ return false;
+ return true;
}
const FX_CHAR* CPDF_Font::GetAdobeCharName(
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
index fbc1a64e30..2668efa7b0 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
@@ -101,7 +101,7 @@ FX_RECT CPDF_SimpleFont::GetCharBBox(uint32_t charcode, int level) {
return m_CharBBox[charcode];
}
-FX_BOOL CPDF_SimpleFont::LoadCommon() {
+bool CPDF_SimpleFont::LoadCommon() {
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictFor("FontDescriptor");
if (pFontDesc) {
LoadFontDescriptor(pFontDesc);
@@ -142,7 +142,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
LoadGlyphMap();
m_CharNames.clear();
if (!m_Font.GetFace())
- return TRUE;
+ return true;
if (m_Flags & PDFFONT_ALLCAP) {
unsigned char kLowercases[][2] = {{'a', 'z'}, {0xe0, 0xf6}, {0xf8, 0xfd}};
@@ -162,7 +162,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
}
}
CheckFontMetrics();
- return TRUE;
+ return true;
}
void CPDF_SimpleFont::LoadSubstFont() {
@@ -188,11 +188,11 @@ void CPDF_SimpleFont::LoadSubstFont() {
else
safeStemV = safeStemV * 4 + 140;
m_Font.LoadSubst(m_BaseFont, IsTrueTypeFont(), m_Flags,
- safeStemV.ValueOrDefault(FXFONT_FW_NORMAL), m_ItalicAngle,
- 0);
+ safeStemV.ValueOrDefault(FXFONT_FW_NORMAL), m_ItalicAngle, 0,
+ false);
}
-FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const {
+bool CPDF_SimpleFont::IsUnicodeCompatible() const {
return m_BaseEncoding != PDFFONT_ENCODING_BUILTIN &&
m_BaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS;
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.h b/core/fpdfapi/fpdf_font/cpdf_simplefont.h
index 59eb9be012..40a4baeeb8 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.h
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.h
@@ -23,7 +23,7 @@ class CPDF_SimpleFont : public CPDF_Font {
int GetCharWidthF(uint32_t charcode, int level = 0) override;
FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override;
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
- FX_BOOL IsUnicodeCompatible() const override;
+ bool IsUnicodeCompatible() const override;
CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override;
@@ -32,7 +32,7 @@ class CPDF_SimpleFont : public CPDF_Font {
protected:
virtual void LoadGlyphMap() = 0;
- FX_BOOL LoadCommon();
+ bool LoadCommon();
void LoadSubstFont();
void LoadCharMetrics(int charcode);
diff --git a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
index d54553ab10..841fb79288 100644
--- a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
@@ -30,7 +30,7 @@ CPDF_TrueTypeFont* CPDF_TrueTypeFont::AsTrueTypeFont() {
return this;
}
-FX_BOOL CPDF_TrueTypeFont::Load() {
+bool CPDF_TrueTypeFont::Load() {
return LoadCommon();
}
diff --git a/core/fpdfapi/fpdf_font/cpdf_truetypefont.h b/core/fpdfapi/fpdf_font/cpdf_truetypefont.h
index 46b19e513d..1131371d18 100644
--- a/core/fpdfapi/fpdf_font/cpdf_truetypefont.h
+++ b/core/fpdfapi/fpdf_font/cpdf_truetypefont.h
@@ -21,7 +21,7 @@ class CPDF_TrueTypeFont : public CPDF_SimpleFont {
protected:
// CPDF_Font:
- FX_BOOL Load() override;
+ bool Load() override;
// CPDF_SimpleFont:
void LoadGlyphMap() override;
diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
index 72fc947d31..5b1d976625 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
@@ -77,7 +77,7 @@ CPDF_Type1Font* CPDF_Type1Font::AsType1Font() {
return this;
}
-FX_BOOL CPDF_Type1Font::Load() {
+bool CPDF_Type1Font::Load() {
m_Base14Font = PDF_GetStandardFontName(&m_BaseFont);
if (m_Base14Font >= 0) {
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictFor("FontDescriptor");
diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.h b/core/fpdfapi/fpdf_font/cpdf_type1font.h
index 188b766c8a..e13238f4e4 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type1font.h
+++ b/core/fpdfapi/fpdf_font/cpdf_type1font.h
@@ -24,7 +24,7 @@ class CPDF_Type1Font : public CPDF_SimpleFont {
protected:
// CPDF_Font:
- FX_BOOL Load() override;
+ bool Load() override;
// CPDF_SimpleFont:
void LoadGlyphMap() override;
diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
index 69857575b5..520ffa64d9 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
@@ -37,7 +37,7 @@ CPDF_Type3Font* CPDF_Type3Font::AsType3Font() {
return this;
}
-FX_BOOL CPDF_Type3Font::Load() {
+bool CPDF_Type3Font::Load() {
m_pFontResources = m_pFontDict->GetDictFor("Resources");
CPDF_Array* pMatrix = m_pFontDict->GetArrayFor("FontMatrix");
FX_FLOAT xscale = 1.0f, yscale = 1.0f;
@@ -69,7 +69,7 @@ FX_BOOL CPDF_Type3Font::Load() {
m_pCharProcs = m_pFontDict->GetDictFor("CharProcs");
CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
if (pEncoding) {
- LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, FALSE, FALSE);
+ LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, false, false);
if (!m_CharNames.empty()) {
for (int i = 0; i < 256; i++) {
m_Encoding.m_Unicodes[i] =
@@ -80,7 +80,7 @@ FX_BOOL CPDF_Type3Font::Load() {
}
}
}
- return TRUE;
+ return true;
}
void CPDF_Type3Font::CheckType3FontMetrics() {
diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.h b/core/fpdfapi/fpdf_font/cpdf_type3font.h
index c5e99534e0..c66b270b18 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type3font.h
+++ b/core/fpdfapi/fpdf_font/cpdf_type3font.h
@@ -42,7 +42,7 @@ class CPDF_Type3Font : public CPDF_SimpleFont {
private:
// CPDF_Font:
- FX_BOOL Load() override;
+ bool Load() override;
// CPDF_SimpleFont:
void LoadGlyphMap() override {}
diff --git a/core/fpdfapi/fpdf_font/font_int.h b/core/fpdfapi/fpdf_font/font_int.h
index bcadc8d826..f0d5724577 100644
--- a/core/fpdfapi/fpdf_font/font_int.h
+++ b/core/fpdfapi/fpdf_font/font_int.h
@@ -141,7 +141,7 @@ class CPDF_CMap {
FX_BOOL LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
FX_BOOL IsLoaded() const;
- FX_BOOL IsVertWriting() const;
+ 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;
@@ -153,7 +153,7 @@ class CPDF_CMap {
friend class CPDF_CIDFont;
CFX_ByteString m_PredefinedCMap;
- FX_BOOL m_bVertical;
+ bool m_bVertical;
CIDSet m_Charset;
int m_Coding;
CodingScheme m_CodingScheme;
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 96c1ef5753..f3c5f05d51 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -405,7 +405,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
} else if (m_Status == 5) {
m_Status = 0;
} else if (m_Status == 6) {
- m_pCMap->m_bVertical = CMap_GetCode(word);
+ m_pCMap->m_bVertical = CMap_GetCode(word) != 0;
m_Status = 0;
} else if (m_Status == 7) {
if (word == "endcodespacerange") {
@@ -499,7 +499,7 @@ CPDF_CMap::CPDF_CMap() {
m_Charset = CIDSET_UNKNOWN;
m_Coding = CIDCODING_UNKNOWN;
m_CodingScheme = TwoBytes;
- m_bVertical = 0;
+ m_bVertical = false;
m_bLoaded = FALSE;
m_pMapping = nullptr;
m_pLeadingBytes = nullptr;
@@ -517,7 +517,7 @@ FX_BOOL CPDF_CMap::IsLoaded() const {
return m_bLoaded;
}
-FX_BOOL CPDF_CMap::IsVertWriting() const {
+bool CPDF_CMap::IsVertWriting() const {
return m_bVertical;
}
diff --git a/core/fpdfapi/fpdf_font/include/cpdf_font.h b/core/fpdfapi/fpdf_font/include/cpdf_font.h
index eb91524320..f3985546fe 100644
--- a/core/fpdfapi/fpdf_font/include/cpdf_font.h
+++ b/core/fpdfapi/fpdf_font/include/cpdf_font.h
@@ -59,8 +59,8 @@ class CPDF_Font {
virtual const CPDF_CIDFont* AsCIDFont() const;
virtual CPDF_CIDFont* AsCIDFont();
- virtual FX_BOOL IsVertWriting() const;
- virtual FX_BOOL IsUnicodeCompatible() const;
+ virtual bool IsVertWriting() const;
+ virtual bool IsUnicodeCompatible() const;
virtual uint32_t GetNextChar(const FX_CHAR* pString,
int nStrLen,
int& offset) const;
@@ -75,10 +75,10 @@ class CPDF_Font {
const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
uint32_t GetFlags() const { return m_Flags; }
- FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
+ bool IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; }
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
- FX_BOOL IsStandardFont() const;
+ bool IsStandardFont() const;
FXFT_Face GetFace() const { return m_Font.GetFace(); }
void AppendChar(CFX_ByteString& str, uint32_t charcode) const;
@@ -101,15 +101,14 @@ class CPDF_Font {
protected:
CPDF_Font();
- virtual FX_BOOL Load() = 0;
+ virtual bool Load() = 0;
- FX_BOOL Initialize();
void LoadUnicodeMap() const; // logically const only.
void LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
std::vector<CFX_ByteString>* pCharNames,
- FX_BOOL bEmbedded,
- FX_BOOL bTrueType);
+ bool bEmbedded,
+ bool bTrueType);
void LoadFontDescriptor(CPDF_Dictionary* pDict);
void CheckFontMetrics();
@@ -121,7 +120,7 @@ class CPDF_Font {
CPDF_StreamAcc* m_pFontFile;
CPDF_Dictionary* m_pFontDict;
mutable std::unique_ptr<CPDF_ToUnicodeMap> m_pToUnicodeMap;
- mutable FX_BOOL m_bToUnicodeLoaded;
+ mutable bool m_bToUnicodeLoaded;
int m_Flags;
FX_RECT m_FontBBox;
int m_StemV;