blob: 7911785ab13fb0931e4a44d16c7c5f8c2a1dd43b [file] [log] [blame]
npmeadff192016-09-01 13:21:37 -07001// 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
dsinclair69d9c682016-10-04 12:18:35 -07007#ifndef CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
8#define CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_
npmeadff192016-09-01 13:21:37 -07009
10#include <map>
Tom Sepez7b9d8232017-04-03 14:53:01 -070011#include <memory>
npmeadff192016-09-01 13:21:37 -070012
dsinclairbc5e6d22016-10-04 11:08:49 -070013#include "core/fpdfapi/font/cpdf_type3font.h"
dsinclaira52ab742016-09-29 13:59:29 -070014#include "core/fxcrt/fx_coordinates.h"
15#include "core/fxcrt/fx_string.h"
16#include "core/fxcrt/fx_system.h"
Dan Sinclair0b950422017-09-21 15:49:49 -040017#include "core/fxcrt/retain_ptr.h"
npmeadff192016-09-01 13:21:37 -070018
19class CPDF_Type3Glyphs;
20
Dan Sinclair0b950422017-09-21 15:49:49 -040021class CPDF_Type3Cache : public Retainable {
npmeadff192016-09-01 13:21:37 -070022 public:
Tom Sepez05e6a802017-04-03 14:51:26 -070023 template <typename T, typename... Args>
Dan Sinclair0b950422017-09-21 15:49:49 -040024 friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
npmeadff192016-09-01 13:21:37 -070025
26 CFX_GlyphBitmap* LoadGlyph(uint32_t charcode,
27 const CFX_Matrix* pMatrix,
Dan Sinclair05df0752017-03-14 14:43:42 -040028 float retinaScaleX,
29 float retinaScaleY);
npmeadff192016-09-01 13:21:37 -070030
31 private:
Tom Sepez05e6a802017-04-03 14:51:26 -070032 explicit CPDF_Type3Cache(CPDF_Type3Font* pFont);
33 ~CPDF_Type3Cache() override;
34
Tom Sepez0748d3c2017-04-21 13:10:34 -070035 std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(CPDF_Type3Glyphs* pSize,
36 uint32_t charcode,
37 const CFX_Matrix* pMatrix,
38 float retinaScaleX,
39 float retinaScaleY);
npmeadff192016-09-01 13:21:37 -070040
Dan Sinclairaee0db02017-09-21 16:53:58 -040041 UnownedPtr<CPDF_Type3Font> const m_pFont;
Ryan Harrison275e2602017-09-18 14:23:18 -040042 std::map<ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
npmeadff192016-09-01 13:21:37 -070043};
44
dsinclair69d9c682016-10-04 12:18:35 -070045#endif // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_