summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h2
-rw-r--r--core/include/fxcodec/fx_codec.h44
-rw-r--r--core/include/fxcodec/fx_codec_def.h24
-rw-r--r--core/include/fxcrt/fx_basic.h10
-rw-r--r--core/include/fxcrt/fx_ext.h9
-rw-r--r--core/include/fxcrt/fx_stream.h2
-rw-r--r--core/include/fxcrt/fx_ucd.h84
-rw-r--r--core/include/fxge/fx_font.h31
-rw-r--r--core/src/fpdfdoc/doc_form.cpp4
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp2
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp176
-rw-r--r--core/src/fpdftext/text_int.h3
-rw-r--r--core/src/fxcodec/codec/codec_int.h10
-rw-r--r--core/src/fxcodec/codec/fx_codec.cpp14
-rw-r--r--core/src/fxcodec/codec/fx_codec_jpeg.cpp16
-rw-r--r--core/src/fxcrt/extension.h2
-rw-r--r--core/src/fxcrt/fx_basic_buffer.cpp4
-rw-r--r--core/src/fxcrt/fx_extension.cpp7
-rw-r--r--core/src/fxcrt/fx_unicode.cpp6
-rw-r--r--core/src/fxge/dib/fx_dib_convert.cpp2
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp25
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp9
22 files changed, 201 insertions, 285 deletions
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index 3f05fc9be9..7a81fd6b6f 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -831,8 +831,8 @@ class CPDF_FormField {
int InsertOption(CFX_WideString csOptLabel,
int index = -1,
FX_BOOL bNotify = FALSE);
+#endif // PDF_ENABLE_XFA
-#endif
FX_FLOAT GetFontSize() { return m_FontSize; }
CPDF_Font* GetFont() { return m_pFont; }
diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h
index 54d185a8ce..e7aeaf939b 100644
--- a/core/include/fxcodec/fx_codec.h
+++ b/core/include/fxcodec/fx_codec.h
@@ -7,42 +7,26 @@
#ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_H_
#define CORE_INCLUDE_FXCODEC_FX_CODEC_H_
-#ifdef PDF_ENABLE_XFA
#include <map>
-#endif
#include <vector>
+#include "core/include/fxcodec/fx_codec_def.h"
#include "core/include/fxcrt/fx_basic.h"
-#include "fx_codec_def.h"
+#include "core/include/fxcrt/fx_coordinates.h" // For FX_RECT.
#include "third_party/base/nonstd_unique_ptr.h"
-#ifdef PDF_ENABLE_XFA
-#include "../fxcrt/fx_coordinates.h" // For FX_RECT.
-
-#endif
class CFX_DIBSource;
class CJPX_Decoder;
class CPDF_PrivateData;
class CPDF_StreamAcc;
-#ifndef PDF_ENABLE_XFA
-class ICodec_ScanlineDecoder;
-#endif
class ICodec_BasicModule;
class ICodec_FaxModule;
-#ifdef PDF_ENABLE_XFA
class ICodec_FlateModule;
class ICodec_IccModule;
class ICodec_Jbig2Encoder;
class ICodec_Jbig2Module;
-#endif
class ICodec_JpegModule;
class ICodec_JpxModule;
-#ifndef PDF_ENABLE_XFA
-class ICodec_Jbig2Module;
-class ICodec_IccModule;
-class ICodec_FlateModule;
-class ICodec_Jbig2Encoder;
-#endif
class ICodec_ScanlineDecoder;
#ifdef PDF_ENABLE_XFA
@@ -51,7 +35,9 @@ class ICodec_GifModule;
class ICodec_PngModule;
class ICodec_ProgressiveDecoder;
class ICodec_TiffModule;
+#endif // PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA
class CFX_DIBAttribute {
public:
CFX_DIBAttribute();
@@ -70,8 +56,8 @@ class CFX_DIBAttribute {
int32_t m_nBmpCompressType;
std::map<FX_DWORD, void*> m_Exif;
};
+#endif // PDF_ENABLE_XFA
-#endif
class CCodec_ModuleMgr {
public:
CCodec_ModuleMgr();
@@ -90,8 +76,8 @@ class CCodec_ModuleMgr {
ICodec_GifModule* GetGifModule() const { return m_pGifModule.get(); }
ICodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); }
ICodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); }
+#endif // PDF_ENABLE_XFA
-#endif
protected:
nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule;
nonstd::unique_ptr<ICodec_FaxModule> m_pFaxModule;
@@ -99,14 +85,13 @@ class CCodec_ModuleMgr {
nonstd::unique_ptr<ICodec_JpxModule> m_pJpxModule;
nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module;
nonstd::unique_ptr<ICodec_IccModule> m_pIccModule;
- nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule;
#ifdef PDF_ENABLE_XFA
-
nonstd::unique_ptr<ICodec_PngModule> m_pPngModule;
nonstd::unique_ptr<ICodec_GifModule> m_pGifModule;
nonstd::unique_ptr<ICodec_BmpModule> m_pBmpModule;
nonstd::unique_ptr<ICodec_TiffModule> m_pTiffModule;
-#endif
+#endif // PDF_ENABLE_XFA
+ nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule;
};
class ICodec_BasicModule {
public:
@@ -247,15 +232,18 @@ class ICodec_JpegModule {
const uint8_t* src_buf,
FX_DWORD src_size) = 0;
+#ifdef PDF_ENABLE_XFA
virtual int ReadHeader(void* pContext,
int* width,
int* height,
-#ifndef PDF_ENABLE_XFA
- int* nComps) = 0;
-#else
int* nComps,
CFX_DIBAttribute* pAttribute) = 0;
-#endif
+#else // PDF_ENABLE_XFA
+ virtual int ReadHeader(void* pContext,
+ int* width,
+ int* height,
+ int* nComps) = 0;
+#endif // PDF_ENABLE_XFA
virtual int StartScanline(void* pContext, int down_scale) = 0;
@@ -465,7 +453,7 @@ class ICodec_ProgressiveDecoder {
virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = NULL) = 0;
};
-#endif
+#endif // PDF_ENABLE_XFA
class ICodec_Jbig2Encoder {
public:
virtual ~ICodec_Jbig2Encoder() {}
diff --git a/core/include/fxcodec/fx_codec_def.h b/core/include/fxcodec/fx_codec_def.h
index 6dd4d0d309..99ccf15f0f 100644
--- a/core/include/fxcodec/fx_codec_def.h
+++ b/core/include/fxcodec/fx_codec_def.h
@@ -7,17 +7,6 @@
#ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_DEF_H_
#define CORE_INCLUDE_FXCODEC_FX_CODEC_DEF_H_
-#ifdef PDF_ENABLE_XFA
-enum FXCODEC_IMAGE_TYPE {
- FXCODEC_IMAGE_UNKNOWN = 0,
- FXCODEC_IMAGE_BMP,
- FXCODEC_IMAGE_JPG,
- FXCODEC_IMAGE_PNG,
- FXCODEC_IMAGE_GIF,
- FXCODEC_IMAGE_TIF,
- FXCODEC_IMAGE_MAX
-};
-#endif
enum FXCODEC_STATUS {
FXCODEC_STATUS_ERROR = -1,
FXCODEC_STATUS_FRAME_READY,
@@ -27,7 +16,7 @@ enum FXCODEC_STATUS {
FXCODEC_STATUS_DECODE_FINISH,
#ifdef PDF_ENABLE_XFA
FXCODEC_STATUS_ERR_MEMORY,
-#endif
+#endif // PDF_ENABLE_XFA
FXCODEC_STATUS_ERR_READ,
FXCODEC_STATUS_ERR_FLUSH,
FXCODEC_STATUS_ERR_FORMAT,
@@ -73,13 +62,22 @@ enum FXCODEC_STATUS {
#define Icc_PARAMTYPE_BUFFER 1
#define Icc_PARAMTYPE_PARAM 2
#ifdef PDF_ENABLE_XFA
+enum FXCODEC_IMAGE_TYPE {
+ FXCODEC_IMAGE_UNKNOWN = 0,
+ FXCODEC_IMAGE_BMP,
+ FXCODEC_IMAGE_JPG,
+ FXCODEC_IMAGE_PNG,
+ FXCODEC_IMAGE_GIF,
+ FXCODEC_IMAGE_TIF,
+ FXCODEC_IMAGE_MAX
+};
enum FXCODEC_RESUNIT {
FXCODEC_RESUNIT_NONE = 0,
FXCODEC_RESUNIT_INCH,
FXCODEC_RESUNIT_CENTIMETER,
FXCODEC_RESUNIT_METER
};
-#endif
+#endif // PDF_ENABLE_XFA
#define EXIFTAG_USHORT_RESUNIT 296
#define EXIFTAG_FLOAT_DPIX 282
#define EXIFTAG_FLOAT_DPIY 283
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 710bbcc3c3..e35084c3e8 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -193,7 +193,7 @@ class CFX_ArchiveLoader {
FX_DWORD m_LoadingSize;
};
-#endif
+#endif // PDF_ENABLE_XFA
class IFX_BufferArchive {
public:
@@ -441,7 +441,7 @@ typedef CFX_ArrayTemplate<FX_FILESIZE> CFX_FileSizeArray;
#ifdef PDF_ENABLE_XFA
typedef CFX_ArrayTemplate<FX_FLOAT> CFX_FloatArray;
typedef CFX_ArrayTemplate<int32_t> CFX_Int32Array;
-#endif
+#endif // PDF_ENABLE_XFA
template <class ObjectClass>
class CFX_ObjectArray : public CFX_BasicArray {
@@ -728,9 +728,7 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr {
FX_BOOL RemoveKey(KeyType key) {
return CFX_MapPtrToPtr::RemoveKey((void*)(uintptr_t)key);
}
-#endif
-#ifdef PDF_ENABLE_XFA
void GetNextAssoc(FX_POSITION& rNextPosition,
KeyType& rKey,
ValueType& rValue) const {
@@ -741,7 +739,7 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr {
rValue = (ValueType)(uintptr_t)pValue;
}
};
-#endif
+#endif // PDF_ENABLE_XFA
class CFX_CMapByteStringToPtr {
public:
CFX_CMapByteStringToPtr();
@@ -1203,7 +1201,7 @@ class IFX_Unknown {
virtual FX_DWORD AddRef() = 0;
};
#define FX_IsOdd(a) ((a)&1)
-#endif
+#endif // PDF_ENABLE_XFA
class CFX_Vector_3by1 {
public:
diff --git a/core/include/fxcrt/fx_ext.h b/core/include/fxcrt/fx_ext.h
index 908d6c3fe5..48801bb196 100644
--- a/core/include/fxcrt/fx_ext.h
+++ b/core/include/fxcrt/fx_ext.h
@@ -10,10 +10,7 @@
#include <cctype>
#include <cwctype>
-#ifdef PDF_ENABLE_XFA
-#include "fx_string.h"
-#endif
-#include "fx_system.h"
+#include "core/include/fxcrt/fx_basic.h"
FX_FLOAT FXSYS_tan(FX_FLOAT a);
FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x);
@@ -86,14 +83,12 @@ typedef struct FX_GUID {
uint8_t data4[8];
} FX_GUID, *FX_LPGUID;
typedef FX_GUID const* FX_LPCGUID;
-
void FX_GUID_CreateV4(FX_LPGUID pGUID);
-
void FX_GUID_ToString(FX_LPCGUID pGUID,
CFX_ByteString& bsStr,
FX_BOOL bSeparator = TRUE);
+#endif // PDF_ENABLE_XFA
-#endif
template <class baseType>
class CFX_SSortTemplate {
public:
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h
index 300bfb1941..a5bec7f51b 100644
--- a/core/include/fxcrt/fx_stream.h
+++ b/core/include/fxcrt/fx_stream.h
@@ -137,8 +137,8 @@ class IFX_FileAccess {
virtual IFX_FileStream* CreateFileStream(FX_DWORD dwModes) = 0;
};
IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
+#endif // PDF_ENABLE_XFA
-#endif
class IFX_MemoryStream : public IFX_FileStream {
public:
virtual FX_BOOL IsConsecutive() const = 0;
diff --git a/core/include/fxcrt/fx_ucd.h b/core/include/fxcrt/fx_ucd.h
index 852a893843..27812de13d 100644
--- a/core/include/fxcrt/fx_ucd.h
+++ b/core/include/fxcrt/fx_ucd.h
@@ -7,11 +7,44 @@
#ifndef CORE_INCLUDE_FXCRT_FX_UCD_H_
#define CORE_INCLUDE_FXCRT_FX_UCD_H_
-#ifndef PDF_ENABLE_XFA
-#include "fx_system.h"
-#else
#include "fx_basic.h"
-#endif
+
+#define FX_BIDICLASSBITS 6
+#define FX_BIDICLASSBITSMASK (31 << FX_BIDICLASSBITS)
+enum FX_BIDICLASS {
+ FX_BIDICLASS_ON = 0, // Other Neutral
+ FX_BIDICLASS_L = 1, // Left Letter
+ FX_BIDICLASS_R = 2, // Right Letter
+ FX_BIDICLASS_AN = 3, // Arabic Number
+ FX_BIDICLASS_EN = 4, // European Number
+ FX_BIDICLASS_AL = 5, // Arabic Letter
+ FX_BIDICLASS_NSM = 6, // Non-spacing Mark
+ FX_BIDICLASS_CS = 7, // Common Number Separator
+ FX_BIDICLASS_ES = 8, // European Separator
+ FX_BIDICLASS_ET = 9, // European Number Terminator
+ FX_BIDICLASS_BN = 10, // Boundary Neutral
+ FX_BIDICLASS_S = 11, // Segment Separator
+ FX_BIDICLASS_WS = 12, // Whitespace
+ FX_BIDICLASS_B = 13, // Paragraph Separator
+ FX_BIDICLASS_RLO = 14, // Right-to-Left Override
+ FX_BIDICLASS_RLE = 15, // Right-to-Left Embedding
+ FX_BIDICLASS_LRO = 16, // Left-to-Right Override
+ FX_BIDICLASS_LRE = 17, // Left-to-Right Embedding
+ FX_BIDICLASS_PDF = 18, // Pop Directional Format
+ FX_BIDICLASS_N = FX_BIDICLASS_ON,
+};
+
+extern const FX_DWORD kTextLayoutCodeProperties[];
+extern const size_t kTextLayoutCodePropertiesSize;
+
+extern const FX_WCHAR kFXTextLayoutVerticalMirror[];
+extern const size_t kFXTextLayoutVerticalMirrorSize;
+
+extern const FX_WCHAR kFXTextLayoutBidiMirror[];
+extern const size_t kFXTextLayoutBidiMirrorSize;
+
+FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch);
+FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical);
#ifdef PDF_ENABLE_XFA
enum FX_CHARBREAKPROP {
@@ -55,42 +88,7 @@ enum FX_CHARBREAKPROP {
FX_CBP_TB = 37,
FX_CBP_NONE = 36,
};
-#endif
-#define FX_BIDICLASSBITS 6
-#define FX_BIDICLASSBITSMASK (31 << FX_BIDICLASSBITS)
-enum FX_BIDICLASS {
- FX_BIDICLASS_ON = 0, // Other Neutral
- FX_BIDICLASS_L = 1, // Left Letter
- FX_BIDICLASS_R = 2, // Right Letter
- FX_BIDICLASS_AN = 3, // Arabic Number
- FX_BIDICLASS_EN = 4, // European Number
- FX_BIDICLASS_AL = 5, // Arabic Letter
- FX_BIDICLASS_NSM = 6, // Non-spacing Mark
- FX_BIDICLASS_CS = 7, // Common Number Separator
- FX_BIDICLASS_ES = 8, // European Separator
- FX_BIDICLASS_ET = 9, // European Number Terminator
- FX_BIDICLASS_BN = 10, // Boundary Neutral
- FX_BIDICLASS_S = 11, // Segment Separator
- FX_BIDICLASS_WS = 12, // Whitespace
- FX_BIDICLASS_B = 13, // Paragraph Separator
- FX_BIDICLASS_RLO = 14, // Right-to-Left Override
- FX_BIDICLASS_RLE = 15, // Right-to-Left Embedding
- FX_BIDICLASS_LRO = 16, // Left-to-Right Override
- FX_BIDICLASS_LRE = 17, // Left-to-Right Embedding
- FX_BIDICLASS_PDF = 18, // Pop Directional Format
- FX_BIDICLASS_N = FX_BIDICLASS_ON,
-};
-
-extern const FX_DWORD kTextLayoutCodeProperties[];
-extern const size_t kTextLayoutCodePropertiesSize;
-
-extern const FX_WCHAR kFXTextLayoutVerticalMirror[];
-extern const size_t kFXTextLayoutVerticalMirrorSize;
-extern const FX_WCHAR kFXTextLayoutBidiMirror[];
-extern const size_t kFXTextLayoutBidiMirrorSize;
-
-#ifdef PDF_ENABLE_XFA
#define FX_CHARTYPEBITS 11
#define FX_CHARTYPEBITSMASK (15 << FX_CHARTYPEBITS)
enum FX_CHARTYPE {
@@ -109,13 +107,7 @@ enum FX_CHARTYPE {
FX_CHARTYPE_Arabic = (12 << FX_CHARTYPEBITS),
};
-#endif
-FX_DWORD FX_GetUnicodeProperties(FX_WCHAR wch);
-#ifdef PDF_ENABLE_XFA
FX_BOOL FX_IsCtrlCode(FX_WCHAR ch);
-#endif
-FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical);
-#ifdef PDF_ENABLE_XFA
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
FX_DWORD dwProps,
FX_BOOL bRTL,
@@ -194,6 +186,6 @@ class CFX_RTFChar : public CFX_Char {
IFX_Unknown* m_pUserData;
};
typedef CFX_ArrayTemplate<CFX_RTFChar> CFX_RTFCharArray;
-#endif
+#endif // PDF_ENABLE_XFA
#endif // CORE_INCLUDE_FXCRT_FX_UCD_H_
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
index 5b31126b3e..0f35115eee 100644
--- a/core/include/fxge/fx_font.h
+++ b/core/include/fxge/fx_font.h
@@ -36,7 +36,7 @@ class IFX_SystemFontInfo;
#define FXFONT_CIDFONT 0x100000
#ifdef PDF_ENABLE_XFA
#define FXFONT_EXACTMATCH 0x80000000
-#endif
+#endif // PDF_ENABLE_XFA
#define FXFONT_ANSI_CHARSET 0
#define FXFONT_DEFAULT_CHARSET 1
#define FXFONT_SYMBOL_CHARSET 2
@@ -71,23 +71,21 @@ class CFX_Font {
int CharsetCP,
FX_BOOL bVertical = FALSE);
FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size);
-#ifdef PDF_ENABLE_XFA
+ FXFT_Face GetFace() const { return m_Face; }
+#ifdef PDF_ENABLE_XFA
FX_BOOL LoadFile(IFX_FileRead* pFile,
int nFaceIndex = 0,
int* pFaceCount = NULL);
FX_BOOL LoadClone(const CFX_Font* pFont);
-
-#endif
- FXFT_Face GetFace() const { return m_Face; }
-#ifndef PDF_ENABLE_XFA
- const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
-#else
CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
void SetFace(FXFT_Face face) { m_Face = face; }
void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; }
-#endif
+#else // PDF_ENABLE_XFA
+ const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
+#endif // PDF_ENABLE_XFA
+
CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0);
int GetGlyphWidth(FX_DWORD glyph_index);
int GetAscent() const;
@@ -133,12 +131,12 @@ class CFX_Font {
FX_BOOL m_bDwLoaded;
FX_BOOL m_bEmbedded;
FX_BOOL m_bVertical;
-#ifdef PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA
protected:
FX_BOOL m_bLogic;
void* m_pOwnedStream;
-#endif
+#endif // PDF_ENABLE_XFA
};
#define ENCODING_INTERNAL 0
@@ -162,8 +160,8 @@ class CFX_Font {
#define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1')
#define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2')
#define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n')
+#endif // PDF_ENABLE_XFA
-#endif
class CFX_UnicodeEncoding {
public:
explicit CFX_UnicodeEncoding(CFX_Font* pFont);
@@ -190,12 +188,11 @@ class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding {
private:
FX_DWORD m_nEncodingID;
};
-
CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(
CFX_Font* pFont,
FX_DWORD nEncodingID = FXFM_ENCODING_NONE);
+#endif // PDF_ENABLE_XFA
-#endif
#define FXFONT_SUBST_MM 0x01
#define FXFONT_SUBST_GLYPHPATH 0x04
#define FXFONT_SUBST_CLEARTYPE 0x08
@@ -327,7 +324,7 @@ class CFX_FontMapper {
int weight,
int italic_angle);
FX_BOOL IsBuiltinFace(const FXFT_Face face) const;
-#endif
+#endif // PDF_ENABLE_XFA
private:
static const size_t MM_FACE_COUNT = 2;
@@ -371,7 +368,7 @@ class IFX_SystemFontInfo {
int pitch_family) {
return NULL;
}
-#endif
+#endif // PDF_ENABLE_XFA
virtual void* GetFont(const FX_CHAR* face) = 0;
virtual FX_DWORD GetFontData(void* hFont,
FX_DWORD table,
@@ -407,7 +404,7 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
int weight,
FX_BOOL bItalic,
int pitch_family) override;
-#endif
+#endif // PDF_ENABLE_XFA
void* GetFont(const FX_CHAR* face) override;
FX_DWORD GetFontData(void* hFont,
FX_DWORD table,
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index ffd6bf7955..c73b3e199e 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -385,8 +385,8 @@ static FX_BOOL RetrieveStockFont(int iFontObject,
}
return FALSE;
}
-#endif
-#endif
+#endif // PDF_ENABLE_XFA
+#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
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 6f90d7e396..c5d789a4e4 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -817,7 +817,7 @@ FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
m_pForm->m_bUpdated = TRUE;
return TRUE;
}
-#endif
+#endif // PDF_ENABLE_XFA
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 c69ffc8ee8..ee768af3bc 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -1421,6 +1421,62 @@ void CPDF_TextPage::FindPreviousTextObject(void) {
m_pPreTextObj = preChar.m_pTextObj;
}
}
+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;
+ }
+ 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++;
+ }
+ }
+ return (nR2L > 0 && nR2L >= nL2R);
+}
void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
CPDF_TextObject* pTextObj = Obj.m_pTextObj;
if (FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f) {
@@ -1525,52 +1581,8 @@ 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;
- 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;
- }
- if (!wChar) {
- continue;
- }
- if (BidiChar && BidiChar->AppendChar(wChar)) {
- CFX_BidiChar::Direction ret = BidiChar->GetBidiInfo(&start, &count);
- if (ret == CFX_BidiChar::RIGHT) {
- nR2L++;
- } else if (ret == CFX_BidiChar::LEFT) {
- nL2R++;
- }
- }
- }
- if (BidiChar && BidiChar->EndChar()) {
- CFX_BidiChar::Direction ret = BidiChar->GetBidiInfo(&start, &count);
- if (ret == CFX_BidiChar::RIGHT) {
- nR2L++;
- } else if (ret == CFX_BidiChar::LEFT) {
- nL2R++;
- }
- }
- FX_BOOL bR2L = FALSE;
- if (nR2L > 0 && nR2L >= nL2R) {
- 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();
@@ -1729,86 +1741,10 @@ 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;
- 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);
-#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) {
int32_t nChars = pTextObj->CountChars();
diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h
index d8e79b9610..e68ead7741 100644
--- a/core/src/fpdftext/text_int.h
+++ b/core/src/fpdftext/text_int.h
@@ -125,12 +125,11 @@ 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 5abe2e4a6a..7d440d0b61 100644
--- a/core/src/fxcodec/codec/codec_int.h
+++ b/core/src/fxcodec/codec/codec_int.h
@@ -189,17 +189,18 @@ class CCodec_JpegModule : public ICodec_JpegModule {
FX_DWORD src_size) override;
#ifndef PDF_ENABLE_XFA
int ReadHeader(void* pContext, int* width, int* height, int* nComps) override;
-#else
+#else // PDF_ENABLE_XFA
int ReadHeader(void* pContext,
int* width,
int* height,
int* nComps,
CFX_DIBAttribute* pAttribute) override;
-#endif
+#endif // PDF_ENABLE_XFA
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 {
@@ -263,7 +264,8 @@ class CCodec_BmpModule : public ICodec_BmpModule {
protected:
FX_CHAR m_szLastError[256];
};
-#endif
+#endif // PDF_ENABLE_XFA
+
class CCodec_IccModule : public ICodec_IccModule {
public:
~CCodec_IccModule() override;
@@ -361,8 +363,8 @@ class CCodec_TiffModule : public ICodec_TiffModule {
protected:
~CCodec_TiffModule() override {}
};
+#endif // PDF_ENABLE_XFA
-#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 fb98fee3c5..a52dd8a496 100644
--- a/core/src/fxcodec/codec/fx_codec.cpp
+++ b/core/src/fxcodec/codec/fx_codec.cpp
@@ -21,17 +21,14 @@ 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),
+#ifdef PDF_ENABLE_XFA
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 // PDF_ENABLE_XFA
+ m_pFlateModule(new CCodec_FlateModule) {
}
-#endif
CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width,
int height,
@@ -267,6 +264,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),
@@ -284,8 +282,8 @@ CFX_DIBAttribute::~CFX_DIBAttribute() {
for (const auto& pair : m_Exif)
FX_Free(pair.second);
}
+#endif // PDF_ENABLE_XFA
-#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 b5eb4b2692..1276219123 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) {
@@ -242,7 +243,8 @@ static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo,
pAttribute->m_wDPIUnit = pInfo->density_unit;
}
}
-#endif
+#endif // PDF_ENABLE_XFA
+
static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf,
FX_DWORD src_size,
int& width,
@@ -629,15 +631,19 @@ void CCodec_JpegModule::Input(void* pContext,
p->m_SrcMgr.next_input_byte = src_buf;
p->m_SrcMgr.bytes_in_buffer = src_size;
}
+
+#ifdef PDF_ENABLE_XFA
int CCodec_JpegModule::ReadHeader(void* pContext,
int* width,
int* height,
-#ifndef PDF_ENABLE_XFA
- int* nComps) {
-#else
int* nComps,
CFX_DIBAttribute* pAttribute) {
-#endif
+#else // PDF_ENABLE_XFA
+int CCodec_JpegModule::ReadHeader(void* pContext,
+ int* width,
+ int* height,
+ int* nComps) {
+#endif // PDF_ENABLE_XFA
FXJPEG_Context* p = (FXJPEG_Context*)pContext;
if (setjmp(p->m_JumpMark) == -1) {
return 1;
diff --git a/core/src/fxcrt/extension.h b/core/src/fxcrt/extension.h
index 42cebdf605..0c9f4573df 100644
--- a/core/src/fxcrt/extension.h
+++ b/core/src/fxcrt/extension.h
@@ -63,8 +63,8 @@ class CFX_CRTFileAccess : public IFX_FileAccess {
CFX_WideString m_path;
FX_DWORD m_RefCount;
};
+#endif // PDF_ENABLE_XFA
-#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 77af01202b..cc72e471f1 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) {
@@ -332,7 +333,8 @@ FX_BOOL CFX_ArchiveLoader::Read(void* pBuf, FX_DWORD dwSize) {
m_LoadingPos += dwSize;
return TRUE;
}
-#endif
+#endif // PDF_ENABLE_XFA
+
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 c796a57102..84186fb769 100644
--- a/core/src/fxcrt/fx_extension.cpp
+++ b/core/src/fxcrt/fx_extension.cpp
@@ -27,7 +27,8 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath) {
pFA->Init(wsPath);
return pFA;
}
-#endif
+#endif // PDF_ENABLE_XFA
+
IFX_FileStream* FX_CreateFileStream(const FX_CHAR* filename, FX_DWORD dwModes) {
IFXCRT_FileAccess* pFA = FXCRT_FileAccess_Create();
if (!pFA) {
@@ -305,8 +306,8 @@ void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount) {
FX_Random_GenerateBase(pBuffer, iCount);
#endif
}
-#ifdef PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA
void FX_GUID_CreateV4(FX_LPGUID pGUID) {
#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN32_MOBILE_ || \
_FX_OS_ == _FX_WIN64_)
@@ -339,4 +340,4 @@ void FX_GUID_ToString(FX_LPCGUID pGUID,
}
bsStr.ReleaseBuffer(bSeparator ? 36 : 32);
}
-#endif
+#endif // PDF_ENABLE_XFA
diff --git a/core/src/fxcrt/fx_unicode.cpp b/core/src/fxcrt/fx_unicode.cpp
index fe97a14f46..140bab0b27 100644
--- a/core/src/fxcrt/fx_unicode.cpp
+++ b/core/src/fxcrt/fx_unicode.cpp
@@ -18,8 +18,8 @@ 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 // PDF_ENABLE_XFA
-#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);
@@ -40,8 +40,8 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch, FX_BOOL bRTL, FX_BOOL bVertical) {
}
return wch;
}
-#ifdef PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA
FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
FX_DWORD dwProps,
FX_BOOL bRTL,
@@ -64,4 +64,4 @@ FX_WCHAR FX_GetMirrorChar(FX_WCHAR wch,
}
return wch;
}
-#endif
+#endif // PDF_ENABLE_XFA
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 80483f07d3..2c310f3cea 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -622,7 +622,7 @@ FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
if (pIccTransform) {
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
}
-#endif
+#endif // PDF_ENABLE_XFA
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 ffd7b77fb4..e8c592e463 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -14,8 +14,8 @@
extern void _FPDFAPI_GetInternalFontData(int id1,
const uint8_t*& data,
FX_DWORD& size);
+#endif // PDF_ENABLE_XFA
-#endif
namespace {
#ifdef PDF_ENABLE_XFA
@@ -41,8 +41,8 @@ CFX_UnicodeEncodingEx* _FXFM_CreateFontEncoding(CFX_Font* pFont,
return nullptr;
return new CFX_UnicodeEncodingEx(pFont, nEncodingID);
}
+#endif // PDF_ENABLE_XFA
-#endif
FXFT_Face FT_LoadFont(const uint8_t* pData, int size) {
return CFX_GEModule::Get()->GetFontMgr()->GetFixedFace(pData, size, 0);
}
@@ -57,9 +57,6 @@ 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;
@@ -68,7 +65,11 @@ CFX_Font::CFX_Font() {
m_bDwLoaded = FALSE;
#ifdef PDF_ENABLE_XFA
m_bLogic = FALSE;
+ m_pOwnedStream = NULL;
+#endif // PDF_ENABLE_XFA
}
+
+#ifdef PDF_ENABLE_XFA
FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
if (pFont == NULL) {
return FALSE;
@@ -100,7 +101,7 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) {
m_bDwLoaded = pFont->m_bDwLoaded;
m_pOwnedStream = pFont->m_pOwnedStream;
return TRUE;
-#endif
+#endif // PDF_ENABLE_XFA
}
CFX_Font::~CFX_Font() {
delete m_pSubstFont;
@@ -113,13 +114,13 @@ CFX_Font::~CFX_Font() {
m_OtfFontData.DetachBuffer();
return;
}
-#endif
+#endif // PDF_ENABLE_XFA
if (m_Face) {
#ifndef PDF_ENABLE_XFA
if (FXFT_Get_Face_External_Stream(m_Face)) {
FXFT_Clear_Face_External_Stream(m_Face);
}
-#endif
+#endif // PDF_ENABLE_XFA
if (m_bEmbedded) {
DeleteFace();
} else {
@@ -129,7 +130,7 @@ CFX_Font::~CFX_Font() {
#ifdef PDF_ENABLE_XFA
FX_Free(m_pOwnedStream);
m_pOwnedStream = NULL;
-#endif
+#endif // PDF_ENABLE_XFA
FX_Free(m_pGsubData);
m_pGsubData = NULL;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -226,7 +227,7 @@ FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile,
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
return TRUE;
}
-#endif
+#endif // PDF_ENABLE_XFA
int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) {
if (!m_Face) {
@@ -482,8 +483,8 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) {
}
return charcode;
}
-#ifdef PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA
CFX_UnicodeEncodingEx::CFX_UnicodeEncodingEx(CFX_Font* pFont,
FX_DWORD EncodingID)
: CFX_UnicodeEncoding(pFont), m_nEncodingID(EncodingID) {
@@ -555,4 +556,4 @@ CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont,
}
return NULL;
}
-#endif
+#endif // PDF_ENABLE_XFA
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 6b0d7bf7e8..73f89c4c05 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -1087,7 +1087,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (flags & FXFONT_EXACTMATCH) {
return NULL;
}
-#endif
+#endif // PDF_ENABLE_XFA
if (bCJK) {
if (italic_angle != 0) {
bItalic = TRUE;
@@ -1296,7 +1296,8 @@ FX_BOOL CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const {
}
return FALSE;
}
-#endif
+#endif // PDF_ENABLE_XFA
+
extern "C" {
unsigned long _FTStreamRead(FXFT_Stream stream,
unsigned long offset,
@@ -1518,6 +1519,7 @@ void* CFX_FolderFontInfo::MapFont(int weight,
int& iExact) {
return NULL;
}
+
#ifdef PDF_ENABLE_XFA
void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode,
int weight,
@@ -1525,7 +1527,8 @@ void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode,
int pitch_family) {
return NULL;
}
-#endif
+#endif // PDF_ENABLE_XFA
+
void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) {
auto it = m_FontList.find(face);
return it != m_FontList.end() ? it->second : nullptr;