summaryrefslogtreecommitdiff
path: root/core/src
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
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')
-rw-r--r--core/src/fpdfdoc/doc_form.cpp2
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp2
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp69
-rw-r--r--core/src/fpdftext/text_int.h6
-rw-r--r--core/src/fxcodec/codec/codec_int.h8
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp10
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp8
-rw-r--r--core/src/fxcrt/extension.h2
-rw-r--r--core/src/fxcrt/fx_basic_buffer.cpp2
-rw-r--r--core/src/fxcrt/fx_extension.cpp4
-rw-r--r--core/src/fxcrt/fx_unicode.cpp4
-rw-r--r--core/src/fxge/dib/fx_dib_convert.cpp2
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp24
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp6
14 files changed, 148 insertions, 1 deletions
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 241609efbc..ffd6bf7955 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -371,6 +371,7 @@ static FX_BOOL RetrieveSpecificFont(uint8_t charSet,
}
return RetrieveSpecificFont(lf);
}
+#ifdef PDF_ENABLE_XFA
static FX_BOOL RetrieveStockFont(int iFontObject,
uint8_t charSet,
LOGFONTA& lf) {
@@ -385,6 +386,7 @@ static FX_BOOL RetrieveStockFont(int iFontObject,
return FALSE;
}
#endif
+#endif
CPDF_Font* CPDF_InterForm::AddStandardFont(CPDF_Document* pDocument,
CFX_ByteString csFontName) {
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index a4de7bbee3..6f90d7e396 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -739,6 +739,7 @@ int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue,
}
return -1;
}
+#ifdef PDF_ENABLE_XFA
int CPDF_FormField::InsertOption(CFX_WideString csOptLabel,
int index,
FX_BOOL bNotify) {
@@ -816,6 +817,7 @@ FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
m_pForm->m_bUpdated = TRUE;
return TRUE;
}
+#endif
FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
FX_BOOL bChecked,
FX_BOOL bNotify) {
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index 3342f38da9..c69ffc8ee8 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -1525,6 +1525,10 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
int nItems = pTextObj->CountItems();
FX_FLOAT baseSpace = _CalculateBaseSpace(pTextObj, matrix);
+#ifndef PDF_ENABLE_XFA
+ const FX_BOOL bR2L = IsRightToLeft(pTextObj, pFont, nItems);
+ const FX_BOOL bIsBidiAndMirrorInverse =
+#else
FX_BOOL bIsBidiAndMirrosInverse = FALSE;
CFX_BidiChar* BidiChar = new CFX_BidiChar;
int32_t nR2L = 0;
@@ -1566,6 +1570,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
bR2L = TRUE;
}
bIsBidiAndMirrosInverse =
+#endif
bR2L && (matrix.a * matrix.d - matrix.b * matrix.c) < 0;
int32_t iBufStartAppend = m_TempTextBuf.GetLength();
int32_t iCharListStartAppend = m_TempCharList.GetSize();
@@ -1724,6 +1729,45 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
}
}
}
+#ifndef PDF_ENABLE_XFA
+ if (bIsBidiAndMirrorInverse) {
+ SwapTempTextBuf(iCharListStartAppend, iBufStartAppend);
+ }
+}
+void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
+ int32_t iBufStartAppend) {
+ int32_t i, j;
+ i = iCharListStartAppend;
+ j = m_TempCharList.GetSize() - 1;
+ for (; i < j; i++, j--) {
+ std::swap(m_TempCharList[i], m_TempCharList[j]);
+ std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index);
+ }
+ FX_WCHAR* pTempBuffer = m_TempTextBuf.GetBuffer();
+ i = iBufStartAppend;
+ j = m_TempTextBuf.GetLength() - 1;
+ for (; i < j; i++, j--) {
+ std::swap(pTempBuffer[i], pTempBuffer[j]);
+ }
+}
+FX_BOOL CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
+ const CPDF_Font* pFont,
+ int nItems) const {
+ nonstd::unique_ptr<CFX_BidiChar> pBidiChar(new CFX_BidiChar);
+ int32_t nR2L = 0;
+ int32_t nL2R = 0;
+ int32_t start = 0, count = 0;
+ CPDF_TextObjectItem item;
+ for (int32_t i = 0; i < nItems; i++) {
+ pTextObj->GetItemInfo(i, &item);
+ if (item.m_CharCode == (FX_DWORD)-1) {
+ continue;
+ }
+ CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ FX_WCHAR wChar = wstrItem.GetAt(0);
+ if ((wstrItem.IsEmpty() || wChar == 0) && item.m_CharCode) {
+ wChar = (FX_WCHAR)item.m_CharCode;
+#else
if (bIsBidiAndMirrosInverse) {
int32_t i, j;
i = iCharListStartAppend;
@@ -1731,14 +1775,39 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
for (; i < j; i++, j--) {
std::swap(m_TempCharList[i], m_TempCharList[j]);
std::swap(m_TempCharList[i].m_Index, m_TempCharList[j].m_Index);
+#endif
+ }
+#ifndef PDF_ENABLE_XFA
+ if (!wChar) {
+ continue;
+ }
+ if (pBidiChar->AppendChar(wChar)) {
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
+ if (ret == CFX_BidiChar::RIGHT) {
+ nR2L++;
+ } else if (ret == CFX_BidiChar::LEFT) {
+ nL2R++;
+ }
}
+ }
+ if (pBidiChar->EndChar()) {
+ CFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count);
+ if (ret == CFX_BidiChar::RIGHT) {
+ nR2L++;
+ } else if (ret == CFX_BidiChar::LEFT) {
+ nL2R++;
+#else
FX_WCHAR* pTempBuffer = m_TempTextBuf.GetBuffer();
i = iBufStartAppend;
j = m_TempTextBuf.GetLength() - 1;
for (; i < j; i++, j--) {
std::swap(pTempBuffer[i], pTempBuffer[j]);
+#endif
}
}
+#ifndef PDF_ENABLE_XFA
+ return (nR2L > 0 && nR2L >= nL2R);
+#endif
}
int32_t CPDF_TextPage::GetTextObjectWritingMode(
const CPDF_TextObject* pTextObj) {
diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h
index da4bf70ad1..d8e79b9610 100644
--- a/core/src/fpdftext/text_int.h
+++ b/core/src/fpdftext/text_int.h
@@ -125,6 +125,12 @@ class CPDF_TextPage : public IPDF_TextPage {
void AddCharInfoByRLDirection(CFX_WideString& str, int i);
int32_t GetTextObjectWritingMode(const CPDF_TextObject* pTextObj);
int32_t FindTextlineFlowDirection();
+#ifndef PDF_ENABLE_XFA
+ void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend);
+ FX_BOOL IsRightToLeft(const CPDF_TextObject* pTextObj,
+ const CPDF_Font* pFont,
+ int nItems) const;
+#endif
CPDFText_ParseOptions m_ParseOptions;
CFX_WordArray m_CharIndex;
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h
index 3d2acaf8c0..5abe2e4a6a 100644
--- a/core/src/fxcodec/codec/codec_int.h
+++ b/core/src/fxcodec/codec/codec_int.h
@@ -187,15 +187,20 @@ class CCodec_JpegModule : public ICodec_JpegModule {
void Input(void* pContext,
const uint8_t* src_buf,
FX_DWORD src_size) override;
+#ifndef PDF_ENABLE_XFA
+ int ReadHeader(void* pContext, int* width, int* height, int* nComps) override;
+#else
int ReadHeader(void* pContext,
int* width,
int* height,
int* nComps,
CFX_DIBAttribute* pAttribute) override;
+#endif
int StartScanline(void* pContext, int down_scale) override;
FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) override;
FX_DWORD GetAvailInput(void* pContext, uint8_t** avail_buf_ptr) override;
};
+#ifdef PDF_ENABLE_XFA
#define PNG_ERROR_SIZE 256
class CCodec_PngModule : public ICodec_PngModule {
public:
@@ -258,6 +263,7 @@ class CCodec_BmpModule : public ICodec_BmpModule {
protected:
FX_CHAR m_szLastError[256];
};
+#endif
class CCodec_IccModule : public ICodec_IccModule {
public:
~CCodec_IccModule() override;
@@ -336,6 +342,7 @@ class CCodec_JpxModule : public ICodec_JpxModule {
void DestroyDecoder(CJPX_Decoder* pDecoder) override;
};
+#ifdef PDF_ENABLE_XFA
class CCodec_TiffModule : public ICodec_TiffModule {
public:
// ICodec_TiffModule
@@ -355,6 +362,7 @@ class CCodec_TiffModule : public ICodec_TiffModule {
~CCodec_TiffModule() override {}
};
+#endif
class CCodec_Jbig2Context {
public:
CCodec_Jbig2Context();
diff --git a/core/src/fxcodec/codec/fx_codec.cpp b/core/src/fxcodec/codec/fx_codec.cpp
index 1efccf9af5..fb98fee3c5 100644
--- a/core/src/fxcodec/codec/fx_codec.cpp
+++ b/core/src/fxcodec/codec/fx_codec.cpp
@@ -21,11 +21,17 @@ CCodec_ModuleMgr::CCodec_ModuleMgr()
m_pJpxModule(new CCodec_JpxModule),
m_pJbig2Module(new CCodec_Jbig2Module),
m_pIccModule(new CCodec_IccModule),
+#ifndef PDF_ENABLE_XFA
+ m_pFlateModule(new CCodec_FlateModule) {
+}
+#else
m_pFlateModule(new CCodec_FlateModule),
m_pPngModule(new CCodec_PngModule),
m_pGifModule(new CCodec_GifModule),
m_pBmpModule(new CCodec_BmpModule),
- m_pTiffModule(new CCodec_TiffModule) {}
+ m_pTiffModule(new CCodec_TiffModule) {
+}
+#endif
CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width,
int height,
@@ -261,6 +267,7 @@ FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf,
FX_DWORD& dest_size) {
return FALSE;
}
+#ifdef PDF_ENABLE_XFA
CFX_DIBAttribute::CFX_DIBAttribute()
: m_nXDPI(-1),
m_nYDPI(-1),
@@ -278,6 +285,7 @@ CFX_DIBAttribute::~CFX_DIBAttribute() {
FX_Free(pair.second);
}
+#endif
class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
public:
CCodec_RLScanlineDecoder();
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index b59deb5a0d..b5eb4b2692 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -230,6 +230,7 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
FX_Free(line_buf);
dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer;
}
+#ifdef PDF_ENABLE_XFA
static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo,
CFX_DIBAttribute* pAttribute) {
if (pInfo == NULL || pAttribute == NULL) {
@@ -241,6 +242,7 @@ static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo,
pAttribute->m_wDPIUnit = pInfo->density_unit;
}
}
+#endif
static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf,
FX_DWORD src_size,
int& width,
@@ -630,8 +632,12 @@ void CCodec_JpegModule::Input(void* pContext,
int CCodec_JpegModule::ReadHeader(void* pContext,
int* width,
int* height,
+#ifndef PDF_ENABLE_XFA
+ int* nComps) {
+#else
int* nComps,
CFX_DIBAttribute* pAttribute) {
+#endif
FXJPEG_Context* p = (FXJPEG_Context*)pContext;
if (setjmp(p->m_JumpMark) == -1) {
return 1;
@@ -646,7 +652,9 @@ int CCodec_JpegModule::ReadHeader(void* pContext,
*width = p->m_Info.image_width;
*height = p->m_Info.image_height;
*nComps = p->m_Info.num_components;
+#ifdef PDF_ENABLE_XFA
_JpegLoadAttribute(&p->m_Info, pAttribute);
+#endif
return 0;
}
int CCodec_JpegModule::StartScanline(void* pContext, int down_scale) {
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index 718c8f0423..42cebdf605 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -31,6 +31,7 @@ class IFXCRT_FileAccess {
};
IFXCRT_FileAccess* FXCRT_FileAccess_Create();
+#ifdef PDF_ENABLE_XFA
class CFX_CRTFileAccess : public IFX_FileAccess {
public:
CFX_CRTFileAccess() : m_RefCount(0) {}
@@ -63,6 +64,7 @@ class CFX_CRTFileAccess : public IFX_FileAccess {
FX_DWORD m_RefCount;
};
+#endif
class CFX_CRTFileStream final : public IFX_FileStream {
public:
CFX_CRTFileStream(IFXCRT_FileAccess* pFA) : m_pFile(pFA), m_dwCount(1) {}
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp
index 1178331283..77af01202b 100644
--- a/core/src/fxcrt/fx_basic_buffer.cpp
+++ b/core/src/fxcrt/fx_basic_buffer.cpp
@@ -207,6 +207,7 @@ CFX_WideStringC CFX_WideTextBuf::GetWideString() const {
return CFX_WideStringC((const FX_WCHAR*)m_pBuffer,
m_DataSize / sizeof(FX_WCHAR));
}
+#ifdef PDF_ENABLE_XFA
CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(uint8_t i) {
if (m_pStream) {
m_pStream->WriteBlock(&i, 1);
@@ -331,6 +332,7 @@ FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) {
m_LoadingPos += dwSize;
return TRUE;
}
+#endif
void CFX_BitStream::Init(const uint8_t* pData, FX_DWORD dwSize) {
m_pData = pData;
m_BitSize = dwSize * 8;
diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp
index 3761192a8d..c796a57102 100644
--- a/core/src/fxcrt/fx_extension.cpp
+++ b/core/src/fxcrt/fx_extension.cpp
@@ -14,6 +14,7 @@
#include <ctime>
#endif
+#ifdef PDF_ENABLE_XFA
IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
if (wsPath.GetLength() == 0)
return NULL;
@@ -26,6 +27,7 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
pFA->Init(wsPath);
return pFA;
}
+#endif
IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) {
IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
if (!pFA) {
@@ -303,6 +305,7 @@ void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) {
FX_Random_GenerateBase(pBuffer, iCount);
#endif
}
+#ifdef PDF_ENABLE_XFA
void FX_GUID_CreateV4(FX_LPGUID pGUID) {
#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
@@ -336,3 +339,4 @@ void FX_GUID_ToString(FX_LPCGUID pGUID,
}
bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
}
+#endif
diff --git a/core/src/fxcrt/fx_unicode.cpp b/core/src/fxcrt/fx_unicode.cpp
index 2e86aec64c..fe97a14f46 100644
--- a/core/src/fxcrt/fx_unicode.cpp
+++ b/core/src/fxcrt/fx_unicode.cpp
@@ -13,11 +13,13 @@ FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch) {
return 0;
}
+#ifdef PDF_ENABLE_XFA
FX_BOOL FX_IsCtrlCode(FX_WCHAR ch) {
FX_DWORD dwRet = (FX_GetUnicodeProperties(ch) & FX_CHARTYPEBITSMASK);
return dwRet == FX_CHARTYPE_Tab || dwRet == FX_CHARTYPE_Control;
}
+#endif
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) {
FX_DWORD dwProps = FX_GetUnicodeProperties(wch);
FX_DWORD dwTemp = (dwProps & 0xFF800000);
@@ -38,6 +40,7 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) {
}
return wch;
}
+#ifdef PDF_ENABLE_XFA
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
FX_DWORD dwProps,
@@ -61,3 +64,4 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
}
return wch;
}
+#endif
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 6a01c1f10d..80483f07d3 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -617,10 +617,12 @@ FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
int src_top,
FX_DWORD* dst_plt,
void* pIccTransform) {
+#ifdef PDF_ENABLE_XFA
ICodec_IccModule* pIccModule = NULL;
if (pIccTransform) {
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
}
+#endif
FX_BOOL ret = _ConvertBuffer_Rgb2PltRgb8_NoTransform(
dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top,
dst_plt);
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
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index c41f448e89..6b0d7bf7e8 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -1083,9 +1083,11 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT;
}
if (hFont == NULL) {
+#ifdef PDF_ENABLE_XFA
if (flags & FXFONT_EXACTMATCH) {
return NULL;
}
+#endif
if (bCJK) {
if (italic_angle != 0) {
bItalic = TRUE;
@@ -1211,6 +1213,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
m_pFontInfo->DeleteFont(hFont);
return face;
}
+#ifdef PDF_ENABLE_XFA
FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode,
FX_DWORD flags,
int weight,
@@ -1293,6 +1296,7 @@ FX_BOOL CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const {
}
return FALSE;
}
+#endif
extern "C" {
unsigned long _FTStreamRead(FXFT_Stream stream,
unsigned long offset,
@@ -1514,12 +1518,14 @@ void* CFX_FolderFontInfo::MapFont(int weight,
int& iExact) {
return NULL;
}
+#ifdef PDF_ENABLE_XFA
void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode,
int weight,
FX_BOOL bItalic,
int pitch_family) {
return NULL;
}
+#endif
void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) {
auto it = m_FontList.find(face);
return it != m_FontList.end() ? it->second : nullptr;