Home | History | Annotate | Download | only in fxge
      1 // Copyright 2016 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 CORE_FXGE_IFX_SYSTEMFONTINFO_H_
      8 #define CORE_FXGE_IFX_SYSTEMFONTINFO_H_
      9 
     10 #include <memory>
     11 
     12 #include "core/fxge/cfx_fontmapper.h"
     13 #include "core/fxge/fx_font.h"
     14 
     15 const uint32_t kTableNAME = FXDWORD_GET_MSBFIRST("name");
     16 const uint32_t kTableTTCF = FXDWORD_GET_MSBFIRST("ttcf");
     17 
     18 class IFX_SystemFontInfo {
     19  public:
     20   static std::unique_ptr<IFX_SystemFontInfo> CreateDefault(
     21       const char** pUserPaths);
     22 
     23   virtual ~IFX_SystemFontInfo() {}
     24 
     25   virtual bool EnumFontList(CFX_FontMapper* pMapper) = 0;
     26   virtual void* MapFont(int weight,
     27                         bool bItalic,
     28                         int charset,
     29                         int pitch_family,
     30                         const FX_CHAR* face,
     31                         int& iExact) = 0;
     32 
     33 #ifdef PDF_ENABLE_XFA
     34   virtual void* MapFontByUnicode(uint32_t dwUnicode,
     35                                  int weight,
     36                                  bool bItalic,
     37                                  int pitch_family);
     38 #endif  // PDF_ENABLE_XFA
     39 
     40   virtual void* GetFont(const FX_CHAR* face) = 0;
     41   virtual uint32_t GetFontData(void* hFont,
     42                                uint32_t table,
     43                                uint8_t* buffer,
     44                                uint32_t size) = 0;
     45   virtual bool GetFaceName(void* hFont, CFX_ByteString& name) = 0;
     46   virtual bool GetFontCharset(void* hFont, int& charset) = 0;
     47   virtual int GetFaceIndex(void* hFont);
     48   virtual void DeleteFont(void* hFont) = 0;
     49 };
     50 
     51 #endif  // CORE_FXGE_IFX_SYSTEMFONTINFO_H_
     52