1 // Copyright 2016 The PDFium Authors 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 <stdint.h> 11 12 #include <map> 13 #include <memory> 14 #include <tuple> 15 16 #include "core/fxcrt/bytestring.h" 17 #include "core/fxcrt/observed_ptr.h" 18 #include "core/fxcrt/retain_ptr.h" 19 20 class CFX_GlyphBitmap; 21 class CFX_Matrix; 22 class CPDF_Type3Font; 23 class CPDF_Type3GlyphMap; 24 25 class CPDF_Type3Cache final : public Retainable, public Observable { 26 public: 27 CONSTRUCT_VIA_MAKE_RETAIN; 28 29 const CFX_GlyphBitmap* LoadGlyph(uint32_t charcode, 30 const CFX_Matrix& mtMatrix); 31 32 private: 33 using SizeKey = std::tuple<int, int, int, int>; 34 35 explicit CPDF_Type3Cache(CPDF_Type3Font* pFont); 36 ~CPDF_Type3Cache() override; 37 38 std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(CPDF_Type3GlyphMap* pSize, 39 uint32_t charcode, 40 const CFX_Matrix& mtMatrix); 41 42 RetainPtr<CPDF_Type3Font> const m_pFont; 43 std::map<SizeKey, std::unique_ptr<CPDF_Type3GlyphMap>> m_SizeMap; 44 }; 45 46 #endif // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_ 47