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