Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: xfa/fgas/font/fgas_gefont.h

Issue 2037563002: Replace IFGAS_Font with underlying concrete type (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Fix Windows Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fgas/font/fgas_gefont.h
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index 8667bf9b0a337765dcf501323356a677a7f29cb5..8ea578a0cd29a2c465af2a23d9b44cfcf23a195d 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -16,51 +16,82 @@
class CXFA_PDFFontMgr;
-class CFX_GEFont : public IFX_Font {
+class CFX_GEFont {
public:
- CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles);
- explicit CFX_GEFont(IFX_FontMgr* pFontMgr);
+ static CFX_GEFont* LoadFont(const FX_WCHAR* pszFontFamily,
+ uint32_t dwFontStyles,
+ uint16_t wCodePage,
+ IFX_FontMgr* pFontMgr);
+ static CFX_GEFont* LoadFont(CFX_Font* pExtFont,
+ IFX_FontMgr* pFontMgr,
+ FX_BOOL bTakeOver);
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+ static CFX_GEFont* LoadFont(const uint8_t* pBuffer,
+ int32_t iLength,
+ IFX_FontMgr* pFontMgr);
+ static CFX_GEFont* LoadFont(const FX_WCHAR* pszFileName);
+ static CFX_GEFont* LoadFont(IFX_Stream* pFontStream,
+ IFX_FontMgr* pFontMgr,
+ FX_BOOL bSaveStream);
+#endif
+
~CFX_GEFont();
- // IFX_Font:
- virtual void Release();
- virtual IFX_Font* Retain();
+ void Release();
+ CFX_GEFont* Retain();
+ CFX_GEFont* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0);
+ void GetFamilyName(CFX_WideString& wsFamily) const;
+ uint32_t GetFontStyles() const;
+ uint8_t GetCharSet() const;
+ FX_BOOL GetCharWidth(FX_WCHAR wUnicode,
+ int32_t& iWidth,
+ FX_BOOL bCharCode = FALSE);
+ int32_t GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode = FALSE);
+ int32_t GetAscent() const;
+ int32_t GetDescent() const;
+ FX_BOOL GetCharBBox(FX_WCHAR wUnicode,
+ CFX_Rect& bbox,
+ FX_BOOL bCharCode = FALSE);
+ FX_BOOL GetBBox(CFX_Rect& bbox);
+ int32_t GetItalicAngle() const;
+ void Reset();
+ CFX_GEFont* GetSubstFont(int32_t iGlyphIndex) const;
+ void* GetDevFont() const { return (void*)m_pFont; }
+ void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; }
+#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
+ void SetLogicalFontStyle(uint32_t dwLogFontStyle) {
+ m_bUseLogFontStyle = TRUE;
+ m_dwLogFontStyle = dwLogFontStyle;
+ }
+#endif
+
+ protected:
+ explicit CFX_GEFont(IFX_FontMgr* pFontMgr);
+ CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles);
+
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
FX_BOOL LoadFont(const FX_WCHAR* pszFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage);
FX_BOOL LoadFont(const uint8_t* pBuffer, int32_t length);
- FX_BOOL LoadFont(const FX_WCHAR* pszFileName);
+ FX_BOOL LoadFontInternal(const FX_WCHAR* pszFileName);
FX_BOOL LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream);
- FX_BOOL LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver = FALSE);
- virtual IFX_Font* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0);
- virtual void GetFamilyName(CFX_WideString& wsFamily) const;
- virtual uint32_t GetFontStyles() const;
- virtual uint8_t GetCharSet() const;
- virtual FX_BOOL GetCharWidth(FX_WCHAR wUnicode,
- int32_t& iWidth,
- FX_BOOL bCharCode = FALSE);
- virtual int32_t GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode = FALSE);
- virtual int32_t GetAscent() const;
- virtual int32_t GetDescent() const;
- virtual FX_BOOL GetCharBBox(FX_WCHAR wUnicode,
+#endif
+ FX_BOOL LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver);
+ FX_BOOL InitFont();
+ FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode,
CFX_Rect& bbox,
+ FX_BOOL bRecursive,
FX_BOOL bCharCode = FALSE);
- virtual FX_BOOL GetBBox(CFX_Rect& bbox);
- virtual int32_t GetItalicAngle() const;
- virtual void Reset();
- virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const;
- virtual void* GetDevFont() const { return (void*)m_pFont; }
- virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) {
- m_pProvider = pProvider;
- }
-#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
- virtual void SetLogicalFontStyle(uint32_t dwLogFontStyle) {
- m_bUseLogFontStyle = TRUE;
- m_dwLogFontStyle = dwLogFontStyle;
- }
-#endif
+ FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode,
+ int32_t& iWidth,
+ FX_BOOL bRecursive,
+ FX_BOOL bCharCode = FALSE);
+ int32_t GetGlyphIndex(FX_WCHAR wUnicode,
+ FX_BOOL bRecursive,
+ CFX_GEFont** ppFont,
+ FX_BOOL bCharCode = FALSE);
- protected:
#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
FX_BOOL m_bUseLogFontStyle;
uint32_t m_dwLogFontStyle;
@@ -77,21 +108,8 @@ class CFX_GEFont : public IFX_Font {
CFX_MapPtrToPtr* m_pBBoxMap;
CXFA_PDFFontMgr* m_pProvider;
uint16_t m_wCharSet;
- CFX_ArrayTemplate<IFX_Font*> m_SubstFonts;
- std::map<FX_WCHAR, IFX_Font*> m_FontMapper;
- FX_BOOL InitFont();
- FX_BOOL GetCharBBox(FX_WCHAR wUnicode,
- CFX_Rect& bbox,
- FX_BOOL bRecursive,
- FX_BOOL bCharCode = FALSE);
- FX_BOOL GetCharWidth(FX_WCHAR wUnicode,
- int32_t& iWidth,
- FX_BOOL bRecursive,
- FX_BOOL bCharCode = FALSE);
- int32_t GetGlyphIndex(FX_WCHAR wUnicode,
- FX_BOOL bRecursive,
- IFX_Font** ppFont,
- FX_BOOL bCharCode = FALSE);
+ CFX_ArrayTemplate<CFX_GEFont*> m_SubstFonts;
+ std::map<FX_WCHAR, CFX_GEFont*> m_FontMapper;
};
#endif // XFA_FGAS_FONT_FGAS_GEFONT_H_

Powered by Google App Engine
This is Rietveld 408576698