• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_CTTFONTDESC_H_
8 #define CORE_FXGE_CTTFONTDESC_H_
9 
10 #include "core/fxcrt/fx_system.h"
11 #include "core/fxge/fx_font.h"
12 
13 class CTTFontDesc {
14  public:
15   enum ReleaseStatus {
16     kNotAppropriate,  // ReleaseFace() not appropriate for given object.
17     kReleased,
18     kNotReleased  // Object still alive.
19   };
20 
21   // Single face ctor.
22   CTTFontDesc(uint8_t* pData, FXFT_Face face);
23 
24   // TTC face ctor.
25   CTTFontDesc(uint8_t* pData, size_t index, FXFT_Face face);
26 
27   ~CTTFontDesc();
28 
29   void SetTTCFace(size_t index, FXFT_Face face);
30 
31   void AddRef();
32 
33   // May not decrement refcount, depending on the value of |face|.
34   ReleaseStatus ReleaseFace(FXFT_Face face);
35 
FontData()36   uint8_t* FontData() const { return m_pFontData; }
37 
38   FXFT_Face SingleFace() const;
39   FXFT_Face TTCFace(size_t index) const;
40 
41  private:
42   const bool m_bIsTTC;
43 
44   union {
45     const FXFT_Face m_SingleFace;
46     FXFT_Face m_TTCFaces[16];
47   };
48   uint8_t* const m_pFontData;
49   int m_RefCount = 1;
50 };
51 
52 #endif  // CORE_FXGE_CTTFONTDESC_H_
53