Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1978)

Unified Diff: core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp

Issue 2287313004: Make CPDF_TextState have a CPDF_TextStateData rather than inheriting one. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@moar_better_constness
Patch Set: Casts, Casts, New -> Emplace. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_textstate.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp
diff --git a/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp b/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp
index e60af0076efb414dcedfec66a8a4ab42b021abba..17c33a012c60c202b4c0898c6d3ce9afc6919b3d 100644
--- a/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_textstatedata.cpp
@@ -72,3 +72,29 @@ CPDF_TextStateData::~CPDF_TextStateData() {
pPageData->ReleaseFont(m_pFont->GetFontDict());
}
}
+
+void CPDF_TextStateData::SetFont(CPDF_Font* pFont) {
+ CPDF_Document* pDoc = m_pDocument;
+ CPDF_DocPageData* pPageData = pDoc ? pDoc->GetPageData() : nullptr;
+ if (pPageData && m_pFont && !pPageData->IsForceClear())
+ pPageData->ReleaseFont(m_pFont->GetFontDict());
+
+ m_pDocument = pFont ? pFont->m_pDocument : nullptr;
+ m_pFont = pFont;
+}
+
+FX_FLOAT CPDF_TextStateData::GetFontSizeV() const {
+ return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[1], m_Matrix[3]) * m_FontSize);
+}
+
+FX_FLOAT CPDF_TextStateData::GetFontSizeH() const {
+ return FXSYS_fabs(FXSYS_sqrt2(m_Matrix[0], m_Matrix[2]) * m_FontSize);
+}
+
+FX_FLOAT CPDF_TextStateData::GetBaselineAngle() const {
+ return FXSYS_atan2(m_Matrix[2], m_Matrix[0]);
+}
+
+FX_FLOAT CPDF_TextStateData::GetShearAngle() const {
+ return GetBaselineAngle() + FXSYS_atan2(m_Matrix[1], m_Matrix[3]);
+}
« no previous file with comments | « core/fpdfapi/fpdf_page/cpdf_textstate.cpp ('k') | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698