| Index: core/include/fxge/fx_font.h
|
| diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
|
| index 0ab529ef4e1814b7710c2ff24216cc788168e798..fe40e1b648e0cf551f9e19cca352641d181e179a 100644
|
| --- a/core/include/fxge/fx_font.h
|
| +++ b/core/include/fxge/fx_font.h
|
| @@ -35,6 +35,9 @@ class IFX_SystemFontInfo;
|
| #define FXFONT_BOLD 0x40000
|
| #define FXFONT_USEEXTERNATTR 0x80000
|
| #define FXFONT_CIDFONT 0x100000
|
| +#ifdef PDF_ENABLE_XFA
|
| +#define FXFONT_EXACTMATCH 0x80000000
|
| +#endif
|
| #define FXFONT_ANSI_CHARSET 0
|
| #define FXFONT_DEFAULT_CHARSET 1
|
| #define FXFONT_SYMBOL_CHARSET 2
|
| @@ -69,8 +72,23 @@ class CFX_Font {
|
| int CharsetCP,
|
| FX_BOOL bVertical = FALSE);
|
| FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size);
|
| +#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
|
| CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0);
|
| int GetGlyphWidth(FX_DWORD glyph_index);
|
| int GetAscent() const;
|
| @@ -116,23 +134,81 @@ class CFX_Font {
|
| FX_BOOL m_bDwLoaded;
|
| FX_BOOL m_bEmbedded;
|
| FX_BOOL m_bVertical;
|
| +#ifdef PDF_ENABLE_XFA
|
| +
|
| + protected:
|
| + FX_BOOL m_bLogic;
|
| + void* m_pOwnedStream;
|
| +#endif
|
| };
|
|
|
| #define ENCODING_INTERNAL 0
|
| #define ENCODING_UNICODE 1
|
|
|
| +#ifdef PDF_ENABLE_XFA
|
| +#define FXFM_ENC_TAG(a, b, c, d) \
|
| + (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \
|
| + (FX_DWORD)(d))
|
| +#define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0)
|
| +#define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b')
|
| +#define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c')
|
| +#define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's')
|
| +#define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ')
|
| +#define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5')
|
| +#define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's')
|
| +#define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a')
|
| +#define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B')
|
| +#define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E')
|
| +#define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C')
|
| +#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
|
| class CFX_UnicodeEncoding {
|
| public:
|
| explicit CFX_UnicodeEncoding(CFX_Font* pFont);
|
| +#ifndef PDF_ENABLE_XFA
|
| ~CFX_UnicodeEncoding();
|
| +#else
|
| + virtual ~CFX_UnicodeEncoding();
|
| +#endif
|
|
|
| +#ifndef PDF_ENABLE_XFA
|
| FX_DWORD GlyphFromCharCode(FX_DWORD charcode);
|
| +#else
|
| + virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode);
|
| +#endif
|
|
|
| +#ifndef PDF_ENABLE_XFA
|
| private:
|
| +#else
|
| + protected:
|
| +#endif
|
| // Unowned, not nullptr.
|
| CFX_Font* m_pFont;
|
| };
|
|
|
| +#ifdef PDF_ENABLE_XFA
|
| +class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding {
|
| + public:
|
| + CFX_UnicodeEncodingEx(CFX_Font* pFont, FX_DWORD EncodingID);
|
| + ~CFX_UnicodeEncodingEx() override;
|
| +
|
| + // CFX_UnicodeEncoding:
|
| + FX_DWORD GlyphFromCharCode(FX_DWORD charcode) override;
|
| +
|
| + FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const;
|
| +
|
| + private:
|
| + FX_DWORD m_nEncodingID;
|
| +};
|
| +
|
| +CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(
|
| + CFX_Font* pFont,
|
| + FX_DWORD nEncodingID = FXFM_ENCODING_NONE);
|
| +
|
| +#endif
|
| #define FXFONT_SUBST_MM 0x01
|
| #define FXFONT_SUBST_GLYPHPATH 0x04
|
| #define FXFONT_SUBST_CLEARTYPE 0x08
|
| @@ -178,6 +254,10 @@ class CFX_FontMgr {
|
| CFX_FontMgr();
|
| ~CFX_FontMgr();
|
|
|
| +#ifdef PDF_ENABLE_XFA
|
| + void InitFTLibrary();
|
| +
|
| +#endif
|
| FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
|
| int weight,
|
| FX_BOOL bItalic,
|
| @@ -213,8 +293,10 @@ class CFX_FontMgr {
|
| FXFT_Library GetFTLibrary() const { return m_FTLibrary; }
|
|
|
| private:
|
| +#ifndef PDF_ENABLE_XFA
|
| void InitFTLibrary();
|
|
|
| +#endif
|
| nonstd::unique_ptr<CFX_FontMapper> m_pBuiltinMapper;
|
| std::map<CFX_ByteString, CTTFontDesc*> m_FaceMap;
|
| FXFT_Library m_FTLibrary;
|
| @@ -260,6 +342,13 @@ class CFX_FontMapper {
|
| int italic_angle,
|
| int CharsetCP,
|
| CFX_SubstFont* pSubstFont);
|
| +#ifdef PDF_ENABLE_XFA
|
| + FXFT_Face FindSubstFontByUnicode(FX_DWORD dwUnicode,
|
| + FX_DWORD flags,
|
| + int weight,
|
| + int italic_angle);
|
| + FX_BOOL IsBuiltinFace(const FXFT_Face face) const;
|
| +#endif
|
|
|
| private:
|
| static const size_t MM_FACE_COUNT = 2;
|
| @@ -296,6 +385,14 @@ class IFX_SystemFontInfo {
|
| int pitch_family,
|
| const FX_CHAR* face,
|
| int& iExact) = 0;
|
| +#ifdef PDF_ENABLE_XFA
|
| + virtual void* MapFontByUnicode(FX_DWORD dwUnicode,
|
| + int weight,
|
| + FX_BOOL bItalic,
|
| + int pitch_family) {
|
| + return NULL;
|
| + }
|
| +#endif
|
| virtual void* GetFont(const FX_CHAR* face) = 0;
|
| virtual FX_DWORD GetFontData(void* hFont,
|
| FX_DWORD table,
|
| @@ -315,6 +412,9 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
|
| public:
|
| CFX_FolderFontInfo();
|
| ~CFX_FolderFontInfo() override;
|
| +#ifdef PDF_ENABLE_XFA
|
| +
|
| +#endif
|
| void AddPath(const CFX_ByteStringC& path);
|
|
|
| // IFX_SytemFontInfo:
|
| @@ -326,6 +426,12 @@ class CFX_FolderFontInfo : public IFX_SystemFontInfo {
|
| int pitch_family,
|
| const FX_CHAR* face,
|
| int& bExact) override;
|
| +#ifdef PDF_ENABLE_XFA
|
| + void* MapFontByUnicode(FX_DWORD dwUnicode,
|
| + int weight,
|
| + FX_BOOL bItalic,
|
| + int pitch_family) override;
|
| +#endif
|
| void* GetFont(const FX_CHAR* face) override;
|
| FX_DWORD GetFontData(void* hFont,
|
| FX_DWORD table,
|
|
|