From 11b15571475414ef853e21a6c96afa2ac81f848f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 30 Oct 2024 09:51:26 +0200 Subject: convert KernArray from sal_Int32 to double which allows us to eliminate a bunch of rounding at various layers, and consequently maintain a lot more precision Change-Id: I911dedd7c041c1d67396c082e5695346ea689acb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175814 Tested-by: Jenkins Reviewed-by: Noel Grandin --- editeng/inc/EditLine.hxx | 10 ++++------ editeng/inc/TextPortion.hxx | 6 +++--- editeng/inc/outleeng.hxx | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'editeng/inc') diff --git a/editeng/inc/EditLine.hxx b/editeng/inc/EditLine.hxx index 46a2379853e6..38625bc246da 100644 --- a/editeng/inc/EditLine.hxx +++ b/editeng/inc/EditLine.hxx @@ -22,16 +22,14 @@ #include #include #include +#include class ParaPortion; class EditLine { -public: - typedef std::vector CharPosArrayType; - private: - CharPosArrayType maPositions; + KernArray maPositions; std::vector maKashidaPositions; sal_Int32 mnTextWidth = 0; sal_Int32 mnStartPosX = 0; @@ -111,8 +109,8 @@ public: bool IsEmpty() const { return mnEnd <= mnStart; } - CharPosArrayType& GetCharPosArray() { return maPositions; } - const CharPosArrayType& GetCharPosArray() const { return maPositions; } + KernArray& GetCharPosArray() { return maPositions; } + const KernArray& GetCharPosArray() const { return maPositions; } std::vector& GetKashidaArray() { return maKashidaPositions; } const std::vector& GetKashidaArray() const { return maKashidaPositions; } diff --git a/editeng/inc/TextPortion.hxx b/editeng/inc/TextPortion.hxx index e5560f260326..5458eaa9cf23 100644 --- a/editeng/inc/TextPortion.hxx +++ b/editeng/inc/TextPortion.hxx @@ -71,14 +71,14 @@ struct ExtraPortionInfo bool bFirstCharIsRightPunktuation = false; bool bCompressed = false; - std::unique_ptr pOrgDXArray; + std::unique_ptr pOrgDXArray; std::vector lineBreaksList; - void SaveOrgDXArray(const sal_Int32* pDXArray, sal_Int32 nLen) + void SaveOrgDXArray(const double* pDXArray, sal_Int32 nLen) { if (pDXArray) { - pOrgDXArray.reset(new sal_Int32[nLen]); + pOrgDXArray.reset(new double[nLen]); memcpy(pOrgDXArray.get(), pDXArray, nLen * sizeof(sal_Int32)); } else diff --git a/editeng/inc/outleeng.hxx b/editeng/inc/outleeng.hxx index c40837dc5f8f..56f7aa62485e 100644 --- a/editeng/inc/outleeng.hxx +++ b/editeng/inc/outleeng.hxx @@ -46,7 +46,7 @@ public: virtual void ParagraphConnected( sal_Int32 nLeftParagraph, sal_Int32 nRightParagraph ) override; virtual void DrawingText( const Point& rStartPos, const OUString& rText, sal_Int32 nTextStart, - sal_Int32 nTextLen, std::span pDXArray, + sal_Int32 nTextLen, KernArraySpan pDXArray, std::span pKashidaArray, const SvxFont& rFont, sal_Int32 nPara, sal_uInt8 nRightToLeft, const EEngineData::WrongSpellVector* pWrongSpellVector, -- cgit