summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-23 12:37:42 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-23 12:37:42 -0700
commit1b04bcc6af13669920700322052fc4ab4fad47a2 (patch)
tree14a70efd6df9acf3e5e0a611415e95955f1b5d8f
parent2a4e4ce8efaf8b6466962eef292a9876c17976ad (diff)
downloadpdfium-1b04bcc6af13669920700322052fc4ab4fad47a2.tar.xz
XFA: Manually apply changes to fpdf_text.h and fx_font.h from master
Driven off of https://codereview.chromium.org/1398383002/ Then make the other files as similar as possible. Note that this required changes to xfa/ code, and required adding some Set() methods. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1411833003 .
-rw-r--r--core/include/fpdftext/fpdf_text.h10
-rw-r--r--core/include/fxge/fx_font.h66
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp6
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp249
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp83
-rw-r--r--core/src/fpdfapi/fpdf_font/ttgsubtable.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp6
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp2
-rw-r--r--core/src/fpdftext/text_int.h2
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp24
-rw-r--r--xfa/src/fdp/src/fde/fde_gedevice.cpp14
-rw-r--r--xfa/src/fgas/src/font/fx_gefont.cpp39
-rw-r--r--xfa/src/fgas/src/font/fx_stdfontmgr.cpp6
13 files changed, 255 insertions, 268 deletions
diff --git a/core/include/fpdftext/fpdf_text.h b/core/include/fpdftext/fpdf_text.h
index f27f1db7e6..006499218e 100644
--- a/core/include/fpdftext/fpdf_text.h
+++ b/core/include/fpdftext/fpdf_text.h
@@ -72,23 +72,24 @@ class CPDFText_ParseOptions {
FX_BOOL m_bNormalizeObjs;
FX_BOOL m_bOutputHyphen;
};
+
class IPDF_TextPage {
public:
- virtual ~IPDF_TextPage() {}
+ static IPDF_TextPage* CreateTextPage(const CPDF_Page* pPage, int flags = 0);
static IPDF_TextPage* CreateTextPage(const CPDF_Page* pPage,
CPDFText_ParseOptions ParserOptions);
- static IPDF_TextPage* CreateTextPage(const CPDF_Page* pPage, int flags = 0);
static IPDF_TextPage* CreateTextPage(const CPDF_PageObjects* pObjs,
int flags = 0);
static IPDF_TextPage* CreateReflowTextPage(IPDF_ReflowedPage* pRefPage);
+ virtual ~IPDF_TextPage() {}
+
virtual void NormalizeObjects(FX_BOOL bNormalize) = 0;
virtual FX_BOOL ParseTextPage() = 0;
- virtual FX_BOOL IsParsered() const = 0;
+ virtual bool IsParsed() const = 0;
- public:
virtual int CharIndexFromTextIndex(int TextIndex) const = 0;
virtual int TextIndexFromCharIndex(int CharIndex) const = 0;
@@ -139,6 +140,7 @@ class IPDF_TextPage {
virtual CFX_WideString GetPageText(int start = 0, int nCount = -1) const = 0;
};
+
#define FPDFTEXT_MATCHCASE 0x00000001
#define FPDFTEXT_MATCHWHOLEWORD 0x00000002
#define FPDFTEXT_CONSECUTIVE 0x00000004
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
index 37431203b3..29b3da764a 100644
--- a/core/include/fxge/fx_font.h
+++ b/core/include/fxge/fx_font.h
@@ -34,8 +34,8 @@ class IFX_SystemFontInfo;
#define FXFONT_ITALIC 0x40
#define FXFONT_BOLD 0x40000
#define FXFONT_USEEXTERNATTR 0x80000
-#define FXFONT_EXACTMATCH 0x80000000
#define FXFONT_CIDFONT 0x100000
+#define FXFONT_EXACTMATCH 0x80000000
#define FXFONT_ANSI_CHARSET 0
#define FXFONT_DEFAULT_CHARSET 1
#define FXFONT_SYMBOL_CHARSET 2
@@ -56,6 +56,7 @@ class IFX_SystemFontInfo;
#define FXFONT_FF_SCRIPT (4 << 4)
#define FXFONT_FW_NORMAL 400
#define FXFONT_FW_BOLD 700
+
class CFX_Font {
public:
CFX_Font();
@@ -77,51 +78,42 @@ class CFX_Font {
FX_BOOL LoadClone(const CFX_Font* pFont);
FXFT_Face GetFace() const { return m_Face; }
-
- const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
-
+ CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
+ void SetFace(FXFT_Face face) { m_Face = face; }
+ void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; }
CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0);
-
int GetGlyphWidth(FX_DWORD glyph_index);
-
int GetAscent() const;
-
int GetDescent() const;
-
FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox);
-
- FX_BOOL IsItalic();
-
- FX_BOOL IsBold();
-
- FX_BOOL IsFixedWidth();
-
+ FX_BOOL IsItalic() const;
+ FX_BOOL IsBold() const;
+ FX_BOOL IsFixedWidth() const;
FX_BOOL IsVertical() const { return m_bVertical; }
-
CFX_WideString GetPsName() const;
-
CFX_ByteString GetFamilyName() const;
-
CFX_ByteString GetFaceName() const;
-
- FX_BOOL IsTTFont();
-
+ FX_BOOL IsTTFont() const;
FX_BOOL GetBBox(FX_RECT& bbox);
+ int GetHeight() const;
+ int GetULPos() const;
+ int GetULthickness() const;
+ int GetMaxAdvanceWidth() const;
+ FX_BOOL IsEmbedded() const { return m_bEmbedded; }
+ uint8_t* GetSubData() const { return m_pGsubData; }
+ void SetSubData(uint8_t* data) { m_pGsubData = data; }
+ void* GetPlatformFont() const { return m_pPlatformFont; }
+ void SetPlatformFont(void* font) { m_pPlatformFont = font; }
+ uint8_t* GetFontData() const { return m_pFontData; }
+ FX_DWORD GetSize() const { return m_dwSize; }
+ void AdjustMMParams(int glyph_index, int width, int weight);
- int GetHeight();
-
- int GetULPos();
-
- int GetULthickness();
-
- int GetMaxAdvanceWidth();
+ private:
+ void ReleasePlatformResource();
+ void DeleteFace();
FXFT_Face m_Face;
-
CFX_SubstFont* m_pSubstFont;
- FX_BOOL IsEmbedded() { return m_bEmbedded; }
-
- void AdjustMMParams(int glyph_index, int width, int weight);
uint8_t* m_pFontDataAllocation;
uint8_t* m_pFontData;
uint8_t* m_pGsubData;
@@ -132,16 +124,14 @@ class CFX_Font {
void* m_pPlatformFontCollection;
void* m_pDwFont;
FX_BOOL m_bDwLoaded;
- void ReleasePlatformResource();
-
- void DeleteFace();
-
- protected:
FX_BOOL m_bEmbedded;
FX_BOOL m_bVertical;
+
+ protected:
FX_BOOL m_bLogic;
void* m_pOwnedStream;
};
+
#define ENCODING_INTERNAL 0
#define ENCODING_UNICODE 1
@@ -239,6 +229,7 @@ class CFX_FontMgr {
~CFX_FontMgr();
void InitFTLibrary();
+
FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
int weight,
FX_BOOL bItalic,
@@ -312,7 +303,6 @@ class CFX_FontMapper {
m_pFontEnumerator = pFontEnumerator;
}
IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; }
-
FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
FX_BOOL bTrueType,
FX_DWORD flags,
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 72df84ed95..0f6d973a3a 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -978,7 +978,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
pFontDesc->SetAtInteger("Flags", flags);
pFontDesc->SetAtInteger(
"ItalicAngle",
- pFont->m_pSubstFont ? pFont->m_pSubstFont->m_ItalicAngle : 0);
+ pFont->GetSubstFont() ? pFont->GetSubstFont()->m_ItalicAngle : 0);
pFontDesc->SetAtInteger("Ascent", pFont->GetAscent());
pFontDesc->SetAtInteger("Descent", pFont->GetDescent());
FX_RECT bbox;
@@ -990,8 +990,8 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
pBBox->AddInteger(bbox.top);
pFontDesc->SetAt("FontBBox", pBBox);
int32_t nStemV = 0;
- if (pFont->m_pSubstFont) {
- nStemV = pFont->m_pSubstFont->m_Weight / 5;
+ if (pFont->GetSubstFont()) {
+ nStemV = pFont->GetSubstFont()->m_Weight / 5;
} else {
static const FX_CHAR stem_chars[] = {'i', 'I', '!', '1'};
const size_t count = sizeof(stem_chars) / sizeof(stem_chars[0]);
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 0236d4c334..543816b03a 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -212,6 +212,7 @@ CFX_ByteString CPDF_Font::EncodeString(const CFX_WideString& str) const {
result.ReleaseBuffer(dest_pos);
return result;
}
+
void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
m_Flags = pFontDesc->GetInteger(FX_BSTRC("Flags"), PDFFONT_NONSYMBOLIC);
int ItalicAngle = 0;
@@ -257,6 +258,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
m_FontBBox.right = pBBox->GetInteger(2);
m_FontBBox.top = pBBox->GetInteger(3);
}
+
CPDF_Stream* pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile"));
if (!pFontFile)
pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile2"));
@@ -271,10 +273,13 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
const uint8_t* pFontData = m_pFontFile->GetData();
FX_DWORD dwFontSize = m_pFontFile->GetSize();
- m_Font.LoadEmbedded(pFontData, dwFontSize);
- if (!m_Font.m_Face)
+ if (!m_Font.LoadEmbedded(pFontData, dwFontSize)) {
+ m_pDocument->GetPageData()->ReleaseFontFileStreamAcc(
+ const_cast<CPDF_Stream*>(m_pFontFile->GetStream()->AsStream()));
m_pFontFile = nullptr;
+ }
}
+
short TT2PDF(int m, FXFT_Face face) {
int upm = FXFT_Get_Face_UnitsPerEM(face);
if (upm == 0) {
@@ -285,16 +290,14 @@ short TT2PDF(int m, FXFT_Face face) {
void CPDF_Font::CheckFontMetrics() {
if (m_FontBBox.top == 0 && m_FontBBox.bottom == 0 && m_FontBBox.left == 0 &&
m_FontBBox.right == 0) {
- if (m_Font.m_Face) {
- m_FontBBox.left =
- TT2PDF(FXFT_Get_Face_xMin(m_Font.m_Face), m_Font.m_Face);
- m_FontBBox.bottom =
- TT2PDF(FXFT_Get_Face_yMin(m_Font.m_Face), m_Font.m_Face);
- m_FontBBox.right =
- TT2PDF(FXFT_Get_Face_xMax(m_Font.m_Face), m_Font.m_Face);
- m_FontBBox.top = TT2PDF(FXFT_Get_Face_yMax(m_Font.m_Face), m_Font.m_Face);
- 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);
+ FXFT_Face face = m_Font.GetFace();
+ if (face) {
+ m_FontBBox.left = TT2PDF(FXFT_Get_Face_xMin(face), face);
+ m_FontBBox.bottom = TT2PDF(FXFT_Get_Face_yMin(face), face);
+ m_FontBBox.right = TT2PDF(FXFT_Get_Face_xMax(face), face);
+ m_FontBBox.top = TT2PDF(FXFT_Get_Face_yMax(face), face);
+ m_Ascent = TT2PDF(FXFT_Get_Face_Ascender(face), face);
+ m_Descent = TT2PDF(FXFT_Get_Face_Descender(face), face);
} else {
FX_BOOL bFirst = TRUE;
for (int i = 0; i < 256; i++) {
@@ -358,9 +361,9 @@ int CPDF_Font::GetStringWidth(const FX_CHAR* pString, int size) {
return width;
}
int CPDF_Font::GetCharTypeWidth(FX_DWORD charcode) {
- if (m_Font.m_Face == NULL) {
+ if (!m_Font.GetFace())
return 0;
- }
+
int glyph_index = GlyphFromCharCode(charcode);
if (glyph_index == 0xffff) {
return 0;
@@ -781,15 +784,12 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
}
FX_BOOL CPDF_Font::IsStandardFont() const {
- if (m_FontType != PDFFONT_TYPE1) {
+ if (m_FontType != PDFFONT_TYPE1)
return FALSE;
- }
- if (m_pFontFile != NULL) {
+ if (m_pFontFile)
return FALSE;
- }
- if (((CPDF_Type1Font*)this)->GetBase14Font() < 0) {
+ if (((CPDF_Type1Font*)this)->GetBase14Font() < 0)
return FALSE;
- }
return TRUE;
}
CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) {
@@ -817,15 +817,15 @@ int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
return index;
}
void CPDF_SimpleFont::LoadCharMetrics(int charcode) {
- if (m_Font.m_Face == NULL) {
+ if (!m_Font.GetFace())
return;
- }
+
if (charcode < 0 || charcode > 0xff) {
return;
}
int glyph_index = m_GlyphIndex[charcode];
if (glyph_index == 0xffff) {
- if (m_pFontFile == NULL && charcode != 32) {
+ if (!m_pFontFile && charcode != 32) {
LoadCharMetrics(32);
m_CharBBox[charcode] = m_CharBBox[32];
if (m_bUseFontWidth) {
@@ -834,27 +834,21 @@ void CPDF_SimpleFont::LoadCharMetrics(int charcode) {
}
return;
}
+ FXFT_Face face = m_Font.GetFace();
int err = FXFT_Load_Glyph(
- m_Font.m_Face, glyph_index,
+ face, glyph_index,
FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (err) {
return;
}
- m_CharBBox[charcode].Left =
- TT2PDF(FXFT_Get_Glyph_HoriBearingX(m_Font.m_Face), m_Font.m_Face);
- m_CharBBox[charcode].Right =
- TT2PDF(FXFT_Get_Glyph_HoriBearingX(m_Font.m_Face) +
- FXFT_Get_Glyph_Width(m_Font.m_Face),
- m_Font.m_Face);
- m_CharBBox[charcode].Top =
- TT2PDF(FXFT_Get_Glyph_HoriBearingY(m_Font.m_Face), m_Font.m_Face);
- m_CharBBox[charcode].Bottom =
- TT2PDF(FXFT_Get_Glyph_HoriBearingY(m_Font.m_Face) -
- FXFT_Get_Glyph_Height(m_Font.m_Face),
- m_Font.m_Face);
+ m_CharBBox[charcode].Left = TT2PDF(FXFT_Get_Glyph_HoriBearingX(face), face);
+ m_CharBBox[charcode].Right = TT2PDF(
+ FXFT_Get_Glyph_HoriBearingX(face) + FXFT_Get_Glyph_Width(face), face);
+ m_CharBBox[charcode].Top = TT2PDF(FXFT_Get_Glyph_HoriBearingY(face), face);
+ m_CharBBox[charcode].Bottom = TT2PDF(
+ FXFT_Get_Glyph_HoriBearingY(face) - FXFT_Get_Glyph_Height(face), face);
if (m_bUseFontWidth) {
- int TT_Width =
- TT2PDF(FXFT_Get_Glyph_HoriAdvance(m_Font.m_Face), m_Font.m_Face);
+ int TT_Width = TT2PDF(FXFT_Get_Glyph_HoriAdvance(face), face);
if (m_CharWidth[charcode] == 0xffff) {
m_CharWidth[charcode] = TT_Width;
} else if (TT_Width && !IsEmbedded()) {
@@ -939,12 +933,12 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
}
}
}
- if (m_pFontFile == NULL) {
- LoadSubstFont();
- } else {
+ if (m_pFontFile) {
if (m_BaseFont.GetLength() > 8 && m_BaseFont[7] == '+') {
m_BaseFont = m_BaseFont.Mid(8);
}
+ } else {
+ LoadSubstFont();
}
if (!(m_Flags & PDFFONT_SYMBOLIC)) {
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
@@ -955,14 +949,14 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
LoadGlyphMap();
delete[] m_pCharNames;
m_pCharNames = NULL;
- if (m_Font.m_Face == NULL) {
+ if (!m_Font.GetFace())
return TRUE;
- }
+
if (m_Flags & PDFFONT_ALLCAP) {
unsigned char lowercases[] = {'a', 'z', 0xe0, 0xf6, 0xf8, 0xfd};
for (size_t range = 0; range < sizeof lowercases / 2; range++) {
for (int i = lowercases[range * 2]; i <= lowercases[range * 2 + 1]; i++) {
- if (m_GlyphIndex[i] != 0xffff && m_pFontFile != NULL) {
+ if (m_GlyphIndex[i] != 0xffff && m_pFontFile) {
continue;
}
m_GlyphIndex[i] = m_GlyphIndex[i - 32];
@@ -996,7 +990,7 @@ void CPDF_SimpleFont::LoadSubstFont() {
int weight = m_StemV < 140 ? m_StemV * 5 : (m_StemV * 4 + 140);
m_Font.LoadSubst(m_BaseFont, IsFontType(PDFFONT_TRUETYPE), m_Flags, weight,
m_ItalicAngle, 0);
- if (m_Font.m_pSubstFont->m_SubstFlags & FXFONT_SUBST_NONSYMBOL) {
+ if (m_Font.GetSubstFont()->m_SubstFlags & FXFONT_SUBST_NONSYMBOL) {
}
}
FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const {
@@ -1089,42 +1083,43 @@ static const FX_CHAR* _GlyphNameRemap(const FX_CHAR* pStrAdobe) {
}
#endif
void CPDF_Type1Font::LoadGlyphMap() {
- if (m_Font.m_Face == NULL) {
+ if (!m_Font.GetFace())
return;
- }
+
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
FX_BOOL bCoreText = TRUE;
CQuartz2D& quartz2d =
((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d;
- if (!m_Font.m_pPlatformFont) {
+ if (!m_Font.GetPlatformFont()) {
if (m_Font.GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
bCoreText = FALSE;
}
- m_Font.m_pPlatformFont =
- quartz2d.CreateFont(m_Font.m_pFontData, m_Font.m_dwSize);
- if (NULL == m_Font.m_pPlatformFont) {
+ m_Font.SetPlatformFont(
+ quartz2d.CreateFont(m_Font.GetFontData(), m_Font.GetSize()));
+ if (!m_Font.GetPlatformFont()) {
bCoreText = FALSE;
}
}
#endif
if (!IsEmbedded() && (m_Base14Font < 12) && m_Font.IsTTFont()) {
- if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) {
+ if (FT_UseTTCharmap(m_Font.GetFace(), 3, 0)) {
FX_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++) {
FX_WORD unicode = prefix[j] * 256 + charcode;
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, unicode);
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
FX_CHAR name_glyph[256];
- FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyph,
- 256);
+ FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
+ name_glyph, 256);
name_glyph[255] = 0;
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name_glyph, kCFStringEncodingASCII,
kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
@@ -1144,7 +1139,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
return;
}
}
- FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE);
+ FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE);
if (m_BaseEncoding == 0) {
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
}
@@ -1155,35 +1150,35 @@ void CPDF_Type1Font::LoadGlyphMap() {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
- m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.m_Face, m_Encoding.m_Unicodes[charcode]);
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_Font.GetFace(), m_Encoding.m_Unicodes[charcode]);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
FX_CHAR name_glyph[256];
- FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyph,
+ FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph,
256);
name_glyph[255] = 0;
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name_glyph, kCFStringEncodingASCII,
kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
#endif
if (m_GlyphIndex[charcode] == 0 && FXSYS_strcmp(name, ".notdef") == 0) {
m_Encoding.m_Unicodes[charcode] = 0x20;
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, 0x20);
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 0x20);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
FX_CHAR name_glyph[256];
- FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyph,
- 256);
+ FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
+ name_glyph, 256);
name_glyph[255] = 0;
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name_glyph, kCFStringEncodingASCII,
kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
@@ -1197,7 +1192,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
#endif
return;
}
- FT_UseType1Charmap(m_Font.m_Face);
+ FT_UseType1Charmap(m_Font.GetFace());
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (bCoreText) {
if (m_Flags & PDFFONT_SYMBOLIC) {
@@ -1207,17 +1202,18 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.m_Face, (char*)name);
+ FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name, kCFStringEncodingASCII,
kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
} else {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, charcode);
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
FX_WCHAR unicode = 0;
if (m_GlyphIndex[charcode]) {
unicode =
@@ -1225,8 +1221,8 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
FX_CHAR name_glyph[256];
FXSYS_memset(name_glyph, 0, sizeof(name_glyph));
- FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyph,
- 256);
+ FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
+ name_glyph, 256);
name_glyph[255] = 0;
if (unicode == 0 && name_glyph[0] != 0) {
unicode = PDF_UnicodeFromAdobeName(name_glyph);
@@ -1236,7 +1232,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
kCFAllocatorDefault, name_glyph, kCFStringEncodingASCII,
kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
@@ -1245,7 +1241,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
return;
}
FX_BOOL bUnicode = FALSE;
- if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
+ if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) {
bUnicode = TRUE;
}
for (int charcode = 0; charcode < 256; charcode++) {
@@ -1256,14 +1252,16 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
const FX_CHAR* pStrUnicode = _GlyphNameRemap(name);
- if (pStrUnicode && 0 == FXFT_Get_Name_Index(m_Font.m_Face, (char*)name)) {
+ if (pStrUnicode &&
+ 0 == FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name)) {
name = pStrUnicode;
}
- m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name);
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name, kCFStringEncodingASCII, kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
@@ -1271,33 +1269,33 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (FXSYS_strcmp(name, ".notdef") != 0 &&
FXSYS_strcmp(name, "space") != 0) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
- m_Font.m_Face,
+ m_Font.GetFace(),
bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
FX_CHAR name_glyph[256];
- FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyph,
- 256);
+ FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
+ name_glyph, 256);
name_glyph[255] = 0;
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name_glyph, kCFStringEncodingASCII,
kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
} else {
m_Encoding.m_Unicodes[charcode] = 0x20;
m_GlyphIndex[charcode] =
- bUnicode ? FXFT_Get_Char_Index(m_Font.m_Face, 0x20) : 0xffff;
+ bUnicode ? FXFT_Get_Char_Index(m_Font.GetFace(), 0x20) : 0xffff;
FX_CHAR name_glyph[256];
- FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode], name_glyph,
- 256);
+ FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
+ name_glyph, 256);
name_glyph[255] = 0;
CFStringRef name_ct = CFStringCreateWithCStringNoCopy(
kCFAllocatorDefault, name_glyph, kCFStringEncodingASCII,
kCFAllocatorNull);
m_ExtGID[charcode] = CGFontGetGlyphWithGlyphName(
- (CGFontRef)m_Font.m_pPlatformFont, name_ct);
+ (CGFontRef)m_Font.GetPlatformFont(), name_ct);
if (name_ct) {
CFRelease(name_ct);
}
@@ -1314,16 +1312,17 @@ void CPDF_Type1Font::LoadGlyphMap() {
if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.m_Face, (char*)name);
+ FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
} else {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, charcode);
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
if (m_GlyphIndex[charcode]) {
FX_WCHAR unicode =
FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode);
if (unicode == 0) {
FX_CHAR name_glyph[256];
FXSYS_memset(name_glyph, 0, sizeof(name_glyph));
- FXFT_Get_Glyph_Name(m_Font.m_Face, m_GlyphIndex[charcode],
+ FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
name_glyph, 256);
name_glyph[255] = 0;
if (name_glyph[0] != 0) {
@@ -1342,7 +1341,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
return;
}
FX_BOOL bUnicode = FALSE;
- if (0 == FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE)) {
+ if (0 == FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE)) {
bUnicode = TRUE;
}
for (int charcode = 0; charcode < 256; charcode++) {
@@ -1352,12 +1351,12 @@ void CPDF_Type1Font::LoadGlyphMap() {
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
- m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.m_Face, (char*)name);
+ m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
if (m_GlyphIndex[charcode] == 0) {
if (FXSYS_strcmp(name, ".notdef") != 0 &&
FXSYS_strcmp(name, "space") != 0) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
- m_Font.m_Face,
+ m_Font.GetFace(),
bUnicode ? m_Encoding.m_Unicodes[charcode] : charcode);
} else {
m_Encoding.m_Unicodes[charcode] = 0x20;
@@ -1371,6 +1370,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
#endif
}
+
CPDF_FontEncoding::CPDF_FontEncoding() {
FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes));
}
@@ -1443,19 +1443,19 @@ FX_BOOL CPDF_TrueTypeFont::_Load() {
return LoadCommon();
}
void CPDF_TrueTypeFont::LoadGlyphMap() {
- if (m_Font.m_Face == NULL) {
+ if (!m_Font.GetFace())
return;
- }
+
int baseEncoding = m_BaseEncoding;
- if (m_pFontFile && m_Font.m_Face->num_charmaps > 0 &&
+ if (m_pFontFile && m_Font.GetFace()->num_charmaps > 0 &&
(baseEncoding == PDFFONT_ENCODING_MACROMAN ||
baseEncoding == PDFFONT_ENCODING_WINANSI) &&
(m_Flags & PDFFONT_SYMBOLIC)) {
FX_BOOL bSupportWin = FALSE;
FX_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]);
+ for (int i = 0; i < FXFT_Get_Face_CharmapCount(m_Font.GetFace()); i++) {
+ int platform_id = FXFT_Get_Charmap_PlatformID(
+ FXFT_Get_Face_Charmaps(m_Font.GetFace())[i]);
if (platform_id == 0 || platform_id == 3) {
bSupportWin = TRUE;
} else if (platform_id == 0 || platform_id == 1) {
@@ -1474,8 +1474,8 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
baseEncoding == PDFFONT_ENCODING_WINANSI) &&
m_pCharNames == NULL) ||
(m_Flags & PDFFONT_NONSYMBOLIC)) {
- if (!FXFT_Has_Glyph_Names(m_Font.m_Face) &&
- (!m_Font.m_Face->num_charmaps || !m_Font.m_Face->charmaps)) {
+ if (!FXFT_Has_Glyph_Names(m_Font.GetFace()) &&
+ (!m_Font.GetFace()->num_charmaps || !m_Font.GetFace()->charmaps)) {
int nStartChar = m_pFontDict->GetInteger(FX_BSTRC("FirstChar"));
if (nStartChar < 0 || nStartChar > 255)
return;
@@ -1490,15 +1490,15 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
return;
}
- FX_BOOL bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
+ FX_BOOL bMSUnicode = FT_UseTTCharmap(m_Font.GetFace(), 3, 1);
FX_BOOL bMacRoman = FALSE, bMSSymbol = FALSE;
if (!bMSUnicode) {
if (m_Flags & PDFFONT_NONSYMBOLIC) {
- bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0);
- bMSSymbol = !bMacRoman && FT_UseTTCharmap(m_Font.m_Face, 3, 0);
+ bMacRoman = FT_UseTTCharmap(m_Font.GetFace(), 1, 0);
+ bMSSymbol = !bMacRoman && FT_UseTTCharmap(m_Font.GetFace(), 3, 0);
} else {
- bMSSymbol = FT_UseTTCharmap(m_Font.m_Face, 3, 0);
- bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.m_Face, 1, 0);
+ bMSSymbol = FT_UseTTCharmap(m_Font.GetFace(), 3, 0);
+ bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.GetFace(), 1, 0);
}
}
FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode"));
@@ -1507,7 +1507,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
GetAdobeCharName(baseEncoding, m_pCharNames, charcode);
if (name == NULL) {
m_GlyphIndex[charcode] =
- m_pFontFile ? FXFT_Get_Char_Index(m_Font.m_Face, charcode) : -1;
+ m_pFontFile ? FXFT_Get_Char_Index(m_Font.GetFace(), charcode) : -1;
continue;
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
@@ -1515,7 +1515,8 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
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);
+ m_GlyphIndex[charcode] =
+ FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
if (m_GlyphIndex[charcode]) {
break;
}
@@ -1523,38 +1524,38 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
} else if (m_Encoding.m_Unicodes[charcode]) {
if (bMSUnicode) {
m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
- m_Font.m_Face, m_Encoding.m_Unicodes[charcode]);
+ m_Font.GetFace(), m_Encoding.m_Unicodes[charcode]);
} else if (bMacRoman) {
FX_DWORD maccode = FT_CharCodeFromUnicode(
FXFT_ENCODING_APPLE_ROMAN, m_Encoding.m_Unicodes[charcode]);
if (!maccode) {
m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.m_Face, (char*)name);
+ FXFT_Get_Name_Index(m_Font.GetFace(), (char*)name);
} else {
m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.m_Face, maccode);
+ FXFT_Get_Char_Index(m_Font.GetFace(), maccode);
}
}
}
if ((m_GlyphIndex[charcode] == 0 || m_GlyphIndex[charcode] == 0xffff) &&
name != NULL) {
if (name[0] == '.' && FXSYS_strcmp(name, ".notdef") == 0) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, 32);
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 32);
} else {
m_GlyphIndex[charcode] =
- FXFT_Get_Name_Index(m_Font.m_Face, (char*)name);
+ 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.m_Face, wsUnicode[0]);
+ 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.m_Face, charcode);
+ FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
}
}
}
@@ -1562,13 +1563,13 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
return;
}
- if (FT_UseTTCharmap(m_Font.m_Face, 3, 0)) {
+ if (FT_UseTTCharmap(m_Font.GetFace(), 3, 0)) {
const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
FX_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);
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
if (m_GlyphIndex[charcode]) {
bGotOne = TRUE;
break;
@@ -1585,7 +1586,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
}
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
}
- } else if (FT_UseTTCharmap(m_Font.m_Face, 1, 0)) {
+ } else if (FT_UseTTCharmap(m_Font.GetFace(), 1, 0)) {
for (int charcode = 0; charcode < 256; charcode++) {
m_Encoding.m_Unicodes[charcode] =
FT_UnicodeFromCharCode(FXFT_ENCODING_APPLE_ROMAN, charcode);
@@ -1594,10 +1595,10 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
return;
}
}
- if (FT_UseTTCharmap(m_Font.m_Face, 1, 0)) {
+ if (FT_UseTTCharmap(m_Font.GetFace(), 1, 0)) {
FX_BOOL bGotOne = FALSE;
for (int charcode = 0; charcode < 256; charcode++) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.m_Face, charcode);
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
m_Encoding.m_Unicodes[charcode] =
FT_UnicodeFromCharCode(FXFT_ENCODING_APPLE_ROMAN, charcode);
if (m_GlyphIndex[charcode]) {
@@ -1608,22 +1609,22 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
return;
}
}
- if (FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE) == 0) {
+ if (FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE) == 0) {
FX_BOOL bGotOne = FALSE;
const FX_WORD* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding);
for (int charcode = 0; charcode < 256; charcode++) {
- if (m_pFontFile == NULL) {
+ if (m_pFontFile) {
+ m_Encoding.m_Unicodes[charcode] = charcode;
+ } else {
const FX_CHAR* name = GetAdobeCharName(0, m_pCharNames, charcode);
- if (name != NULL) {
+ if (name) {
m_Encoding.m_Unicodes[charcode] = PDF_UnicodeFromAdobeName(name);
} else if (pUnicodes) {
m_Encoding.m_Unicodes[charcode] = pUnicodes[charcode];
}
- } else {
- m_Encoding.m_Unicodes[charcode] = charcode;
}
- m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.m_Face, m_Encoding.m_Unicodes[charcode]);
+ m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_Font.GetFace(), m_Encoding.m_Unicodes[charcode]);
if (m_GlyphIndex[charcode]) {
bGotOne = TRUE;
}
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 1b1ba8b0a4..02f0933f36 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -1307,11 +1307,9 @@ void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) {
}
FX_BOOL bVert = FALSE;
int glyph_index = GlyphFromCharCode(charcode, &bVert);
- if (m_Font.m_Face == NULL) {
- rect = FX_RECT(0, 0, 0, 0);
- } else {
+ FXFT_Face face = m_Font.GetFace();
+ if (face) {
rect.left = rect.bottom = rect.right = rect.top = 0;
- FXFT_Face face = m_Font.m_Face;
if (FXFT_Is_Face_Tricky(face)) {
int err = FXFT_Load_Glyph(face, glyph_index,
FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
@@ -1357,6 +1355,8 @@ void CPDF_CIDFont::GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level) {
face);
}
}
+ } else {
+ rect = FX_RECT(0, 0, 0, 0);
}
if (m_pFontFile == NULL && m_Charset == CIDSET_JAPAN1) {
FX_WORD CID = CIDFromCharCode(charcode);
@@ -1433,7 +1433,8 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL* pVertGlyph) {
if (pVertGlyph) {
*pVertGlyph = FALSE;
}
- int index = FXFT_Get_Char_Index(m_Font.m_Face, unicode);
+ FXFT_Face face = m_Font.GetFace();
+ int index = FXFT_Get_Char_Index(face, unicode);
if (unicode == 0x2502) {
return index;
}
@@ -1449,20 +1450,19 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL* pVertGlyph) {
}
return index;
}
- if (NULL == m_Font.m_pGsubData) {
+ if (!m_Font.GetSubData()) {
unsigned long length = 0;
- int error = FXFT_Load_Sfnt_Table(
- m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length);
+ int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
+ NULL, &length);
if (!error) {
- m_Font.m_pGsubData = FX_Alloc(uint8_t, length);
+ m_Font.SetSubData(FX_Alloc(uint8_t, length));
}
}
- int error =
- FXFT_Load_Sfnt_Table(m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
- m_Font.m_pGsubData, NULL);
- if (!error && m_Font.m_pGsubData) {
+ int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
+ m_Font.GetSubData(), NULL);
+ if (!error && m_Font.GetSubData()) {
m_pTTGSUBTable = new CFX_CTTGSUBTable;
- m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.m_pGsubData);
+ m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.GetSubData());
TT_uint32_t vindex = 0;
m_pTTGSUBTable->GetVerticalGlyph(index, &vindex);
if (vindex) {
@@ -1510,16 +1510,17 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
unicode = UnicodeFromCharCode(charcode).GetAt(0);
}
}
+ FXFT_Face face = m_Font.GetFace();
if (unicode == 0) {
if (!m_bAdobeCourierStd) {
return charcode == 0 ? -1 : (int)charcode;
}
charcode += 31;
int index = 0, iBaseEncoding;
- FX_BOOL bMSUnicode = FT_UseTTCharmap(m_Font.m_Face, 3, 1);
+ FX_BOOL bMSUnicode = FT_UseTTCharmap(face, 3, 1);
FX_BOOL bMacRoman = FALSE;
if (!bMSUnicode) {
- bMacRoman = FT_UseTTCharmap(m_Font.m_Face, 1, 0);
+ bMacRoman = FT_UseTTCharmap(face, 1, 0);
}
iBaseEncoding = PDFFONT_ENCODING_STANDARD;
if (bMSUnicode) {
@@ -1534,14 +1535,14 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
FX_WORD unicode = PDF_UnicodeFromAdobeName(name);
if (unicode) {
if (bMSUnicode) {
- index = FXFT_Get_Char_Index(m_Font.m_Face, unicode);
+ index = FXFT_Get_Char_Index(face, unicode);
} else if (bMacRoman) {
FX_DWORD maccode =
FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, unicode);
- index = !maccode ? FXFT_Get_Name_Index(m_Font.m_Face, (char*)name)
- : FXFT_Get_Char_Index(m_Font.m_Face, maccode);
+ index = !maccode ? FXFT_Get_Name_Index(face, (char*)name)
+ : FXFT_Get_Char_Index(face, maccode);
} else {
- return FXFT_Get_Char_Index(m_Font.m_Face, unicode);
+ return FXFT_Get_Char_Index(face, unicode);
}
} else {
return charcode == 0 ? -1 : (int)charcode;
@@ -1561,57 +1562,53 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
}
#endif
}
- if (m_Font.m_Face == NULL) {
+ if (!face)
return unicode;
- }
- int err = FXFT_Select_Charmap(m_Font.m_Face, FXFT_ENCODING_UNICODE);
+
+ int err = FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE);
if (err != 0) {
int i;
- for (i = 0; i < FXFT_Get_Face_CharmapCount(m_Font.m_Face); i++) {
+ for (i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) {
FX_DWORD ret = FT_CharCodeFromUnicode(
- FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(m_Font.m_Face)[i]),
+ FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]),
(FX_WCHAR)charcode);
if (ret == 0) {
continue;
}
- FXFT_Set_Charmap(m_Font.m_Face,
- FXFT_Get_Face_Charmaps(m_Font.m_Face)[i]);
+ FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]);
unicode = (FX_WCHAR)ret;
break;
}
- if (i == FXFT_Get_Face_CharmapCount(m_Font.m_Face) && i) {
- FXFT_Set_Charmap(m_Font.m_Face,
- FXFT_Get_Face_Charmaps(m_Font.m_Face)[0]);
+ if (i == FXFT_Get_Face_CharmapCount(face) && i) {
+ FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
unicode = (FX_WCHAR)charcode;
}
}
- if (FXFT_Get_Face_Charmap(m_Font.m_Face)) {
+ if (FXFT_Get_Face_Charmap(face)) {
int index = GetGlyphIndex(unicode, pVertGlyph);
- if (index == 0) {
+ if (index == 0)
return -1;
- }
return index;
}
return unicode;
}
- if (m_Font.m_Face == NULL) {
+ if (!m_Font.GetFace())
return -1;
- }
+
FX_WORD cid = CIDFromCharCode(charcode);
if (m_bType1) {
- if (NULL == m_pCIDToGIDMap) {
+ if (!m_pCIDToGIDMap) {
return cid;
}
} else {
- if (m_pCIDToGIDMap == NULL) {
- if (m_pFontFile && m_pCMap->m_pMapping == NULL) {
+ if (!m_pCIDToGIDMap) {
+ if (m_pFontFile && !m_pCMap->m_pMapping)
return cid;
- }
if (m_pCMap->m_Coding == CIDCODING_UNKNOWN ||
- FXFT_Get_Face_Charmap(m_Font.m_Face) == NULL) {
+ !FXFT_Get_Face_Charmap(m_Font.GetFace())) {
return cid;
}
- if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmap(m_Font.m_Face)) ==
+ if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmap(m_Font.GetFace())) ==
FXFT_ENCODING_UNICODE) {
CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
if (unicode_str.IsEmpty()) {
@@ -1623,9 +1620,9 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
}
}
FX_DWORD byte_pos = cid * 2;
- if (byte_pos + 2 > m_pCIDToGIDMap->GetSize()) {
+ if (byte_pos + 2 > m_pCIDToGIDMap->GetSize())
return -1;
- }
+
const uint8_t* pdata = m_pCIDToGIDMap->GetData() + byte_pos;
return pdata[0] * 256 + pdata[1];
}
diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
index 2ed586e0a3..6c1b4263b1 100644
--- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
+++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp
@@ -388,23 +388,23 @@ IFX_GSUBTable* IFX_GSUBTable::Create(CFX_Font* pFont) {
if (!pFont) {
return NULL;
}
- if (NULL == pFont->m_pGsubData) {
+ if (!pFont->GetSubData()) {
unsigned long length = 0;
int error = FXFT_Load_Sfnt_Table(
- pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length);
+ pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, NULL, &length);
if (!error) {
- pFont->m_pGsubData = FX_Alloc(uint8_t, length);
+ pFont->SetSubData(FX_Alloc(uint8_t, length));
}
- if (!pFont->m_pGsubData) {
+ if (!pFont->GetSubData()) {
return NULL;
}
}
int error =
- FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
- pFont->m_pGsubData, NULL);
- if (!error && pFont->m_pGsubData) {
+ FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
+ pFont->GetSubData(), NULL);
+ if (!error && pFont->GetSubData()) {
nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable);
- if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) {
+ if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) {
return pGsubTable.release();
}
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 472e96a3c4..89ac8ac143 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -790,10 +790,10 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(
ProcessPath(&path, pObj2Device);
}
}
+
CFX_PathData* CPDF_Font::LoadGlyphPath(FX_DWORD charcode, int dest_width) {
int glyph_index = GlyphFromCharCode(charcode);
- if (m_Font.m_Face == NULL) {
- return NULL;
- }
+ if (!m_Font.GetFace())
+ return nullptr;
return m_Font.LoadGlyphPath(glyph_index, dest_width);
}
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index 8931acdde4..1b476d7b1f 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -2561,7 +2561,7 @@ CPDF_LinkExtract::~CPDF_LinkExtract() {
DeleteLinkList();
}
FX_BOOL CPDF_LinkExtract::ExtractLinks(const IPDF_TextPage* pTextPage) {
- if (!pTextPage || !pTextPage->IsParsered()) {
+ if (!pTextPage || !pTextPage->IsParsed()) {
return FALSE;
}
m_pTextPage = (const CPDF_TextPage*)pTextPage;
diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h
index 129ef0a8ae..59332e7d07 100644
--- a/core/src/fpdftext/text_int.h
+++ b/core/src/fpdftext/text_int.h
@@ -60,7 +60,7 @@ class CPDF_TextPage : public IPDF_TextPage {
// IPDF_TextPage
FX_BOOL ParseTextPage() override;
void NormalizeObjects(FX_BOOL bNormalize) override;
- FX_BOOL IsParsered() const override { return m_IsParsered; }
+ bool IsParsed() const override { return m_IsParsered; }
int CharIndexFromTextIndex(int TextIndex) const override;
int TextIndexFromCharIndex(int CharIndex) const override;
int CountChars() const override;
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index 7517cf1bed..05ae175b0a 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -34,7 +34,7 @@ const FX_DWORD g_EncodingID[] = {
CFX_UnicodeEncodingEx* _FXFM_CreateFontEncoding(CFX_Font* pFont,
FX_DWORD nEncodingID) {
- if (FXFT_Select_Charmap(pFont->m_Face, nEncodingID))
+ if (FXFT_Select_Charmap(pFont->GetFace(), nEncodingID))
return nullptr;
return new CFX_UnicodeEncodingEx(pFont, nEncodingID);
}
@@ -233,7 +233,7 @@ FX_BOOL CFX_Font::LoadEmbedded(const uint8_t* data, FX_DWORD size) {
m_dwSize = size;
return m_Face != NULL;
}
-FX_BOOL CFX_Font::IsTTFont() {
+FX_BOOL CFX_Font::IsTTFont() const {
if (m_Face == NULL) {
return FALSE;
}
@@ -321,7 +321,7 @@ FX_BOOL CFX_Font::GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox) {
}
return TRUE;
}
-FX_BOOL CFX_Font::IsItalic() {
+FX_BOOL CFX_Font::IsItalic() const {
if (m_Face == NULL) {
return FALSE;
}
@@ -335,13 +335,13 @@ FX_BOOL CFX_Font::IsItalic() {
}
return ret;
}
-FX_BOOL CFX_Font::IsBold() {
+FX_BOOL CFX_Font::IsBold() const {
if (m_Face == NULL) {
return FALSE;
}
return FXFT_Is_Face_Bold(m_Face) == FXFT_STYLE_FLAG_BOLD;
}
-FX_BOOL CFX_Font::IsFixedWidth() {
+FX_BOOL CFX_Font::IsFixedWidth() const {
if (m_Face == NULL) {
return FALSE;
}
@@ -403,7 +403,7 @@ FX_BOOL CFX_Font::GetBBox(FX_RECT& bbox) {
}
return TRUE;
}
-int CFX_Font::GetHeight() {
+int CFX_Font::GetHeight() const {
if (m_Face == NULL) {
return 0;
}
@@ -411,7 +411,7 @@ int CFX_Font::GetHeight() {
EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), FXFT_Get_Face_Height(m_Face));
return height;
}
-int CFX_Font::GetMaxAdvanceWidth() {
+int CFX_Font::GetMaxAdvanceWidth() const {
if (m_Face == NULL) {
return 0;
}
@@ -419,7 +419,7 @@ int CFX_Font::GetMaxAdvanceWidth() {
FXFT_Get_Face_MaxAdvanceWidth(m_Face));
return width;
}
-int CFX_Font::GetULPos() {
+int CFX_Font::GetULPos() const {
if (m_Face == NULL) {
return 0;
}
@@ -427,7 +427,7 @@ int CFX_Font::GetULPos() {
FXFT_Get_Face_UnderLinePosition(m_Face));
return pos;
}
-int CFX_Font::GetULthickness() {
+int CFX_Font::GetULthickness() const {
if (m_Face == NULL) {
return 0;
}
@@ -450,7 +450,7 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) {
if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0)
return FXFT_Get_Char_Index(face, charcode);
- if (m_pFont->m_pSubstFont && m_pFont->m_pSubstFont->m_Charset == 2) {
+ if (m_pFont->GetSubstFont() && m_pFont->GetSubstFont()->m_Charset == 2) {
FX_DWORD index = 0;
if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0)
index = FXFT_Get_Char_Index(face, charcode);
@@ -501,7 +501,7 @@ FX_DWORD CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const {
m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) {
return Unicode;
}
- FXFT_Face face = m_pFont->m_Face;
+ FXFT_Face face = m_pFont->GetFace();
int nmaps = FXFT_Get_Face_CharmapCount(face);
for (int i = 0; i < nmaps; i++) {
int nEncodingID =
@@ -516,7 +516,7 @@ FX_DWORD CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const {
CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont,
FX_DWORD nEncodingID) {
- if (!pFont || !pFont->m_Face)
+ if (!pFont || !pFont->GetFace())
return nullptr;
if (nEncodingID != FXFM_ENCODING_NONE)
diff --git a/xfa/src/fdp/src/fde/fde_gedevice.cpp b/xfa/src/fdp/src/fde/fde_gedevice.cpp
index c50fcca1c6..f357f50ce5 100644
--- a/xfa/src/fdp/src/fde/fde_gedevice.cpp
+++ b/xfa/src/fdp/src/fde/fde_gedevice.cpp
@@ -165,7 +165,7 @@ FX_BOOL CFDE_FxgeDevice::DrawString(IFDE_Brush* pBrush,
FX_DWORD dwFontStyle = pFont->GetFontStyles();
CFX_Font FxFont;
CFX_SubstFont SubstFxFont;
- FxFont.m_pSubstFont = &SubstFxFont;
+ FxFont.SetSubstFont(&SubstFxFont);
SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400;
SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight;
SubstFxFont.m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0;
@@ -179,7 +179,7 @@ FX_BOOL CFDE_FxgeDevice::DrawString(IFDE_Brush* pBrush,
if (pCurFont != NULL) {
pFxFont = (CFX_Font*)pCurFont->GetDevFont();
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- FxFont.m_Face = pFxFont->m_Face;
+ FxFont.SetFace(pFxFont->GetFace());
m_pDevice->DrawNormalText(
iCurCount, pCurCP, &FxFont, pCache, -fFontSize,
(const CFX_AffineMatrix*)pMatrix, argb, FXTEXT_CLEARTYPE);
@@ -200,12 +200,12 @@ FX_BOOL CFDE_FxgeDevice::DrawString(IFDE_Brush* pBrush,
if (pCurFont != NULL && iCurCount) {
pFxFont = (CFX_Font*)pCurFont->GetDevFont();
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- FxFont.m_Face = pFxFont->m_Face;
+ FxFont.SetFace(pFxFont->GetFace());
FX_BOOL bRet = m_pDevice->DrawNormalText(
iCurCount, pCurCP, &FxFont, pCache, -fFontSize,
(const CFX_AffineMatrix*)pMatrix, argb, FXTEXT_CLEARTYPE);
- FxFont.m_pSubstFont = NULL;
- FxFont.m_Face = NULL;
+ FxFont.SetSubstFont(nullptr);
+ FxFont.SetFace(nullptr);
return bRet;
#else
return m_pDevice->DrawNormalText(
@@ -214,8 +214,8 @@ FX_BOOL CFDE_FxgeDevice::DrawString(IFDE_Brush* pBrush,
#endif
}
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- FxFont.m_pSubstFont = NULL;
- FxFont.m_Face = NULL;
+ FxFont.SetSubstFont(nullptr);
+ FxFont.SetFace(nullptr);
#endif
return TRUE;
} break;
diff --git a/xfa/src/fgas/src/font/fx_gefont.cpp b/xfa/src/fgas/src/font/fx_gefont.cpp
index 12c4f0ea39..280e0fb8cd 100644
--- a/xfa/src/fgas/src/font/fx_gefont.cpp
+++ b/xfa/src/fgas/src/font/fx_gefont.cpp
@@ -132,16 +132,15 @@ CFX_GEFont::CFX_GEFont(const CFX_GEFont& src, FX_DWORD dwFontStyles)
FXSYS_assert(m_pFont != NULL);
FXSYS_assert(src.m_pFont != NULL);
m_pFont->LoadClone(src.m_pFont);
- CFX_SubstFont*& pSubst = m_pFont->m_pSubstFont;
- if (pSubst == NULL) {
+ CFX_SubstFont* pSubst = m_pFont->GetSubstFont();
+ if (!pSubst) {
pSubst = new CFX_SubstFont;
+ m_pFont->SetSubstFont(pSubst);
}
- if (pSubst) {
- pSubst->m_Weight =
- (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
- if (dwFontStyles & FX_FONTSTYLE_Italic) {
- pSubst->m_SubstFlags |= FXFONT_SUBST_ITALIC;
- }
+ pSubst->m_Weight =
+ (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
+ if (dwFontStyles & FX_FONTSTYLE_Italic) {
+ pSubst->m_SubstFlags |= FXFONT_SUBST_ITALIC;
}
InitFont();
}
@@ -236,7 +235,7 @@ FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFontFamily,
csFontFamily += ",Italic";
}
m_pFont->LoadSubst(csFontFamily, TRUE, dwFlags, iWeight, 0, wCodePage);
- FX_BOOL bRet = m_pFont->m_Face != nullptr;
+ FX_BOOL bRet = m_pFont->GetFace() != nullptr;
if (bRet) {
InitFont();
}
@@ -355,22 +354,20 @@ IFX_Font* CFX_GEFont::Derive(FX_DWORD dwFontStyles, FX_WORD wCodePage) {
return new CFX_GEFont(*this, dwFontStyles);
}
uint8_t CFX_GEFont::GetCharSet() const {
- FXSYS_assert(m_pFont != NULL);
if (m_wCharSet != 0xFFFF) {
return (uint8_t)m_wCharSet;
}
- if (m_pFont->m_pSubstFont == NULL) {
+ if (!m_pFont->GetSubstFont()) {
return FX_CHARSET_Default;
}
- return m_pFont->m_pSubstFont->m_Charset;
+ return m_pFont->GetSubstFont()->m_Charset;
}
void CFX_GEFont::GetFamilyName(CFX_WideString& wsFamily) const {
- FXSYS_assert(m_pFont != NULL);
- if (m_pFont->m_pSubstFont == NULL ||
- m_pFont->m_pSubstFont->m_Family.GetLength() == 0) {
+ if (!m_pFont->GetSubstFont() ||
+ m_pFont->GetSubstFont()->m_Family.GetLength() == 0) {
wsFamily = CFX_WideString::FromLocal(m_pFont->GetFamilyName());
} else {
- wsFamily = CFX_WideString::FromLocal(m_pFont->m_pSubstFont->m_Family);
+ wsFamily = CFX_WideString::FromLocal(m_pFont->GetSubstFont()->m_Family);
}
}
void CFX_GEFont::GetPsName(CFX_WideString& wsName) const {
@@ -384,7 +381,7 @@ FX_DWORD CFX_GEFont::GetFontStyles() const {
}
#endif
FX_DWORD dwStyles = 0;
- if (m_pFont->m_pSubstFont == NULL) {
+ if (!m_pFont->GetSubstFont()) {
if (m_pFont->IsBold()) {
dwStyles |= FX_FONTSTYLE_Bold;
}
@@ -392,10 +389,10 @@ FX_DWORD CFX_GEFont::GetFontStyles() const {
dwStyles |= FX_FONTSTYLE_Italic;
}
} else {
- if (m_pFont->m_pSubstFont->m_Weight == FXFONT_FW_BOLD) {
+ if (m_pFont->GetSubstFont()->m_Weight == FXFONT_FW_BOLD) {
dwStyles |= FX_FONTSTYLE_Bold;
}
- if (m_pFont->m_pSubstFont->m_SubstFlags & FXFONT_SUBST_ITALIC) {
+ if (m_pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_ITALIC) {
dwStyles |= FX_FONTSTYLE_Italic;
}
}
@@ -490,10 +487,10 @@ FX_BOOL CFX_GEFont::GetBBox(CFX_Rect& bbox) {
return bRet;
}
int32_t CFX_GEFont::GetItalicAngle() const {
- if (m_pFont->m_pSubstFont == NULL) {
+ if (!m_pFont->GetSubstFont()) {
return 0;
}
- return m_pFont->m_pSubstFont->m_ItalicAngle;
+ return m_pFont->GetSubstFont()->m_ItalicAngle;
}
int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode) {
return GetGlyphIndex(wUnicode, TRUE, NULL, bCharCode);
diff --git a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
index 83c6dff120..885e7557c1 100644
--- a/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
+++ b/xfa/src/fgas/src/font/fx_stdfontmgr.cpp
@@ -868,7 +868,7 @@ FX_BOOL CFX_FontMgrImp::VerifyUnicode(IFX_Font* pFont, FX_WCHAR wcUnicode) {
if (NULL == pFont) {
return FALSE;
}
- FXFT_Face pFace = ((CFX_Font*)pFont->GetDevFont())->m_Face;
+ FXFT_Face pFace = ((CFX_Font*)pFont->GetDevFont())->GetFace();
FXFT_CharMap charmap = FXFT_Get_Face_Charmap(pFace);
if (0 != FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE)) {
return FALSE;
@@ -948,7 +948,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess,
if (m_FileAccess2IFXFont.Lookup(dwHash, pFont)) {
if (NULL != pFont) {
if (NULL != pFaceCount) {
- *pFaceCount = ((CFX_Font*)pFont->GetDevFont())->m_Face->num_faces;
+ *pFaceCount = ((CFX_Font*)pFont->GetDevFont())->GetFace()->num_faces;
}
return pFont->Retain();
}
@@ -977,7 +977,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess,
}
m_IFXFont2FileRead.SetAt(pFont, pFontStream);
if (NULL != pFaceCount) {
- *pFaceCount = ((CFX_Font*)pFont->GetDevFont())->m_Face->num_faces;
+ *pFaceCount = ((CFX_Font*)pFont->GetDevFont())->GetFace()->num_faces;
}
return pFont;
}