7#include "core/fpdfapi/page/cpdf_textstate.h"
13#include "core/fpdfapi/font/cpdf_font.h"
14#include "core/fpdfapi/page/cpdf_docpagedata.h"
29 return m_Ref.GetObject()->font_;
33 m_Ref.GetPrivateCopy()->SetFont(std::move(pFont));
37 return m_Ref.GetObject()->font_size_;
41 if (!m_Ref || GetFontSize() != size) {
42 m_Ref.GetPrivateCopy()->font_size_ = size;
47 return m_Ref.GetObject()->matrix_;
51 return m_Ref.GetPrivateCopy()->matrix_;
55 return m_Ref.GetObject()->char_space_;
59 if (!m_Ref || GetCharSpace() != sp) {
60 m_Ref.GetPrivateCopy()->char_space_ = sp;
65 return m_Ref.GetObject()->word_space_;
69 if (!m_Ref || GetWordSpace() != sp) {
70 m_Ref.GetPrivateCopy()->word_space_ = sp;
75 return m_Ref.GetObject()->GetFontSizeH();
79 return m_Ref.GetObject()->text_rendering_mode_;
83 if (!m_Ref || GetTextMode() != mode) {
84 m_Ref.GetPrivateCopy()->text_rendering_mode_ = mode;
89 return m_Ref.GetObject()->ctm_;
93 return m_Ref.GetPrivateCopy()->ctm_;
100 document_(that.document_),
101 font_size_(that.font_size_),
102 char_space_(that.char_space_),
103 word_space_(that.word_space_),
104 text_rendering_mode_(that.text_rendering_mode_),
105 matrix_(that.matrix_),
107 if (document_ && font_) {
108 auto* page_data = CPDF_DocPageData::FromDocument(document_);
109 font_ = page_data->GetFont(font_->GetMutableFontDict());
120 document_ = pFont ? pFont->GetDocument() :
nullptr;
121 font_ = std::move(pFont);
125 return fabs(hypotf(matrix_[0], matrix_[2]) * font_size_);
129 if (iMode < 0 || iMode > 7)
pdfium::span< float > GetMutableMatrix()
TextRenderingMode GetTextMode() const
CPDF_TextState(const CPDF_TextState &that)
RetainPtr< CPDF_Font > GetFont() const
float GetWordSpace() const
float GetFontSize() const
float GetCharSpace() const
void SetTextMode(TextRenderingMode mode)
void SetWordSpace(float sp)
void SetFont(RetainPtr< CPDF_Font > pFont)
float GetFontSizeH() const
void SetFontSize(float size)
void SetCharSpace(float sp)
pdfium::span< float > GetMutableCTM()
CPDF_TextState & operator=(const CPDF_TextState &that)
pdfium::span< const float > GetMatrix() const
pdfium::span< const float > GetCTM() const
bool TextRenderingModeIsStrokeMode(const TextRenderingMode &mode)
bool SetTextRenderingModeFromInt(int iMode, TextRenderingMode *mode)
bool TextRenderingModeIsClipMode(const TextRenderingMode &mode)