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_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
8 #define CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
9 
10 #include <map>
11 #include <memory>
12 
13 #include "core/fxcrt/fx_string.h"
14 #include "core/fxcrt/fx_system.h"
15 #include "core/fxcrt/observed_ptr.h"
16 #include "core/fxcrt/retain_ptr.h"
17 
18 class CFX_GlyphBitmap;
19 class CFX_Matrix;
20 class CPDF_Type3Font;
21 class CPDF_Type3GlyphMap;
22 
23 class CPDF_Type3Cache final : public Retainable, public Observable {
24  public:
25   CONSTRUCT_VIA_MAKE_RETAIN;
26 
27   const CFX_GlyphBitmap* LoadGlyph(uint32_t charcode,
28                                    const CFX_Matrix* pMatrix);
29 
30  private:
31   explicit CPDF_Type3Cache(CPDF_Type3Font* pFont);
32   ~CPDF_Type3Cache() override;
33 
34   std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(CPDF_Type3GlyphMap* pSize,
35                                                uint32_t charcode,
36                                                const CFX_Matrix* pMatrix);
37 
38   RetainPtr<CPDF_Type3Font> const m_pFont;
39   std::map<ByteString, std::unique_ptr<CPDF_Type3GlyphMap>> m_SizeMap;
40 };
41 
42 #endif  // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
43