summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type1font.cpp26
-rw-r--r--core/fxge/android/fpf_skiafont.cpp6
-rw-r--r--core/fxge/android/fpf_skiafont.h2
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp4
-rw-r--r--core/fxge/apple/fx_quartz_device.cpp4
-rw-r--r--core/fxge/ge/fx_ge_font.cpp17
-rw-r--r--core/fxge/ge/fx_ge_text.cpp35
-rw-r--r--core/fxge/include/fx_font.h2
-rw-r--r--xfa/fgas/font/fgas_font.h1
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp4
-rw-r--r--xfa/fgas/font/fgas_gefont.h5
11 files changed, 49 insertions, 57 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
index 5fbc520ae5..fc12ae78ee 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
@@ -118,19 +118,18 @@ void CPDF_Type1Font::LoadGlyphMap() {
return;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- FX_BOOL bCoreText = TRUE;
+ bool bCoreText = true;
CQuartz2D& quartz2d =
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
->m_quartz2d;
if (!m_Font.GetPlatformFont()) {
- if (m_Font.GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
- bCoreText = FALSE;
- }
+ if (m_Font.GetPsName() == "DFHeiStd-W5")
+ bCoreText = false;
+
m_Font.SetPlatformFont(
quartz2d.CreateFont(m_Font.GetFontData(), m_Font.GetSize()));
- if (!m_Font.GetPlatformFont()) {
- bCoreText = FALSE;
- }
+ if (!m_Font.GetPlatformFont())
+ bCoreText = false;
}
#endif
if (!IsEmbedded() && (m_Base14Font < 12) && m_Font.IsTTFont()) {
@@ -164,9 +163,8 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
if (bGotOne) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (!bCoreText) {
+ if (!bCoreText)
FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
- }
#endif
return;
}
@@ -218,9 +216,8 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (!bCoreText) {
+ if (!bCoreText)
FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
- }
#endif
return;
}
@@ -366,9 +363,9 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (!bCoreText) {
+ if (!bCoreText)
FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
- }
+
#endif
return;
}
@@ -397,8 +394,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
}
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (!bCoreText) {
+ if (!bCoreText)
FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256);
- }
#endif
}
diff --git a/core/fxge/android/fpf_skiafont.cpp b/core/fxge/android/fpf_skiafont.cpp
index 332bfd0ca2..e3277137d0 100644
--- a/core/fxge/android/fpf_skiafont.cpp
+++ b/core/fxge/android/fpf_skiafont.cpp
@@ -49,10 +49,10 @@ CFX_ByteString CFPF_SkiaFont::GetFamilyName() {
return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
}
-CFX_WideString CFPF_SkiaFont::GetPsName() {
+CFX_ByteString CFPF_SkiaFont::GetPsName() {
if (!m_Face)
- return CFX_WideString();
- return CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face));
+ return CFX_ByteString();
+ return FXFT_Get_Postscript_Name(m_Face);
}
int32_t CFPF_SkiaFont::GetGlyphIndex(FX_WCHAR wUnicode) {
diff --git a/core/fxge/android/fpf_skiafont.h b/core/fxge/android/fpf_skiafont.h
index 59172a5385..15347b2ff3 100644
--- a/core/fxge/android/fpf_skiafont.h
+++ b/core/fxge/android/fpf_skiafont.h
@@ -28,7 +28,7 @@ class CFPF_SkiaFont {
FPF_HFONT GetHandle();
CFX_ByteString GetFamilyName();
- CFX_WideString GetPsName();
+ CFX_ByteString GetPsName();
uint32_t GetFontStyle() const { return m_dwStyle; }
uint8_t GetCharset() const { return m_uCharset; }
int32_t GetGlyphIndex(FX_WCHAR wUnicode);
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index a641ad5f85..7bedc678ac 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -71,9 +71,9 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
->m_quartz2d;
if (!pFont->GetPlatformFont()) {
- if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
+ if (pFont->GetPsName() == "DFHeiStd-W5")
return FALSE;
- }
+
pFont->SetPlatformFont(
quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize()));
if (!pFont->GetPlatformFont()) {
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 5bdffa9409..6fc22ffdf4 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -758,9 +758,9 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars,
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
->m_quartz2d;
if (!pFont->GetPlatformFont()) {
- if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
+ if (pFont->GetPsName() == "DFHeiStd-W5")
return FALSE;
- }
+
pFont->SetPlatformFont(
quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize()));
if (!pFont->GetPlatformFont()) {
diff --git a/core/fxge/ge/fx_ge_font.cpp b/core/fxge/ge/fx_ge_font.cpp
index 144228ff28..ba53be7ab5 100644
--- a/core/fxge/ge/fx_ge_font.cpp
+++ b/core/fxge/ge/fx_ge_font.cpp
@@ -356,17 +356,16 @@ FX_BOOL CFX_Font::IsFixedWidth() const {
return FXFT_Is_Face_fixedwidth(m_Face);
}
-CFX_WideString CFX_Font::GetPsName() const {
- if (!m_Face) {
- return CFX_WideString();
- }
- CFX_WideString psName =
- CFX_WideString::FromLocal(FXFT_Get_Postscript_Name(m_Face));
- if (psName.IsEmpty()) {
- psName = CFX_WideString::FromLocal("Untitled");
- }
+CFX_ByteString CFX_Font::GetPsName() const {
+ if (!m_Face)
+ return CFX_ByteString();
+
+ CFX_ByteString psName = FXFT_Get_Postscript_Name(m_Face);
+ if (psName.IsEmpty())
+ psName = "Untitled";
return psName;
}
+
CFX_ByteString CFX_Font::GetFamilyName() const {
if (!m_Face && !m_pSubstFont) {
return CFX_ByteString();
diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp
index aeac66b4b0..042e6f2b5b 100644
--- a/core/fxge/ge/fx_ge_text.cpp
+++ b/core/fxge/ge/fx_ge_text.cpp
@@ -347,6 +347,21 @@ void DrawNormalTextHelper(CFX_DIBitmap* bitmap,
}
}
+bool ShouldDrawDeviceText(const CFX_Font* pFont, uint32_t text_flags) {
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ if (text_flags & FXFONT_CIDFONT)
+ return false;
+
+ const CFX_ByteString bsPsName = pFont->GetPsName();
+ if (bsPsName.Find("+ZJHL") != -1)
+ return false;
+
+ if (bsPsName == "CNAAJI+cmex10")
+ return false;
+#endif
+ return true;
+}
+
} // namespace
void Color2Argb(FX_ARGB& argb,
@@ -431,16 +446,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
int nativetext_flags = text_flags;
if (m_DeviceClass != FXDC_DISPLAY) {
if (!(text_flags & FXTEXT_PRINTGRAPHICTEXT)) {
- bool should_call_draw_device_text = true;
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if ((text_flags & FXFONT_CIDFONT) ||
- (pFont->GetPsName().Find(
- CFX_WideString::FromLocal("+ZJHL").AsStringC()) != -1) ||
- (pFont->GetPsName() == CFX_WideString::FromLocal("CNAAJI+cmex10"))) {
- should_call_draw_device_text = false;
- }
-#endif
- if (should_call_draw_device_text &&
+ if (ShouldDrawDeviceText(pFont, text_flags) &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache,
pText2Device, font_size, fill_color,
0, nullptr)) {
@@ -450,14 +456,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
if (FXARGB_A(fill_color) < 255)
return FALSE;
} else if (!(text_flags & FXTEXT_NO_NATIVETEXT)) {
- bool should_call_draw_device_text = true;
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if ((text_flags & FXFONT_CIDFONT) ||
- (pFont->GetPsName() == CFX_WideString::FromLocal("CNAAJI+cmex10"))) {
- should_call_draw_device_text = false;
- }
-#endif
- if (should_call_draw_device_text &&
+ if (ShouldDrawDeviceText(pFont, text_flags) &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache,
pText2Device, font_size, fill_color, 0,
nullptr)) {
diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h
index a8eaecec59..023a6a0928 100644
--- a/core/fxge/include/fx_font.h
+++ b/core/fxge/include/fx_font.h
@@ -102,7 +102,7 @@ class CFX_Font {
FX_BOOL IsBold() const;
FX_BOOL IsFixedWidth() const;
FX_BOOL IsVertical() const { return m_bVertical; }
- CFX_WideString GetPsName() const;
+ CFX_ByteString GetPsName() const;
CFX_ByteString GetFamilyName() const;
CFX_ByteString GetFaceName() const;
FX_BOOL IsTTFont() const;
diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h
index 406c6f96a8..980538d612 100644
--- a/xfa/fgas/font/fgas_font.h
+++ b/xfa/fgas/font/fgas_font.h
@@ -71,7 +71,6 @@ class IFX_Font {
virtual IFX_Font* Retain() = 0;
virtual IFX_Font* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0) = 0;
virtual void GetFamilyName(CFX_WideString& wsFamily) const = 0;
- virtual void GetPsName(CFX_WideString& wsName) const = 0;
virtual uint32_t GetFontStyles() const = 0;
virtual uint8_t GetCharSet() const = 0;
virtual FX_BOOL GetCharWidth(FX_WCHAR wUnicode,
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 6453a591b5..803bede6e5 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -336,9 +336,7 @@ void CFX_GEFont::GetFamilyName(CFX_WideString& wsFamily) const {
m_pFont->GetSubstFont()->m_Family.AsStringC());
}
}
-void CFX_GEFont::GetPsName(CFX_WideString& wsName) const {
- wsName = m_pFont->GetPsName();
-}
+
uint32_t CFX_GEFont::GetFontStyles() const {
ASSERT(m_pFont != NULL);
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index aa072280d5..8667bf9b0a 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -19,8 +19,10 @@ class CXFA_PDFFontMgr;
class CFX_GEFont : public IFX_Font {
public:
CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles);
- CFX_GEFont(IFX_FontMgr* pFontMgr);
+ explicit CFX_GEFont(IFX_FontMgr* pFontMgr);
~CFX_GEFont();
+
+ // IFX_Font:
virtual void Release();
virtual IFX_Font* Retain();
FX_BOOL LoadFont(const FX_WCHAR* pszFontFamily,
@@ -32,7 +34,6 @@ class CFX_GEFont : public IFX_Font {
FX_BOOL LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver = FALSE);
virtual IFX_Font* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0);
virtual void GetFamilyName(CFX_WideString& wsFamily) const;
- virtual void GetPsName(CFX_WideString& wsName) const;
virtual uint32_t GetFontStyles() const;
virtual uint8_t GetCharSet() const;
virtual FX_BOOL GetCharWidth(FX_WCHAR wUnicode,