From 58e4c5ac24a88f83d1ba8277dee87baf4cba36a0 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Mon, 13 Feb 2017 16:08:51 -0500 Subject: Clean up CPDF_TextObject a bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modernizing CPDF_TextObject a little bit, in preparation for the addition of APIs for adding text to PDFs. m_pCharCodes, m_pCharPos are now vectors, this caused some propagation to other classes. Also m_Pos is now a point. Note that GetItemInfo is being changed in another CL, so did minimal changes there. Change-Id: I6e5f19b5d45872e3e714a7cb587c81c92e640ea3 Reviewed-on: https://pdfium-review.googlesource.com/2614 Commit-Queue: Nicolás Peña Reviewed-by: Tom Sepez --- core/fpdfapi/page/cpdf_textobject.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'core/fpdfapi/page/cpdf_textobject.h') diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h index 7445f0d110..9e763a164e 100644 --- a/core/fpdfapi/page/cpdf_textobject.h +++ b/core/fpdfapi/page/cpdf_textobject.h @@ -8,6 +8,7 @@ #define CORE_FPDFAPI_PAGE_CPDF_TEXTOBJECT_H_ #include +#include #include "core/fpdfapi/page/cpdf_pageobject.h" #include "core/fxcrt/fx_string.h" @@ -38,7 +39,7 @@ class CPDF_TextObject : public CPDF_PageObject { int CountItems() const; void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const; int CountChars() const; - void GetCharInfo(int index, uint32_t& charcode, FX_FLOAT& kerning) const; + void GetCharInfo(int index, uint32_t* charcode, FX_FLOAT* kerning) const; void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const; FX_FLOAT GetCharWidth(uint32_t charcode) const; @@ -53,22 +54,22 @@ class CPDF_TextObject : public CPDF_PageObject { void RecalcPositionData(); - protected: + private: friend class CPDF_RenderStatus; friend class CPDF_StreamContentParser; friend class CPDF_TextRenderer; - void SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKerning, int nSegs); + void SetSegments(const CFX_ByteString* pStrs, + const FX_FLOAT* pKerning, + int nSegs); void CalcPositionData(FX_FLOAT* pTextAdvanceX, FX_FLOAT* pTextAdvanceY, FX_FLOAT horz_scale); - FX_FLOAT m_PosX; - FX_FLOAT m_PosY; - int m_nChars; - uint32_t* m_pCharCodes; - FX_FLOAT* m_pCharPos; + CFX_PointF m_Pos; + std::vector m_CharCodes; + std::vector m_CharPos; }; #endif // CORE_FPDFAPI_PAGE_CPDF_TEXTOBJECT_H_ -- cgit v1.2.3