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 
     14 const uint32_t kTableNAME = FXDWORD_GET_MSBFIRST("name");
     15 const uint32_t kTableTTCF = FXDWORD_GET_MSBFIRST("ttcf");
     16 
     17 class IFX_SystemFontInfo {
     18  public:
     19   static std::unique_ptr<IFX_SystemFontInfo> CreateDefault(
     20       const char** pUserPaths);
     21 
     22   virtual ~IFX_SystemFontInfo() = default;
     23 
     24   virtual bool EnumFontList(CFX_FontMapper* pMapper) = 0;
     25   virtual void* MapFont(int weight,
     26                         bool bItalic,
     27                         int charset,
     28                         int pitch_family,
     29                         const char* face) = 0;
     30 
     31 #ifdef PDF_ENABLE_XFA
     32   virtual void* MapFontByUnicode(uint32_t dwUnicode,
     33                                  int weight,
     34                                  bool bItalic,
     35                                  int pitch_family);
     36 #endif  // PDF_ENABLE_XFA
     37 
     38   virtual void* GetFont(const char* face) = 0;
     39   virtual uint32_t GetFontData(void* hFont,
     40                                uint32_t table,
     41                                uint8_t* buffer,
     42                                uint32_t size) = 0;
     43   virtual bool GetFaceName(void* hFont, ByteString* name) = 0;
     44   virtual bool GetFontCharset(void* hFont, int* charset) = 0;
     45   virtual int GetFaceIndex(void* hFont);
     46   virtual void DeleteFont(void* hFont) = 0;
     47 };
     48 
     49 #endif  // CORE_FXGE_IFX_SYSTEMFONTINFO_H_
     50