summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_font
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-27 11:55:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-27 11:55:29 -0700
commitff46aaf499edcf153ee2f57c7016587aa96dcfa0 (patch)
tree0a0d92713af476897899b126d180cc6294433d10 /core/src/fpdfapi/fpdf_font
parentaafeff816e22c1333c17d8a0eb4fe8927c28142d (diff)
downloadpdfium-ff46aaf499edcf153ee2f57c7016587aa96dcfa0.tar.xz
FX Bool considered harmful, part 3
Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_font')
-rw-r--r--core/src/fpdfapi/fpdf_font/font_int.h34
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp152
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp138
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.cpp10
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.h10
5 files changed, 172 insertions, 172 deletions
diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h
index f57e52758a..e52540853d 100644
--- a/core/src/fpdfapi/fpdf_font/font_int.h
+++ b/core/src/fpdfapi/fpdf_font/font_int.h
@@ -12,15 +12,15 @@ class CPDF_CMapManager
public:
CPDF_CMapManager();
~CPDF_CMapManager();
- void* GetPackage(FX_BOOL bPrompt);
- CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPrompt);
- CPDF_CID2UnicodeMap* GetCID2UnicodeMap(int charset, FX_BOOL bPrompt);
+ void* GetPackage(bool bPrompt);
+ CPDF_CMap* GetPredefinedCMap(const CFX_ByteString& name, bool bPrompt);
+ CPDF_CID2UnicodeMap* GetCID2UnicodeMap(int charset, bool bPrompt);
void ReloadAll();
private:
- CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPrompt);
- CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(int charset, FX_BOOL bPrompt);
- void DropAll(FX_BOOL bReload);
- FX_BOOL m_bPrompted;
+ CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, bool bPrompt);
+ CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(int charset, bool bPrompt);
+ void DropAll(bool bReload);
+ bool m_bPrompted;
CFX_MapByteStringToPtr m_CMaps;
CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6];
};
@@ -56,7 +56,7 @@ class CPDF_CMapParser
public:
CPDF_CMapParser();
~CPDF_CMapParser() {}
- FX_BOOL Initialize(CPDF_CMap*);
+ bool Initialize(CPDF_CMap*);
void ParseWord(const CFX_ByteStringC& str);
CFX_BinaryBuf m_AddMaps;
private:
@@ -80,10 +80,10 @@ class CPDF_CMap
{
public:
CPDF_CMap();
- FX_BOOL LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, FX_BOOL bPromptCJK);
- FX_BOOL LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize);
+ bool LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* name, bool bPromptCJK);
+ bool LoadEmbedded(const uint8_t* pData, FX_DWORD dwSize);
void Release();
- FX_BOOL IsLoaded() const
+ bool IsLoaded() const
{
return m_bLoaded;
}
@@ -91,7 +91,7 @@ public:
{
return m_Charset;
}
- FX_BOOL IsVertWriting() const
+ bool IsVertWriting() const
{
return m_bVertical;
}
@@ -109,14 +109,14 @@ protected:
friend class CPDF_CIDFont;
protected:
CFX_ByteString m_PredefinedCMap;
- FX_BOOL m_bVertical;
+ bool m_bVertical;
int m_Charset, m_Coding;
CodingScheme m_CodingScheme;
int m_nCodeRanges;
uint8_t* m_pLeadingBytes;
FX_WORD* m_pMapping;
uint8_t* m_pAddMapping;
- FX_BOOL m_bLoaded;
+ bool m_bLoaded;
const FXCMAP_CMap* m_pEmbedMap;
CPDF_CMap* m_pUseMap;
};
@@ -146,9 +146,9 @@ class CPDF_CID2UnicodeMap
public:
CPDF_CID2UnicodeMap();
~CPDF_CID2UnicodeMap();
- FX_BOOL Initialize();
- FX_BOOL IsLoaded();
- void Load(CPDF_CMapManager* pMgr, int charset, FX_BOOL bPromptCJK);
+ bool Initialize();
+ bool IsLoaded();
+ void Load(CPDF_CMapManager* pMgr, int charset, bool bPromptCJK);
FX_WCHAR UnicodeFromCID(FX_WORD CID);
protected:
int m_Charset;
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 8037a8c674..afcce6d18c 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -12,16 +12,16 @@
#include "../fpdf_page/pageint.h"
#include "font_int.h"
-FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id)
+bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id)
{
for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i ++) {
if (FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(face)[i]) == platform_id &&
FXFT_Get_Charmap_EncodingID(FXFT_Get_Face_Charmaps(face)[i]) == encoding_id) {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
CPDF_FontGlobals::CPDF_FontGlobals()
: m_pContrastRamps(NULL)
@@ -120,7 +120,7 @@ CPDF_Font::CPDF_Font(int fonttype) : m_FontType(fonttype)
m_pFontFile = NULL;
m_Flags = 0;
m_pToUnicodeMap = NULL;
- m_bToUnicodeLoaded = FALSE;
+ m_bToUnicodeLoaded = false;
m_pCharMap = new CPDF_FontCharMap(this);
}
CPDF_Font::~CPDF_Font()
@@ -135,9 +135,9 @@ CPDF_Font::~CPDF_Font()
m_pDocument->GetPageData()->ReleaseFontFileStreamAcc((CPDF_Stream*)m_pFontFile->GetStream());
}
}
-FX_BOOL CPDF_Font::IsVertWriting() const
+bool CPDF_Font::IsVertWriting() const
{
- FX_BOOL bVertWriting = FALSE;
+ bool bVertWriting = false;
CPDF_CIDFont* pCIDFont = GetCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
@@ -236,33 +236,33 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc)
{
m_Flags = pFontDesc->GetInteger(FX_BSTRC("Flags"), PDFFONT_NONSYMBOLIC);
int ItalicAngle = 0;
- FX_BOOL bExistItalicAngle = FALSE;
+ bool bExistItalicAngle = false;
if (pFontDesc->KeyExist(FX_BSTRC("ItalicAngle"))) {
ItalicAngle = pFontDesc->GetInteger(FX_BSTRC("ItalicAngle"));
- bExistItalicAngle = TRUE;
+ bExistItalicAngle = true;
}
if (ItalicAngle < 0) {
m_Flags |= PDFFONT_ITALIC;
m_ItalicAngle = ItalicAngle;
}
- FX_BOOL bExistStemV = FALSE;
+ bool bExistStemV = false;
if (pFontDesc->KeyExist(FX_BSTRC("StemV"))) {
m_StemV = pFontDesc->GetInteger(FX_BSTRC("StemV"));
- bExistStemV = TRUE;
+ bExistStemV = true;
}
- FX_BOOL bExistAscent = FALSE;
+ bool bExistAscent = false;
if (pFontDesc->KeyExist(FX_BSTRC("Ascent"))) {
m_Ascent = pFontDesc->GetInteger(FX_BSTRC("Ascent"));
- bExistAscent = TRUE;
+ bExistAscent = true;
}
- FX_BOOL bExistDescent = FALSE;
+ bool bExistDescent = false;
if (pFontDesc->KeyExist(FX_BSTRC("Descent"))) {
m_Descent = pFontDesc->GetInteger(FX_BSTRC("Descent"));
- bExistDescent = TRUE;
+ bExistDescent = true;
}
- FX_BOOL bExistCapHeight = FALSE;
+ bool bExistCapHeight = false;
if (pFontDesc->KeyExist(FX_BSTRC("CapHeight"))) {
- bExistCapHeight = TRUE;
+ bExistCapHeight = true;
}
if (bExistItalicAngle && bExistAscent && bExistCapHeight && bExistDescent && bExistStemV) {
m_Flags |= PDFFONT_USEEXTERNATTR;
@@ -316,7 +316,7 @@ void CPDF_Font::CheckFontMetrics()
m_Ascent = TT2PDF(FXFT_Get_Face_Ascender(m_Font.m_Face), m_Font.m_Face);
m_Descent = TT2PDF(FXFT_Get_Face_Descender(m_Font.m_Face), m_Font.m_Face);
} else {
- FX_BOOL bFirst = TRUE;
+ bool bFirst = true;
for (int i = 0; i < 256; i ++) {
FX_RECT rect;
GetCharBBox(i, rect);
@@ -325,7 +325,7 @@ void CPDF_Font::CheckFontMetrics()
}
if (bFirst) {
m_FontBBox = rect;
- bFirst = FALSE;
+ bFirst = false;
} else {
if (m_FontBBox.top < rect.top) {
m_FontBBox.top = rect.top;
@@ -361,7 +361,7 @@ void CPDF_Font::CheckFontMetrics()
}
void CPDF_Font::LoadUnicodeMap()
{
- m_bToUnicodeLoaded = TRUE;
+ m_bToUnicodeLoaded = true;
CPDF_Stream* pStream = m_pFontDict->GetStream(FX_BSTRC("ToUnicode"));
if (pStream == NULL) {
return;
@@ -466,10 +466,10 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic
}
return pFont;
}
-FX_BOOL CPDF_Font::Load()
+bool CPDF_Font::Load()
{
if (m_pFontDict == NULL) {
- return FALSE;
+ return false;
}
CFX_ByteString type = m_pFontDict->GetString(FX_BSTRC("Subtype"));
m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont"));
@@ -623,7 +623,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream)
{
int CIDSet = 0;
CPDF_StreamAcc stream;
- stream.LoadAllData(pStream, FALSE);
+ stream.LoadAllData(pStream, false);
CPDF_SimpleParser parser(stream.GetData(), stream.GetSize());
m_Map.EstimateSize(stream.GetSize() / 8, 1024);
while (1) {
@@ -719,12 +719,12 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream)
}
}
if (CIDSet) {
- m_pBaseMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(CIDSet, FALSE);
+ m_pBaseMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(CIDSet, false);
} else {
m_pBaseMap = NULL;
}
}
-static FX_BOOL GetPredefinedEncoding(int& basemap, const CFX_ByteString& value)
+static bool GetPredefinedEncoding(int& basemap, const CFX_ByteString& value)
{
if (value == FX_BSTRC("WinAnsiEncoding")) {
basemap = PDFFONT_ENCODING_WINANSI;
@@ -735,12 +735,12 @@ static FX_BOOL GetPredefinedEncoding(int& basemap, const CFX_ByteString& value)
} else if (value == FX_BSTRC("PDFDocEncoding")) {
basemap = PDFFONT_ENCODING_PDFDOC;
} else {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, int& iBaseEncoding, CFX_ByteString*& pCharNames,
- FX_BOOL bEmbedded, FX_BOOL bTrueType)
+ bool bEmbedded, bool bTrueType)
{
if (pEncoding == NULL) {
if (m_BaseFont == FX_BSTRC("Symbol")) {
@@ -802,18 +802,18 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, int& iBaseEncoding, CFX_
}
}
}
-FX_BOOL CPDF_Font::IsStandardFont() const
+bool CPDF_Font::IsStandardFont() const
{
if (m_FontType != PDFFONT_TYPE1) {
- return FALSE;
+ return false;
}
if (m_pFontFile != NULL) {
- return FALSE;
+ return false;
}
if (((CPDF_Type1Font*)this)->GetBase14Font() < 0) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype)
{
@@ -828,10 +828,10 @@ CPDF_SimpleFont::~CPDF_SimpleFont()
{
delete[] m_pCharNames;
}
-int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
+int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, bool *pVertGlyph)
{
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
if (charcode > 0xff) {
return -1;
@@ -923,7 +923,7 @@ const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNa
}
return name;
}
-FX_BOOL CPDF_SimpleFont::LoadCommon()
+bool CPDF_SimpleFont::LoadCommon()
{
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
if (pFontDesc) {
@@ -931,9 +931,9 @@ FX_BOOL CPDF_SimpleFont::LoadCommon()
}
CPDF_Array* pWidthArray = m_pFontDict->GetArray(FX_BSTRC("Widths"));
int width_start = 0, width_end = -1;
- m_bUseFontWidth = TRUE;
+ m_bUseFontWidth = true;
if (pWidthArray) {
- m_bUseFontWidth = FALSE;
+ m_bUseFontWidth = false;
if (pFontDesc && pFontDesc->KeyExist(FX_BSTRC("MissingWidth"))) {
int MissingWidth = pFontDesc->GetInteger(FX_BSTRC("MissingWidth"));
for (int i = 0; i < 256; i ++) {
@@ -970,7 +970,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon()
delete[] m_pCharNames;
m_pCharNames = NULL;
if (m_Font.m_Face == NULL) {
- return TRUE;
+ return true;
}
if (m_Flags & PDFFONT_ALLCAP) {
unsigned char lowercases[] = {'a', 'z', 0xe0, 0xf6, 0xf8, 0xfd};
@@ -988,7 +988,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon()
}
}
CheckFontMetrics();
- return TRUE;
+ return true;
}
void CPDF_SimpleFont::LoadSubstFont()
{
@@ -1013,7 +1013,7 @@ void CPDF_SimpleFont::LoadSubstFont()
if (m_Font.m_pSubstFont->m_SubstFlags & FXFONT_SUBST_NONSYMBOL) {
}
}
-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;
@@ -1022,7 +1022,7 @@ CPDF_Type1Font::CPDF_Type1Font() : CPDF_SimpleFont(PDFFONT_TYPE1)
{
m_Base14Font = -1;
}
-FX_BOOL CPDF_Type1Font::_Load()
+bool CPDF_Type1Font::_Load()
{
m_Base14Font = _PDF_GetStandardFontName(m_BaseFont);
if (m_Base14Font >= 0) {
@@ -1046,21 +1046,21 @@ FX_BOOL CPDF_Type1Font::_Load()
}
return LoadCommon();
}
-static FX_BOOL FT_UseType1Charmap(FXFT_Face face)
+static bool FT_UseType1Charmap(FXFT_Face face)
{
if (FXFT_Get_Face_CharmapCount(face) == 0) {
- return FALSE;
+ return false;
}
if (FXFT_Get_Face_CharmapCount(face) == 1 &&
FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == FXFT_ENCODING_UNICODE) {
- return FALSE;
+ return false;
}
if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) == FXFT_ENCODING_UNICODE) {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[1]);
} else {
FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
}
- return TRUE;
+ return true;
}
extern FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -1112,21 +1112,21 @@ void CPDF_Type1Font::LoadGlyphMap()
return;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- FX_BOOL bCoreText = TRUE;
+ bool bCoreText = true;
CQuartz2D & quartz2d = ((CApplePlatform *) CFX_GEModule::Get()->GetPlatformData())->_quartz2d;
if (!m_Font.m_pPlatformFont) {
if (m_Font.GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
- bCoreText = FALSE;
+ bCoreText = false;
}
m_Font.m_pPlatformFont = quartz2d.CreateFont(m_Font.m_pFontData, m_Font.m_dwSize);
if (NULL == m_Font.m_pPlatformFont) {
- bCoreText = FALSE;
+ bCoreText = false;
}
}
#endif
if (!IsEmbedded() && (m_Base14Font < 12) && m_Font.IsTTFont()) {
if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) {
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
for (int charcode = 0; charcode < 256; charcode ++) {
const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
for (int j = 0; j < 4; j ++) {
@@ -1143,7 +1143,7 @@ void CPDF_Type1Font::LoadGlyphMap()
}
#endif
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
break;
}
}
@@ -1237,9 +1237,9 @@ void CPDF_Type1Font::LoadGlyphMap()
}
return;
}
- FX_BOOL bUnicode = FALSE;
+ bool bUnicode = false;
if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
- bUnicode = TRUE;
+ bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode ++) {
const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
@@ -1315,9 +1315,9 @@ void CPDF_Type1Font::LoadGlyphMap()
#endif
return;
}
- FX_BOOL bUnicode = FALSE;
+ bool bUnicode = false;
if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
- bUnicode = TRUE;
+ bUnicode = true;
}
for (int charcode = 0; charcode < 256; charcode ++) {
const FX_CHAR* name = GetAdobeCharName(m_BaseEncoding, m_pCharNames, charcode);
@@ -1363,7 +1363,7 @@ CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding)
m_Unicodes[i] = pSrc[i];
}
}
-FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const
+bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const
{
return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == 0;
}
@@ -1372,10 +1372,10 @@ CPDF_Object* CPDF_FontEncoding::Realize()
int predefined = 0;
for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS; cs ++) {
const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(cs);
- FX_BOOL match = TRUE;
+ bool match = true;
for (int i = 0; i < 256; ++i) {
if (m_Unicodes[i] != pSrc[i]) {
- match = FALSE;
+ match = false;
break;
}
}
@@ -1413,7 +1413,7 @@ CPDF_Object* CPDF_FontEncoding::Realize()
CPDF_TrueTypeFont::CPDF_TrueTypeFont() : CPDF_SimpleFont(PDFFONT_TRUETYPE)
{
}
-FX_BOOL CPDF_TrueTypeFont::_Load()
+bool CPDF_TrueTypeFont::_Load()
{
return LoadCommon();
}
@@ -1426,14 +1426,14 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
if (m_pFontFile && m_Font.m_Face->num_charmaps > 0
&& (baseEncoding == PDFFONT_ENCODING_MACROMAN || baseEncoding == PDFFONT_ENCODING_WINANSI)
&& (m_Flags & PDFFONT_SYMBOLIC)) {
- FX_BOOL bSupportWin = FALSE;
- FX_BOOL bSupportMac = FALSE;
+ bool bSupportWin = false;
+ bool bSupportMac = false;
for (int i = 0; i < FXFT_Get_Face_CharmapCount(m_Font.m_Face); i++) {
int platform_id = FXFT_Get_Charmap_PlatformID(FXFT_Get_Face_Charmaps(m_Font.m_Face)[i]);
if (platform_id == 0 || platform_id == 3) {
- bSupportWin = TRUE;
+ bSupportWin = true;
} else if (platform_id == 0 || platform_id == 1) {
- bSupportMac = TRUE;
+ bSupportMac = true;
}
}
if (baseEncoding == PDFFONT_ENCODING_WINANSI && !bSupportWin) {
@@ -1459,8 +1459,8 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
return;
}
- FX_BOOL bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
- FX_BOOL bMacRoman = FALSE, bMSSymbol = FALSE;
+ bool bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
+ bool bMacRoman = false, bMSSymbol = false;
if (!bMSUnicode) {
if (m_Flags & PDFFONT_NONSYMBOLIC) {
bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0);
@@ -1470,7 +1470,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.m_Face, 1, 0);
}
}
- FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode"));
+ bool bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode"));
for (int charcode = 0; charcode < 256; charcode ++) {
const FX_CHAR* name = GetAdobeCharName(baseEncoding, m_pCharNames, charcode);
if (name == NULL) {
@@ -1523,13 +1523,13 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) {
const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
for (int charcode = 0; charcode < 256; charcode ++) {
for (int j = 0; j < 4; j ++) {
FX_WORD unicode = prefix[j] * 256 + charcode;
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode);
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
break;
}
}
@@ -1552,12 +1552,12 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
}
if (FT_UseTTCharmap(m_Font.m_Face, 1, 0)) {
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
for (int charcode = 0; charcode < 256; charcode ++) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, charcode);
m_Encoding.m_Unicodes[charcode] = FT_UnicodeFromCharCode(FXFT_ENCODING_APPLE_ROMAN, charcode);
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
}
}
if (m_pFontFile || bGotOne) {
@@ -1565,7 +1565,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
}
if (FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE) == 0) {
- FX_BOOL bGotOne = FALSE;
+ bool bGotOne = false;
const FX_WORD* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding);
for (int charcode = 0; charcode < 256; charcode ++) {
if (m_pFontFile == NULL) {
@@ -1580,7 +1580,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap()
}
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, m_Encoding.m_Unicodes[charcode]);
if (m_GlyphIndex[charcode]) {
- bGotOne = TRUE;
+ bGotOne = true;
}
}
if (bGotOne) {
@@ -1614,7 +1614,7 @@ CPDF_Type3Font::~CPDF_Type3Font()
delete (CPDF_Type3Char*)key;
}
}
-FX_BOOL CPDF_Type3Font::_Load()
+bool CPDF_Type3Font::_Load()
{
m_pFontResources = m_pFontDict->GetDict(FX_BSTRC("Resources"));
CPDF_Array* pMatrix = m_pFontDict->GetArray(FX_BSTRC("FontMatrix"));
@@ -1648,7 +1648,7 @@ FX_BOOL CPDF_Type3Font::_Load()
m_pCharProcs = m_pFontDict->GetDict(FX_BSTRC("CharProcs"));
CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
if (pEncoding) {
- LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE);
+ LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, false, false);
if (m_pCharNames) {
for (int i = 0; i < 256; i ++) {
m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]);
@@ -1658,7 +1658,7 @@ FX_BOOL CPDF_Type3Font::_Load()
}
}
}
- return TRUE;
+ return true;
}
void CPDF_Type3Font::CheckType3FontMetrics()
{
@@ -1736,8 +1736,8 @@ CPDF_Type3Char::CPDF_Type3Char()
{
m_pForm = NULL;
m_pBitmap = NULL;
- m_bPageRequired = FALSE;
- m_bColored = FALSE;
+ m_bPageRequired = false;
+ m_bColored = false;
}
CPDF_Type3Char::~CPDF_Type3Char()
{
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index f70b9ecfc4..8f95e59dee 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -13,18 +13,18 @@
#include "font_int.h"
extern short TT2PDF(int m, FXFT_Face face);
-extern FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id);
+extern bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id);
CPDF_CMapManager::CPDF_CMapManager()
{
- m_bPrompted = FALSE;
+ m_bPrompted = false;
FXSYS_memset(m_CID2UnicodeMaps, 0, sizeof m_CID2UnicodeMaps);
}
CPDF_CMapManager::~CPDF_CMapManager()
{
- DropAll(FALSE);
+ DropAll(false);
}
-CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK)
+CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK)
{
CPDF_CMap* pCMap;
if (m_CMaps.Lookup(name, (void*&)pCMap)) {
@@ -37,7 +37,7 @@ CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BO
m_CMaps.SetAt(name, pCMap);
return pCMap;
}
-CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK)
+CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, bool bPromptCJK)
{
CPDF_CMap* pCMap = new CPDF_CMap;
const FX_CHAR* pname = name;
@@ -59,9 +59,9 @@ int _CharsetFromOrdering(const CFX_ByteString& Ordering)
}
void CPDF_CMapManager::ReloadAll()
{
- DropAll(TRUE);
+ DropAll(true);
}
-void CPDF_CMapManager::DropAll(FX_BOOL bReload)
+void CPDF_CMapManager::DropAll(bool bReload)
{
FX_POSITION pos = m_CMaps.GetStartPosition();
while (pos) {
@@ -72,7 +72,7 @@ void CPDF_CMapManager::DropAll(FX_BOOL bReload)
continue;
}
if (bReload) {
- pCMap->LoadPredefined(this, name, FALSE);
+ pCMap->LoadPredefined(this, name, false);
} else {
delete pCMap;
}
@@ -83,20 +83,20 @@ void CPDF_CMapManager::DropAll(FX_BOOL bReload)
continue;
}
if (bReload) {
- pMap->Load(this, i, FALSE);
+ pMap->Load(this, i, false);
} else {
delete pMap;
}
}
}
-CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(int charset, FX_BOOL bPromptCJK)
+CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(int charset, bool bPromptCJK)
{
if (m_CID2UnicodeMaps[charset] == NULL) {
m_CID2UnicodeMaps[charset] = LoadCID2UnicodeMap(charset, bPromptCJK);
}
return m_CID2UnicodeMaps[charset];
}
-CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(int charset, FX_BOOL bPromptCJK)
+CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(int charset, bool bPromptCJK)
{
CPDF_CID2UnicodeMap* pMap = new CPDF_CID2UnicodeMap();
if (!pMap->Initialize()) {
@@ -112,13 +112,13 @@ CPDF_CMapParser::CPDF_CMapParser()
m_Status = 0;
m_CodeSeq = 0;
}
-FX_BOOL CPDF_CMapParser::Initialize(CPDF_CMap* pCMap)
+bool CPDF_CMapParser::Initialize(CPDF_CMap* pCMap)
{
m_pCMap = pCMap;
m_Status = 0;
m_CodeSeq = 0;
m_AddMaps.EstimateSize(0, 10240);
- return TRUE;
+ return true;
}
static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word)
{
@@ -147,10 +147,10 @@ static FX_DWORD CMap_GetCode(const CFX_ByteStringC& word)
}
return num;
}
-static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC& first, const CFX_ByteStringC& second)
+static bool _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC& first, const CFX_ByteStringC& second)
{
if (first.GetLength() == 0 || first.GetAt(0) != '<') {
- return FALSE;
+ return false;
}
int i;
for (i = 1; i < first.GetLength(); i ++)
@@ -159,7 +159,7 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC&
}
range.m_CharSize = (i - 1) / 2;
if (range.m_CharSize > 4) {
- return FALSE;
+ return false;
}
for (i = 0; i < range.m_CharSize; i ++) {
uint8_t digit1 = first.GetAt(i * 2 + 1);
@@ -176,7 +176,7 @@ static FX_BOOL _CMap_GetCodeRange(_CMap_CodeRange& range, const CFX_ByteStringC&
byte = byte * 16 + ((digit2 >= '0' && digit2 <= '9') ? (digit2 - '0') : ((digit2 & 0xdf) - 'A' + 10));
range.m_Upper[i] = byte;
}
- return TRUE;
+ return true;
}
static CFX_ByteString CMap_GetString(const CFX_ByteStringC& word)
{
@@ -282,7 +282,7 @@ CPDF_CMap::CPDF_CMap()
m_Coding = CIDCODING_UNKNOWN;
m_CodingScheme = TwoBytes;
m_bVertical = 0;
- m_bLoaded = FALSE;
+ m_bLoaded = false;
m_pMapping = NULL;
m_pLeadingBytes = NULL;
m_pAddMapping = NULL;
@@ -346,14 +346,14 @@ const CPDF_PredefinedCMap g_PredefinedCMaps[] = {
};
extern void FPDFAPI_FindEmbeddedCMap(const char* name, int charset, int coding, const FXCMAP_CMap*& pMap);
extern FX_WORD FPDFAPI_CIDFromCharCode(const FXCMAP_CMap* pMap, FX_DWORD charcode);
-FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName, FX_BOOL bPromptCJK)
+bool CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName, bool bPromptCJK)
{
m_PredefinedCMap = pName;
if (m_PredefinedCMap == FX_BSTRC("Identity-H") || m_PredefinedCMap == FX_BSTRC("Identity-V")) {
m_Coding = CIDCODING_CID;
m_bVertical = pName[9] == 'V';
- m_bLoaded = TRUE;
- return TRUE;
+ m_bLoaded = true;
+ return true;
}
CFX_ByteString cmapid = m_PredefinedCMap;
m_bVertical = cmapid.Right(1) == FX_BSTRC("V");
@@ -363,7 +363,7 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName,
int index = 0;
while (1) {
if (g_PredefinedCMaps[index].m_pName == NULL) {
- return FALSE;
+ return false;
}
if (cmapid == CFX_ByteStringC(g_PredefinedCMaps[index].m_pName)) {
break;
@@ -384,10 +384,10 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, const FX_CHAR* pName,
}
FPDFAPI_FindEmbeddedCMap(pName, m_Charset, m_Coding, m_pEmbedMap);
if (m_pEmbedMap) {
- m_bLoaded = TRUE;
- return TRUE;
+ m_bLoaded = true;
+ return true;
}
- return FALSE;
+ return false;
}
extern "C" {
static int compare_dword(const void* data1, const void* data2)
@@ -395,7 +395,7 @@ extern "C" {
return (*(FX_DWORD*)data1) - (*(FX_DWORD*)data2);
}
};
-FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size)
+bool CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size)
{
m_pMapping = FX_Alloc(FX_WORD, 65536);
CPDF_CMapParser parser;
@@ -414,7 +414,7 @@ FX_BOOL CPDF_CMap::LoadEmbedded(const uint8_t* pData, FX_DWORD size)
FXSYS_memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), parser.m_AddMaps.GetSize());
FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, compare_dword);
}
- return TRUE;
+ return true;
}
extern "C" {
static int compareCID(const void* key, const void* element)
@@ -668,11 +668,11 @@ CPDF_CID2UnicodeMap::CPDF_CID2UnicodeMap()
CPDF_CID2UnicodeMap::~CPDF_CID2UnicodeMap()
{
}
-FX_BOOL CPDF_CID2UnicodeMap::Initialize()
+bool CPDF_CID2UnicodeMap::Initialize()
{
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CID2UnicodeMap::IsLoaded()
+bool CPDF_CID2UnicodeMap::IsLoaded()
{
return m_EmbeddedCount != 0;
}
@@ -687,7 +687,7 @@ FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(FX_WORD CID)
return 0;
}
void FPDFAPI_LoadCID2UnicodeMap(int charset, const FX_WORD*& pMap, FX_DWORD& count);
-void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, int charset, FX_BOOL bPromptCJK)
+void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, int charset, bool bPromptCJK)
{
m_Charset = charset;
FPDFAPI_LoadCID2UnicodeMap(charset, m_pEmbeddedMap, m_EmbeddedCount);
@@ -700,8 +700,8 @@ CPDF_CIDFont::CPDF_CIDFont() : CPDF_Font(PDFFONT_CIDFONT)
m_pCID2UnicodeMap = NULL;
m_pAnsiWidths = NULL;
m_pCIDToGIDMap = NULL;
- m_bCIDIsGID = FALSE;
- m_bAdobeCourierStd = FALSE;
+ m_bCIDIsGID = false;
+ m_bAdobeCourierStd = false;
m_pTTGSUBTable = NULL;
FXSYS_memset(m_CharBBox, 0xff, 256 * sizeof(FX_SMALL_RECT));
}
@@ -721,9 +721,9 @@ FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const
}
return m_pCMap->CIDFromCharCode(charcode);
}
-FX_BOOL CPDF_CIDFont::IsVertWriting() const
+bool CPDF_CIDFont::IsVertWriting() const
{
- return m_pCMap ? m_pCMap->IsVertWriting() : FALSE;
+ return m_pCMap ? m_pCMap->IsVertWriting() : false;
}
extern FX_DWORD FPDFAPI_CharCodeFromCID(const FXCMAP_CMap* pMap, FX_WORD cid);
static FX_DWORD _EmbeddedCharcodeFromUnicode(const FXCMAP_CMap* pEmbedMap, int charset, FX_WCHAR unicode)
@@ -873,27 +873,27 @@ static void FT_UseCIDCharmap(FXFT_Face face, int coding)
FXFT_Set_Charmap(face, *FXFT_Get_Face_Charmaps(face));
}
}
-FX_BOOL CPDF_CIDFont::_Load()
+bool CPDF_CIDFont::_Load()
{
if (m_pFontDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("TrueType")) {
return LoadGB2312();
}
CPDF_Array* pFonts = m_pFontDict->GetArray(FX_BSTRC("DescendantFonts"));
if (pFonts == NULL) {
- return FALSE;
+ return false;
}
if (pFonts->GetCount() != 1) {
- return FALSE;
+ return false;
}
CPDF_Dictionary* pCIDFontDict = pFonts->GetDict(0);
if (pCIDFontDict == NULL) {
- return FALSE;
+ return false;
}
m_BaseFont = pCIDFontDict->GetString(FX_BSTRC("BaseFont"));
if ((m_BaseFont.Compare("CourierStd") == 0 || m_BaseFont.Compare("CourierStd-Bold") == 0
|| m_BaseFont.Compare("CourierStd-BoldOblique") == 0 || m_BaseFont.Compare("CourierStd-Oblique") == 0)
&& !IsEmbedded()) {
- m_bAdobeCourierStd = TRUE;
+ m_bAdobeCourierStd = true;
}
CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDict(FX_BSTRC("FontDescriptor"));
if (pFontDesc) {
@@ -901,12 +901,12 @@ FX_BOOL CPDF_CIDFont::_Load()
}
CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
if (pEncoding == NULL) {
- return FALSE;
+ return false;
}
CFX_ByteString subtype = pCIDFontDict->GetString(FX_BSTRC("Subtype"));
- m_bType1 = FALSE;
+ m_bType1 = false;
if (subtype == FX_BSTRC("CIDFontType0")) {
- m_bType1 = TRUE;
+ m_bType1 = true;
}
if (pEncoding->GetType() == PDFOBJ_NAME) {
CFX_ByteString cmap = pEncoding->GetString();
@@ -916,13 +916,13 @@ FX_BOOL CPDF_CIDFont::_Load()
m_pAllocatedCMap = m_pCMap = new CPDF_CMap;
CPDF_Stream* pStream = (CPDF_Stream*)pEncoding;
CPDF_StreamAcc acc;
- acc.LoadAllData(pStream, FALSE);
+ acc.LoadAllData(pStream, false);
m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize());
} else {
- return FALSE;
+ return false;
}
if (m_pCMap == NULL) {
- return FALSE;
+ return false;
}
m_Charset = m_pCMap->m_Charset;
if (m_Charset == CIDSET_UNKNOWN) {
@@ -955,14 +955,14 @@ FX_BOOL CPDF_CIDFont::_Load()
if (pmap) {
if (pmap->GetType() == PDFOBJ_STREAM) {
m_pCIDToGIDMap = new CPDF_StreamAcc;
- m_pCIDToGIDMap->LoadAllData((CPDF_Stream*)pmap, FALSE);
+ m_pCIDToGIDMap->LoadAllData((CPDF_Stream*)pmap, false);
} else if (pmap->GetString() == FX_BSTRC("Identity")) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_pFontFile) {
- m_bCIDIsGID = TRUE;
+ m_bCIDIsGID = true;
}
#else
- m_bCIDIsGID = TRUE;
+ m_bCIDIsGID = true;
#endif
}
}
@@ -983,7 +983,7 @@ FX_BOOL CPDF_CIDFont::_Load()
m_DefaultW1 = -1000;
}
}
- return TRUE;
+ return true;
}
FX_FLOAT _CIDTransformToFloat(uint8_t ch)
{
@@ -1001,7 +1001,7 @@ void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level)
rect.top = m_CharBBox[charcode].Top;
return;
}
- FX_BOOL bVert = FALSE;
+ bool bVert = false;
int glyph_index = GlyphFromCharCode(charcode, &bVert);
if (m_Font.m_Face == NULL) {
rect = FX_RECT(0, 0, 0, 0);
@@ -1120,10 +1120,10 @@ void CPDF_CIDFont::GetVertOrigin(FX_WORD CID, short& vx, short &vy) const
vx = (short)dwWidth / 2;
vy = (short)m_DefaultVY;
}
-int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph)
+int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, bool *pVertGlyph)
{
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
int index = FXFT_Get_Char_Index(m_Font.m_Face, unicode );
if (unicode == 0x2502) {
@@ -1136,7 +1136,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph)
if (vindex) {
index = vindex;
if (pVertGlyph) {
- *pVertGlyph = TRUE;
+ *pVertGlyph = true;
}
}
return index;
@@ -1157,21 +1157,21 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph)
if (vindex) {
index = vindex;
if (pVertGlyph) {
- *pVertGlyph = TRUE;
+ *pVertGlyph = true;
}
}
}
return index;
}
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
return index;
}
-int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
+int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, bool *pVertGlyph)
{
if (pVertGlyph) {
- *pVertGlyph = FALSE;
+ *pVertGlyph = false;
}
if (m_pFontFile == NULL && m_pCIDToGIDMap == NULL) {
FX_WORD cid = CIDFromCharCode(charcode);
@@ -1206,8 +1206,8 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph)
}
charcode += 31;
int index = 0, iBaseEncoding;
- FX_BOOL bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
- FX_BOOL bMacRoman = FALSE;
+ bool bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
+ bool bMacRoman = false;
if (!bMSUnicode) {
bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0);
}
@@ -1327,16 +1327,16 @@ int CPDF_CIDFont::AppendChar(FX_CHAR* str, FX_DWORD charcode) const
{
return m_pCMap->AppendChar(str, charcode);
}
-FX_BOOL CPDF_CIDFont::IsUnicodeCompatible() const
+bool CPDF_CIDFont::IsUnicodeCompatible() const
{
if (!m_pCMap->IsLoaded() || m_pCID2UnicodeMap == NULL || !m_pCID2UnicodeMap->IsLoaded()) {
return m_pCMap->m_Coding != CIDCODING_UNKNOWN;
}
- return TRUE;
+ return true;
}
-FX_BOOL CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const
+bool CPDF_CIDFont::IsFontStyleFromCharCode(FX_DWORD charcode) const
{
- return TRUE;
+ return true;
}
void CPDF_CIDFont::LoadSubstFont()
{
@@ -1390,7 +1390,7 @@ void CPDF_CIDFont::LoadMetricsArray(CPDF_Array* pArray, CFX_DWordArray& result,
}
}
}
-FX_BOOL CPDF_CIDFont::LoadGB2312()
+bool CPDF_CIDFont::LoadGB2312()
{
m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont"));
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
@@ -1398,10 +1398,10 @@ FX_BOOL CPDF_CIDFont::LoadGB2312()
LoadFontDescriptor(pFontDesc);
}
m_Charset = CIDSET_GB1;
- m_bType1 = FALSE;
+ m_bType1 = false;
m_pCMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetPredefinedCMap(
- FX_BSTRC("GBK-EUC-H"), FALSE);
- m_pCID2UnicodeMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(m_Charset, FALSE);
+ FX_BSTRC("GBK-EUC-H"), false);
+ m_pCID2UnicodeMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetCID2UnicodeMap(m_Charset, false);
if (!IsEmbedded()) {
LoadSubstFont();
}
@@ -1411,7 +1411,7 @@ FX_BOOL CPDF_CIDFont::LoadGB2312()
for (int i = 32; i < 127; i ++) {
m_pAnsiWidths[i] = 500;
}
- return TRUE;
+ return true;
}
const struct _CIDTransform {
FX_WORD CID;
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
index a65359c1d4..980e16c43e 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
@@ -48,15 +48,15 @@ void CFX_GlyphMap::SetAt(int key, int value)
}
m_Buffer.InsertBlock(low * sizeof(_IntPair), &pair, sizeof(_IntPair));
}
-FX_BOOL CFX_GlyphMap::Lookup(int key, int &value)
+bool CFX_GlyphMap::Lookup(int key, int &value)
{
void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(), m_Buffer.GetSize() / sizeof(_IntPair),
sizeof(_IntPair), _CompareInt);
if (pResult == NULL) {
- return FALSE;
+ return false;
}
value = ((FX_DWORD*)pResult)[1];
- return TRUE;
+ return true;
}
bool CFX_CTTGSUBTable::LoadGSUBTable(FT_Bytes gsub)
{
@@ -108,7 +108,7 @@ bool CFX_CTTGSUBTable::GetVerticalGlyph(TT_uint32_t glyphnum, TT_uint32_t *vglyp
}
}
}
- m_bFeautureMapLoad = TRUE;
+ m_bFeautureMapLoad = true;
}
FX_POSITION pos = m_featureMap.GetStartPosition();
while (pos) {
@@ -420,7 +420,7 @@ void CFX_CTTGSUBTable::ParseSingleSubstFormat2(FT_Bytes raw, TSingleSubstFormat2
rec->Substitute[i] = GetUInt16(sp);
}
}
-FX_BOOL CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum)
+bool CFX_GSUBTable::GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum)
{
return m_GsubImp.GetVerticalGlyph(glyphnum, vglyphnum);
}
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.h b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
index 1b18f82d6e..133667b4d8 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.h
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.h
@@ -17,15 +17,15 @@ public:
CFX_GlyphMap();
~CFX_GlyphMap();
void SetAt(int key, int value);
- FX_BOOL Lookup(int key, int &value);
+ bool Lookup(int key, int &value);
protected:
CFX_BinaryBuf m_Buffer;
};
class CFX_CTTGSUBTable
{
public:
- CFX_CTTGSUBTable(void): m_bFeautureMapLoad(FALSE), loaded(false) {};
- CFX_CTTGSUBTable(FT_Bytes gsub): m_bFeautureMapLoad(FALSE), loaded(false)
+ CFX_CTTGSUBTable(void): m_bFeautureMapLoad(false), loaded(false) {};
+ CFX_CTTGSUBTable(FT_Bytes gsub): m_bFeautureMapLoad(false), loaded(false)
{
LoadGSUBTable(gsub);
}
@@ -395,7 +395,7 @@ private:
return ret;
}
CFX_CMapDWordToDWord m_featureMap;
- FX_BOOL m_bFeautureMapLoad;
+ bool m_bFeautureMapLoad;
bool loaded;
struct tt_gsub_header header;
struct TScriptList ScriptList;
@@ -406,7 +406,7 @@ class CFX_GSUBTable final : public IFX_GSUBTable
{
public:
~CFX_GSUBTable() override {}
- virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override;
+ virtual bool GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) override;
CFX_CTTGSUBTable m_GsubImp;
};