diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-10-23 12:37:42 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-10-23 12:37:42 -0700 |
commit | 1b04bcc6af13669920700322052fc4ab4fad47a2 (patch) | |
tree | 14a70efd6df9acf3e5e0a611415e95955f1b5d8f /xfa | |
parent | 2a4e4ce8efaf8b6466962eef292a9876c17976ad (diff) | |
download | pdfium-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 .
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/src/fdp/src/fde/fde_gedevice.cpp | 14 | ||||
-rw-r--r-- | xfa/src/fgas/src/font/fx_gefont.cpp | 39 | ||||
-rw-r--r-- | xfa/src/fgas/src/font/fx_stdfontmgr.cpp | 6 |
3 files changed, 28 insertions, 31 deletions
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;
}
|