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_FONT_CPDF_TYPE3CHAR_H_ 8 #define CORE_FPDFAPI_FONT_CPDF_TYPE3CHAR_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_coordinates.h" 13 #include "core/fxcrt/fx_system.h" 14 #include "core/fxcrt/retain_ptr.h" 15 16 class CFX_DIBitmap; 17 class CPDF_Form; 18 class CPDF_RenderContext; 19 20 class CPDF_Type3Char { 21 public: 22 explicit CPDF_Type3Char(std::unique_ptr<CPDF_Form> pForm); 23 ~CPDF_Type3Char(); 24 25 static float TextUnitToGlyphUnit(float fTextUnit); 26 static void TextUnitRectToGlyphUnitRect(CFX_FloatRect* pRect); 27 28 bool LoadBitmap(CPDF_RenderContext* pContext); 29 30 void InitializeFromStreamData(bool bColored, const float* pData); 31 void Transform(const CFX_Matrix& matrix); 32 void ResetForm(); 33 34 RetainPtr<CFX_DIBitmap> GetBitmap(); 35 const RetainPtr<CFX_DIBitmap>& GetBitmap() const; 36 37 const CPDF_Form* form() const { return m_pForm.get(); } 38 CPDF_Form* form() { return m_pForm.get(); } 39 40 bool colored() const { return m_bColored; } 41 int width() const { return m_Width; } 42 const CFX_Matrix& matrix() const { return m_ImageMatrix; } 43 const FX_RECT& bbox() const { return m_BBox; } 44 45 private: 46 std::unique_ptr<CPDF_Form> m_pForm; 47 RetainPtr<CFX_DIBitmap> m_pBitmap; 48 bool m_bColored = false; 49 int m_Width = 0; 50 CFX_Matrix m_ImageMatrix; 51 FX_RECT m_BBox; 52 }; 53 54 #endif // CORE_FPDFAPI_FONT_CPDF_TYPE3CHAR_H_ 55