diff options
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r-- | core/fpdfapi/font/cpdf_font.cpp | 7 | ||||
-rw-r--r-- | core/fpdfapi/font/cpdf_font.h | 10 |
2 files changed, 14 insertions, 3 deletions
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 53186daec6..193ee4a331 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -290,6 +290,7 @@ int CPDF_Font::GetStringWidth(const char* pString, int size) { return width; } +// static CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, const CFX_ByteStringC& name) { CFX_ByteString fontname(name); @@ -469,3 +470,9 @@ int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode) { return glyph; } + +CFX_Font* CPDF_Font::GetFontFallback(int position) { + if (position < 0 || static_cast<size_t>(position) >= m_FontFallbacks.size()) + return nullptr; + return m_FontFallbacks[position].get(); +} diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h index de29db6e13..be1d91319e 100644 --- a/core/fpdfapi/font/cpdf_font.h +++ b/core/fpdfapi/font/cpdf_font.h @@ -78,9 +78,10 @@ class CPDF_Font { virtual int GetCharWidthF(uint32_t charcode) = 0; virtual FX_RECT GetCharBBox(uint32_t charcode) = 0; - CPDF_Document* m_pDocument; - CFX_Font m_Font; - std::vector<std::unique_ptr<CFX_Font>> m_FontFallbacks; + CPDF_Document* GetDocument() { return m_pDocument; } + CFX_Font* GetFont() { return &m_Font; } + const CFX_Font* GetFont() const { return &m_Font; } + CFX_Font* GetFontFallback(int position); protected: CPDF_Font(); @@ -100,6 +101,9 @@ class CPDF_Font { const std::vector<CFX_ByteString>& charnames, int charcode); + CPDF_Document* m_pDocument; + CFX_Font m_Font; + std::vector<std::unique_ptr<CFX_Font>> m_FontFallbacks; CFX_ByteString m_BaseFont; CFX_RetainPtr<CPDF_StreamAcc> m_pFontFile; CPDF_Dictionary* m_pFontDict; |