vcl/source/gdi/CommonSalLayout.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit 062da9b0d5a44f47fb3fb3e15c7c2a3e9b6a70b8 Author: Khaled Hosny <kha...@aliftype.com> AuthorDate: Fri Dec 30 17:36:27 2022 +0200 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Fri Dec 30 19:10:28 2022 +0000 tdf#152734: Calculate correctly the kashida glyph X position Change-Id: I4c76aed58acd0598b9d09d147ed86e76ef468c4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144878 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@aliftype.com> (cherry picked from commit a838f92bb4b1bdc84f49c61f669b1f32ee1f83c3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144897 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 5cde002661d3..92b090222481 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -727,7 +727,7 @@ void GenericSalLayout::ApplyDXArray(const double* pDXArray, const sal_Bool* pKas // Map of Kashida insertion points (in the glyph items vector) and the // requested width. - std::map<size_t, DeviceCoordinate> pKashidas; + std::map<size_t, std::pair<DeviceCoordinate, DeviceCoordinate>> pKashidas; // The accumulated difference in X position. double nDelta = 0; @@ -791,7 +791,7 @@ void GenericSalLayout::ApplyDXArray(const double* pDXArray, const sal_Bool* pKas // This is a Kashida insertion position, mark it. Kashida glyphs // will be inserted below. if (pKashidaArray && pKashidaArray[nCharPos]) - pKashidas[i] = nDiff; + pKashidas[i] = { nDiff, pNewCharWidths[nCharPos] }; i++; } @@ -823,7 +823,7 @@ void GenericSalLayout::ApplyDXArray(const double* pDXArray, const sal_Bool* pKas auto pGlyphIter = m_GlyphItems.begin() + nInserted + pKashida.first; // The total Kashida width. - double nTotalWidth = pKashida.second; + auto const& [nTotalWidth, nClusterWidth] = pKashida.second; // Number of times to repeat each Kashida. int nCopies = 1; @@ -842,9 +842,12 @@ void GenericSalLayout::ApplyDXArray(const double* pDXArray, const sal_Bool* pKas nOverlap = nExcess / (nCopies - 1); } - DevicePoint aPos(pGlyphIter->linearPos().getX() - nTotalWidth, 0); + DevicePoint aPos = pGlyphIter->linearPos(); int nCharPos = pGlyphIter->charPos(); GlyphItemFlags const nFlags = GlyphItemFlags::IS_IN_CLUSTER | GlyphItemFlags::IS_RTL_GLYPH; + // Move to the left side of the adjusted width and start inserting + // glyphs there. + aPos.adjustX(-nClusterWidth + pGlyphIter->origWidth()); while (nCopies--) { GlyphItem aKashida(nCharPos, 0, nKashidaIndex, aPos, nFlags, nKashidaWidth, 0, 0);