OLD | NEW |
(Empty) | |
| 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_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATE_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATE_H_ |
| 9 |
| 10 #include "core/fxcrt/include/cfx_count_ref.h" |
| 11 #include "core/fxcrt/include/fx_basic.h" |
| 12 |
| 13 class CPDF_Document; |
| 14 class CPDF_Font; |
| 15 |
| 16 // See PDF Reference 1.7, page 402, table 5.3. |
| 17 enum class TextRenderingMode { |
| 18 MODE_FILL = 0, |
| 19 MODE_STROKE = 1, |
| 20 MODE_FILL_STROKE = 2, |
| 21 MODE_INVISIBLE = 3, |
| 22 MODE_FILL_CLIP = 4, |
| 23 MODE_STROKE_CLIP = 5, |
| 24 MODE_FILL_STROKE_CLIP = 6, |
| 25 MODE_CLIP = 7, |
| 26 }; |
| 27 |
| 28 class CPDF_TextState { |
| 29 public: |
| 30 CPDF_TextState(); |
| 31 ~CPDF_TextState(); |
| 32 |
| 33 void Emplace(); |
| 34 |
| 35 CPDF_Font* GetFont() const; |
| 36 void SetFont(CPDF_Font* pFont); |
| 37 |
| 38 FX_FLOAT GetFontSize() const; |
| 39 void SetFontSize(FX_FLOAT size); |
| 40 |
| 41 const FX_FLOAT* GetMatrix() const; |
| 42 FX_FLOAT* GetMutableMatrix(); |
| 43 |
| 44 FX_FLOAT GetCharSpace() const; |
| 45 void SetCharSpace(FX_FLOAT sp); |
| 46 |
| 47 FX_FLOAT GetWordSpace() const; |
| 48 void SetWordSpace(FX_FLOAT sp); |
| 49 |
| 50 FX_FLOAT GetFontSizeV() const; |
| 51 FX_FLOAT GetFontSizeH() const; |
| 52 FX_FLOAT GetBaselineAngle() const; |
| 53 FX_FLOAT GetShearAngle() const; |
| 54 |
| 55 TextRenderingMode GetTextMode() const; |
| 56 void SetTextMode(TextRenderingMode mode); |
| 57 |
| 58 const FX_FLOAT* GetCTM() const; |
| 59 FX_FLOAT* GetMutableCTM(); |
| 60 |
| 61 private: |
| 62 class TextData { |
| 63 public: |
| 64 TextData(); |
| 65 TextData(const TextData& src); |
| 66 ~TextData(); |
| 67 |
| 68 void SetFont(CPDF_Font* pFont); |
| 69 FX_FLOAT GetFontSizeV() const; |
| 70 FX_FLOAT GetFontSizeH() const; |
| 71 FX_FLOAT GetBaselineAngle() const; |
| 72 FX_FLOAT GetShearAngle() const; |
| 73 |
| 74 CPDF_Font* m_pFont; |
| 75 CPDF_Document* m_pDocument; |
| 76 FX_FLOAT m_FontSize; |
| 77 FX_FLOAT m_CharSpace; |
| 78 FX_FLOAT m_WordSpace; |
| 79 TextRenderingMode m_TextMode; |
| 80 FX_FLOAT m_Matrix[4]; |
| 81 FX_FLOAT m_CTM[4]; |
| 82 }; |
| 83 |
| 84 CFX_CountRef<TextData> m_Ref; |
| 85 }; |
| 86 |
| 87 bool SetTextRenderingModeFromInt(int iMode, TextRenderingMode* mode); |
| 88 bool TextRenderingModeIsClipMode(const TextRenderingMode& mode); |
| 89 bool TextRenderingModeIsStrokeMode(const TextRenderingMode& mode); |
| 90 |
| 91 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATE_H_ |
OLD | NEW |