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()->m_pFont;
33 m_Ref.GetPrivateCopy()->SetFont(std::move(pFont));
37 return m_Ref.GetObject()->m_FontSize;
41 if (!m_Ref || GetFontSize() != size) {
42 m_Ref.GetPrivateCopy()->m_FontSize = size;
47 return m_Ref.GetObject()->m_Matrix;
51 return m_Ref.GetPrivateCopy()->m_Matrix;
55 return m_Ref.GetObject()->m_CharSpace;
59 if (!m_Ref || GetCharSpace() != sp) {
60 m_Ref.GetPrivateCopy()->m_CharSpace = sp;
65 return m_Ref.GetObject()->m_WordSpace;
69 if (!m_Ref || GetWordSpace() != sp) {
70 m_Ref.GetPrivateCopy()->m_WordSpace = sp;
75 return m_Ref.GetObject()->GetFontSizeH();
79 return m_Ref.GetObject()->m_TextMode;
83 if (!m_Ref || GetTextMode() != mode) {
84 m_Ref.GetPrivateCopy()->m_TextMode = mode;
89 return m_Ref.GetObject()->m_CTM;
93 return m_Ref.GetPrivateCopy()->m_CTM;
99 : m_pFont(that.m_pFont),
100 m_pDocument(that.m_pDocument),
101 m_FontSize(that.m_FontSize),
102 m_CharSpace(that.m_CharSpace),
103 m_WordSpace(that.m_WordSpace),
104 m_TextMode(that.m_TextMode) {
105 for (
int i = 0; i < 4; ++i)
106 m_Matrix[i] = that.m_Matrix[i];
108 for (
int i = 0; i < 4; ++i)
109 m_CTM[i] = that.m_CTM[i];
111 if (m_pDocument && m_pFont) {
112 auto* pPageData = CPDF_DocPageData::FromDocument(m_pDocument);
113 m_pFont = pPageData->GetFont(m_pFont->GetMutableFontDict());
124 m_pDocument = pFont ? pFont->GetDocument() :
nullptr;
125 m_pFont = std::move(pFont);
133 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)
float FXSYS_sqrt2(float a, float b)