1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef FPDFSDK_FORMFILLER_CBA_FONTMAP_H_ 8 #define FPDFSDK_FORMFILLER_CBA_FONTMAP_H_ 9 10 #include "core/fxcrt/unowned_ptr.h" 11 #include "fpdfsdk/pwl/cpwl_font_map.h" 12 13 class CPDF_Dictionary; 14 class CPDFSDK_Annot; 15 16 class CBA_FontMap : public CPWL_FontMap { 17 public: 18 CBA_FontMap(CPDFSDK_Annot* pAnnot, CFX_SystemHandler* pSystemHandler); 19 ~CBA_FontMap() override; 20 21 void Reset(); 22 void SetDefaultFont(CPDF_Font* pFont, const ByteString& sFontName); 23 void SetAPType(const ByteString& sAPType); 24 25 private: 26 // CPWL_FontMap: 27 void Initialize() override; 28 CPDF_Document* GetDocument() override; 29 CPDF_Font* FindFontSameCharset(ByteString* sFontAlias, 30 int32_t nCharset) override; 31 void AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) override; 32 33 CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict, 34 ByteString* sFontAlias, 35 int32_t nCharset); 36 CPDF_Font* GetAnnotDefaultFont(ByteString* csNameTag); 37 void AddFontToAnnotDict(CPDF_Font* pFont, const ByteString& sAlias); 38 39 UnownedPtr<CPDF_Document> m_pDocument; 40 UnownedPtr<CPDF_Dictionary> m_pAnnotDict; 41 UnownedPtr<CPDF_Font> m_pDefaultFont; 42 ByteString m_sDefaultFontName; 43 ByteString m_sAPType; 44 }; 45 46 #endif // FPDFSDK_FORMFILLER_CBA_FONTMAP_H_ 47