summaryrefslogtreecommitdiff
path: root/core/src/fxge/ge/fx_ge_font.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-11-25 12:15:38 -0800
committerTom Sepez <tsepez@chromium.org>2015-11-25 12:15:38 -0800
commit5c4c193fd4b6dd0657abf5e74125f9887f91d720 (patch)
tree976cfb53dd2580eff58fb02556d1828fff12659d /core/src/fxge/ge/fx_ge_font.cpp
parent8b90ee66872aa883fc46ac2b6e7acad35c7c96c6 (diff)
downloadpdfium-5c4c193fd4b6dd0657abf5e74125f9887f91d720.tar.xz
Inflict PPDF_ENABLE_XFA ifdefs on XFA core/
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1471323004 .
Diffstat (limited to 'core/src/fxge/ge/fx_ge_font.cpp')
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index e02d46ffad..ffd7b77fb4 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -10,12 +10,15 @@
#define EM_ADJUST(em, a) (em == 0 ? (a) : (a)*1000 / em)
+#ifdef PDF_ENABLE_XFA
extern void _FPDFAPI_GetInternalFontData(int id1,
const uint8_t*& data,
FX_DWORD& size);
+#endif
namespace {
+#ifdef PDF_ENABLE_XFA
const FX_DWORD g_EncodingID[] = {
FXFM_ENCODING_MS_SYMBOL,
FXFM_ENCODING_UNICODE,
@@ -39,6 +42,7 @@ CFX_UnicodeEncodingEx* _FXFM_CreateFontEncoding(CFX_Font* pFont,
return new CFX_UnicodeEncodingEx(pFont, nEncodingID);
}
+#endif
FXFT_Face FT_LoadFont(const uint8_t* pData, int size) {
return CFX_GEModule::Get()->GetFontMgr()->GetFixedFace(pData, size, 0);
}
@@ -53,13 +57,16 @@ CFX_Font::CFX_Font() {
m_pFontData = NULL;
m_pFontDataAllocation = NULL;
m_dwSize = 0;
+#ifdef PDF_ENABLE_XFA
m_pOwnedStream = NULL;
+#endif
m_pGsubData = NULL;
m_pPlatformFont = NULL;
m_pPlatformFontCollection = NULL;
m_pDwFont = NULL;
m_hHandle = NULL;
m_bDwLoaded = FALSE;
+#ifdef PDF_ENABLE_XFA
m_bLogic = FALSE;
}
FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
@@ -93,23 +100,36 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
m_bDwLoaded = pFont->m_bDwLoaded;
m_pOwnedStream = pFont->m_pOwnedStream;
return TRUE;
+#endif
}
CFX_Font::~CFX_Font() {
delete m_pSubstFont;
m_pSubstFont = NULL;
+#ifndef PDF_ENABLE_XFA
+ FX_Free(m_pFontDataAllocation);
+ m_pFontDataAllocation = NULL;
+#else
if (m_bLogic) {
m_OtfFontData.DetachBuffer();
return;
}
+#endif
if (m_Face) {
+#ifndef PDF_ENABLE_XFA
+ if (FXFT_Get_Face_External_Stream(m_Face)) {
+ FXFT_Clear_Face_External_Stream(m_Face);
+ }
+#endif
if (m_bEmbedded) {
DeleteFace();
} else {
CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
}
}
+#ifdef PDF_ENABLE_XFA
FX_Free(m_pOwnedStream);
m_pOwnedStream = NULL;
+#endif
FX_Free(m_pGsubData);
m_pGsubData = NULL;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -144,6 +164,7 @@ void CFX_Font::LoadSubst(const CFX_ByteString& face_name,
m_dwSize = FXFT_Get_Face_Stream_Size(m_Face);
}
}
+#ifdef PDF_ENABLE_XFA
extern "C" {
unsigned long _FTStreamRead(FXFT_Stream stream,
unsigned long offset,
@@ -205,6 +226,7 @@ FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile,
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
return TRUE;
}
+#endif
int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) {
if (!m_Face) {
@@ -460,6 +482,7 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) {
}
return charcode;
}
+#ifdef PDF_ENABLE_XFA
CFX_UnicodeEncodingEx::CFX_UnicodeEncodingEx(CFX_Font* pFont,
FX_DWORD EncodingID)
@@ -532,3 +555,4 @@ CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont,
}
return NULL;
}
+#endif