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 template <typename T, typename... Args> 26 friend RetainPtr<T> pdfium::MakeRetain(Args&&... args); 27 28 const CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, 29 const CFX_Matrix* pMatrix); 30 31 private: 32 explicit CPDF_Type3Cache(CPDF_Type3Font* pFont); 33 ~CPDF_Type3Cache() override; 34 35 std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(CPDF_Type3GlyphMap* pSize, 36 uint32_t charcode, 37 const CFX_Matrix* pMatrix); 38 39 RetainPtr<CPDF_Type3Font> const m_pFont; 40 std::map<ByteString, std::unique_ptr<CPDF_Type3GlyphMap>> m_SizeMap; 41 }; 42 43 #endif // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_ 44