Home | History | Annotate | Download | only in formfiller
      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_INCLUDE_FORMFILLER_FFL_CBA_FONTMAP_H_
      8 #define FPDFSDK_INCLUDE_FORMFILLER_FFL_CBA_FONTMAP_H_
      9 
     10 #include "../pdfwindow/PWL_FontMap.h"
     11 
     12 class CPDF_Dictionary;
     13 class CPDFSDK_Annot;
     14 
     15 class CBA_FontMap : public CPWL_FontMap
     16 {
     17 public:
     18 	CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);
     19 	CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler);
     20 
     21 	virtual ~CBA_FontMap();
     22 
     23 	virtual void				Initial(FX_LPCSTR fontname = NULL);
     24 
     25 public:
     26 	void						SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFontName);
     27 
     28 	void						Reset();
     29 	void						SetAPType(const CFX_ByteString& sAPType);
     30 
     31 protected:
     32 	virtual CPDF_Font*			FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);
     33 	virtual void				AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
     34 	virtual CPDF_Document*		GetDocument();
     35 private:
     36 	CPDF_Font*					FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias,
     37 									FX_INT32 nCharset);
     38 	CPDF_Font*					GetAnnotDefaultFont(CFX_ByteString &csNameTag);
     39 	void						AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
     40 
     41 private:
     42 	CPDF_Document*				m_pDocument;
     43 	CPDF_Dictionary*			m_pAnnotDict;
     44 	CPDF_Font*					m_pDefaultFont;
     45 	CFX_ByteString				m_sDefaultFontName;
     46 
     47 	CFX_ByteString				m_sAPType;
     48 };
     49 
     50 #endif  // FPDFSDK_INCLUDE_FORMFILLER_FFL_CBA_FONTMAP_H_
     51