summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-18 16:02:32 -0700
committerLei Zhang <thestig@chromium.org>2015-08-18 16:02:32 -0700
commita2b3ae23556fb2f1adbc008574f33bf365476af9 (patch)
tree7077643dce819ecd6ba6acedd85a03046d745e18
parente1ce94e0b045b443976c118a251400b4016f9811 (diff)
downloadpdfium-chromium/2489.tar.xz
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1297303002 .
-rw-r--r--core/include/fxge/fx_font.h4
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp24
-rw-r--r--core/src/fxge/apple/fx_apple_platform.cpp10
-rw-r--r--core/src/fxge/apple/fx_quartz_device.cpp10
4 files changed, 26 insertions, 22 deletions
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
index 04918ea275..1423be497b 100644
--- a/core/include/fxge/fx_font.h
+++ b/core/include/fxge/fx_font.h
@@ -91,6 +91,10 @@ class CFX_Font {
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);
private:
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 37b0c019a5..a228cf76ec 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -1090,13 +1090,13 @@ void CPDF_Type1Font::LoadGlyphMap() {
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;
}
}
@@ -1119,7 +1119,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);
}
@@ -1161,7 +1161,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);
}
@@ -1178,7 +1178,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);
}
@@ -1207,7 +1207,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
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);
}
@@ -1232,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);
}
@@ -1261,7 +1261,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
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);
}
@@ -1279,7 +1279,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);
}
@@ -1295,7 +1295,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);
}
diff --git a/core/src/fxge/apple/fx_apple_platform.cpp b/core/src/fxge/apple/fx_apple_platform.cpp
index 95cd1a1dd8..03b5629d4b 100644
--- a/core/src/fxge/apple/fx_apple_platform.cpp
+++ b/core/src/fxge/apple/fx_apple_platform.cpp
@@ -64,13 +64,13 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
}
CQuartz2D& quartz2d =
((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d;
- if (!pFont->m_pPlatformFont) {
+ if (!pFont->GetPlatformFont()) {
if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
return FALSE;
}
- pFont->m_pPlatformFont =
- quartz2d.CreateFont(pFont->m_pFontData, pFont->m_dwSize);
- if (NULL == pFont->m_pPlatformFont) {
+ pFont->SetPlatformFont(
+ quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize()));
+ if (!pFont->GetPlatformFont()) {
return FALSE;
}
}
@@ -92,7 +92,7 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
new_matrix.d = -new_matrix.d;
}
quartz2d.setGraphicsTextMatrix(pContext, &new_matrix);
- return quartz2d.drawGraphicsString(pContext, pFont->m_pPlatformFont,
+ return quartz2d.drawGraphicsString(pContext, pFont->GetPlatformFont(),
font_size, glyph_indices, glyph_positions,
nChars, argb, NULL);
}
diff --git a/core/src/fxge/apple/fx_quartz_device.cpp b/core/src/fxge/apple/fx_quartz_device.cpp
index 61a0cef543..eba27c0049 100644
--- a/core/src/fxge/apple/fx_quartz_device.cpp
+++ b/core/src/fxge/apple/fx_quartz_device.cpp
@@ -751,13 +751,13 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(
}
CQuartz2D& quartz2d =
((CApplePlatform*)CFX_GEModule::Get()->GetPlatformData())->_quartz2d;
- if (!pFont->m_pPlatformFont) {
+ if (!pFont->GetPlatformFont()) {
if (pFont->GetPsName() == CFX_WideString::FromLocal("DFHeiStd-W5")) {
return FALSE;
}
- pFont->m_pPlatformFont =
- quartz2d.CreateFont(pFont->m_pFontData, pFont->m_dwSize);
- if (NULL == pFont->m_pPlatformFont) {
+ pFont->SetPlatformFont(
+ quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize()));
+ if (!pFont->GetPlatformFont()) {
return FALSE;
}
}
@@ -777,7 +777,7 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(
text_matrix.d, text_matrix.e, text_matrix.f);
matrix_cg = CGAffineTransformConcat(matrix_cg, _foxitDevice2User);
CGContextSetTextMatrix(_context, matrix_cg);
- CGContextSetFont(_context, (CGFontRef)pFont->m_pPlatformFont);
+ CGContextSetFont(_context, (CGFontRef)pFont->GetPlatformFont());
CGContextSetFontSize(_context, FXSYS_fabs(font_size));
int32_t a, r, g, b;
ArgbDecode(argb, a, r, g, b);