summaryrefslogtreecommitdiff
path: root/canvas/source/opengl
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-06-18 17:35:32 +0300
committerخالد حسني <khaled@libreoffice.org>2023-06-18 22:01:53 +0200
commit68a4f005bc3e74d847e82dddf3237137cf3a1648 (patch)
tree3712971edf90e5fb753369a6874093a9e90c73d7 /canvas/source/opengl
parent94bf26798bb973c7df26e2aa841099bb9cbaf3cb (diff)
tdf#155810: Pass Kashida insertion positions through canvas
This was missed in: commit 3901e029bd39575f700e69a73818565d62226a23 Author: Khaled Hosny <khaled@aliftype.com> Date: Mon Aug 8 22:08:37 2022 +0200 tdf#104921: Cleanup Kashida insertion logic The width adjustment passed through, but Kashida insertion positions didn’t, leaving gaps in place of Kashidas when canvas is used (apparently canvas is only used for slideshow). Change-Id: I25ff30f10cc46a5c87bda2f3936df26b2fc926b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153234 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
Diffstat (limited to 'canvas/source/opengl')
-rw-r--r--canvas/source/opengl/ogl_canvashelper.cxx6
-rw-r--r--canvas/source/opengl/ogl_textlayout.cxx20
-rw-r--r--canvas/source/opengl/ogl_textlayout.hxx3
3 files changed, 28 insertions, 1 deletions
diff --git a/canvas/source/opengl/ogl_canvashelper.cxx b/canvas/source/opengl/ogl_canvashelper.cxx
index 1b84879b005c..606764a361b1 100644
--- a/canvas/source/opengl/ogl_canvashelper.cxx
+++ b/canvas/source/opengl/ogl_canvashelper.cxx
@@ -735,6 +735,9 @@ namespace oglcanvas
for( sal_Int32 i=0; i<nLen; ++i )
aDXArray.set(i, basegfx::fround(aLogicalAdvancements[i]));
+ uno::Sequence<sal_Bool> aKashidaPositions=xLayoutetText->queryKashidaPositions();
+ o3tl::span<const sal_Bool> aKashidaArray(aKashidaPositions.getConstArray(), aKashidaPositions.getLength());
+
// get the glyphs
pVDev->GetTextOutlines(rAct.maPolyPolys,
rTxt.Text,
@@ -742,7 +745,8 @@ namespace oglcanvas
rTxt.StartPosition,
rTxt.Length,
0,
- aDXArray);
+ aDXArray,
+ aKashidaArray);
}
else
{
diff --git a/canvas/source/opengl/ogl_textlayout.cxx b/canvas/source/opengl/ogl_textlayout.cxx
index 9c023fe9f409..4447aef5d828 100644
--- a/canvas/source/opengl/ogl_textlayout.cxx
+++ b/canvas/source/opengl/ogl_textlayout.cxx
@@ -73,6 +73,26 @@ namespace oglcanvas
maLogicalAdvancements = aAdvancements;
}
+ uno::Sequence< sal_Bool > SAL_CALL TextLayout::queryKashidaPositions( )
+ {
+ std::unique_lock aGuard( m_aMutex );
+
+ return maKashidaPositions;
+ }
+
+ void SAL_CALL TextLayout::applyKashidaPositions( const uno::Sequence< sal_Bool >& aPositions )
+ {
+ std::unique_lock aGuard( m_aMutex );
+
+ if( aPositions.hasElements() && aPositions.getLength() != maText.Length )
+ {
+ SAL_WARN("canvas.ogl", "TextLayout::applyKashidaPositions(): mismatching number of positions" );
+ throw lang::IllegalArgumentException("mismatching number of positions", getXWeak(), 1);
+ }
+
+ maKashidaPositions = aPositions;
+ }
+
geometry::RealRectangle2D SAL_CALL TextLayout::queryTextBounds( )
{
std::unique_lock aGuard( m_aMutex );
diff --git a/canvas/source/opengl/ogl_textlayout.hxx b/canvas/source/opengl/ogl_textlayout.hxx
index 1d6467d96bc1..d913ec3fb368 100644
--- a/canvas/source/opengl/ogl_textlayout.hxx
+++ b/canvas/source/opengl/ogl_textlayout.hxx
@@ -43,6 +43,8 @@ namespace oglcanvas
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) override;
virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) override;
virtual void SAL_CALL applyLogicalAdvancements( const css::uno::Sequence< double >& aAdvancements ) override;
+ virtual css::uno::Sequence< sal_Bool > SAL_CALL queryKashidaPositions( ) override;
+ virtual void SAL_CALL applyKashidaPositions( const css::uno::Sequence< sal_Bool >& aPositions ) override;
virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) override;
virtual double SAL_CALL justify( double nSize ) override;
virtual double SAL_CALL combinedJustify( const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > >& aNextLayouts, double nSize ) override;
@@ -59,6 +61,7 @@ namespace oglcanvas
private:
css::rendering::StringContext maText;
css::uno::Sequence< double > maLogicalAdvancements;
+ css::uno::Sequence< sal_Bool > maKashidaPositions;
CanvasFont::ImplRef mpFont;
sal_Int8 mnTextDirection;
};