summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-23 12:37:42 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-23 12:37:42 -0700
commit1b04bcc6af13669920700322052fc4ab4fad47a2 (patch)
tree14a70efd6df9acf3e5e0a611415e95955f1b5d8f /core/include
parent2a4e4ce8efaf8b6466962eef292a9876c17976ad (diff)
downloadpdfium-1b04bcc6af13669920700322052fc4ab4fad47a2.tar.xz
XFA: Manually apply changes to fpdf_text.h and fx_font.h from master
Driven off of https://codereview.chromium.org/1398383002/ Then make the other files as similar as possible. Note that this required changes to xfa/ code, and required adding some Set() methods. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1411833003 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdftext/fpdf_text.h10
-rw-r--r--core/include/fxge/fx_font.h66
2 files changed, 34 insertions, 42 deletions
diff --git a/core/include/fpdftext/fpdf_text.h b/core/include/fpdftext/fpdf_text.h
index f27f1db7e6..006499218e 100644
--- a/core/include/fpdftext/fpdf_text.h
+++ b/core/include/fpdftext/fpdf_text.h
@@ -72,23 +72,24 @@ class CPDFText_ParseOptions {
FX_BOOL m_bNormalizeObjs;
FX_BOOL m_bOutputHyphen;
};
+
class IPDF_TextPage {
public:
- virtual ~IPDF_TextPage() {}
+ static IPDF_TextPage* CreateTextPage(const CPDF_Page* pPage, int flags = 0);
static IPDF_TextPage* CreateTextPage(const CPDF_Page* pPage,
CPDFText_ParseOptions ParserOptions);
- static IPDF_TextPage* CreateTextPage(const CPDF_Page* pPage, int flags = 0);
static IPDF_TextPage* CreateTextPage(const CPDF_PageObjects* pObjs,
int flags = 0);
static IPDF_TextPage* CreateReflowTextPage(IPDF_ReflowedPage* pRefPage);
+ virtual ~IPDF_TextPage() {}
+
virtual void NormalizeObjects(FX_BOOL bNormalize) = 0;
virtual FX_BOOL ParseTextPage() = 0;
- virtual FX_BOOL IsParsered() const = 0;
+ virtual bool IsParsed() const = 0;
- public:
virtual int CharIndexFromTextIndex(int TextIndex) const = 0;
virtual int TextIndexFromCharIndex(int CharIndex) const = 0;
@@ -139,6 +140,7 @@ class IPDF_TextPage {
virtual CFX_WideString GetPageText(int start = 0, int nCount = -1) const = 0;
};
+
#define FPDFTEXT_MATCHCASE 0x00000001
#define FPDFTEXT_MATCHWHOLEWORD 0x00000002
#define FPDFTEXT_CONSECUTIVE 0x00000004
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
index 37431203b3..29b3da764a 100644
--- a/core/include/fxge/fx_font.h
+++ b/core/include/fxge/fx_font.h
@@ -34,8 +34,8 @@ class IFX_SystemFontInfo;
#define FXFONT_ITALIC 0x40
#define FXFONT_BOLD 0x40000
#define FXFONT_USEEXTERNATTR 0x80000
-#define FXFONT_EXACTMATCH 0x80000000
#define FXFONT_CIDFONT 0x100000
+#define FXFONT_EXACTMATCH 0x80000000
#define FXFONT_ANSI_CHARSET 0
#define FXFONT_DEFAULT_CHARSET 1
#define FXFONT_SYMBOL_CHARSET 2
@@ -56,6 +56,7 @@ class IFX_SystemFontInfo;
#define FXFONT_FF_SCRIPT (4 << 4)
#define FXFONT_FW_NORMAL 400
#define FXFONT_FW_BOLD 700
+
class CFX_Font {
public:
CFX_Font();
@@ -77,51 +78,42 @@ class CFX_Font {
FX_BOOL LoadClone(const CFX_Font* pFont);
FXFT_Face GetFace() const { return m_Face; }
-
- const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
-
+ CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
+ void SetFace(FXFT_Face face) { m_Face = face; }
+ void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; }
CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0);
-
int GetGlyphWidth(FX_DWORD glyph_index);
-
int GetAscent() const;
-
int GetDescent() const;
-
FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox);
-
- FX_BOOL IsItalic();
-
- FX_BOOL IsBold();
-
- FX_BOOL IsFixedWidth();
-
+ FX_BOOL IsItalic() const;
+ FX_BOOL IsBold() const;
+ FX_BOOL IsFixedWidth() const;
FX_BOOL IsVertical() const { return m_bVertical; }
-
CFX_WideString GetPsName() const;
-
CFX_ByteString GetFamilyName() const;
-
CFX_ByteString GetFaceName() const;
-
- FX_BOOL IsTTFont();
-
+ FX_BOOL IsTTFont() const;
FX_BOOL GetBBox(FX_RECT& bbox);
+ int GetHeight() const;
+ int GetULPos() const;
+ int GetULthickness() const;
+ int GetMaxAdvanceWidth() const;
+ 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);
- int GetHeight();
-
- int GetULPos();
-
- int GetULthickness();
-
- int GetMaxAdvanceWidth();
+ private:
+ void ReleasePlatformResource();
+ void DeleteFace();
FXFT_Face m_Face;
-
CFX_SubstFont* m_pSubstFont;
- FX_BOOL IsEmbedded() { return m_bEmbedded; }
-
- void AdjustMMParams(int glyph_index, int width, int weight);
uint8_t* m_pFontDataAllocation;
uint8_t* m_pFontData;
uint8_t* m_pGsubData;
@@ -132,16 +124,14 @@ class CFX_Font {
void* m_pPlatformFontCollection;
void* m_pDwFont;
FX_BOOL m_bDwLoaded;
- void ReleasePlatformResource();
-
- void DeleteFace();
-
- protected:
FX_BOOL m_bEmbedded;
FX_BOOL m_bVertical;
+
+ protected:
FX_BOOL m_bLogic;
void* m_pOwnedStream;
};
+
#define ENCODING_INTERNAL 0
#define ENCODING_UNICODE 1
@@ -239,6 +229,7 @@ class CFX_FontMgr {
~CFX_FontMgr();
void InitFTLibrary();
+
FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
int weight,
FX_BOOL bItalic,
@@ -312,7 +303,6 @@ class CFX_FontMapper {
m_pFontEnumerator = pFontEnumerator;
}
IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; }
-
FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
FX_BOOL bTrueType,
FX_DWORD flags,