diff options
author | Khaled Hosny <khaled@libreoffice.org> | 2023-06-18 17:35:32 +0300 |
---|---|---|
committer | خالد حسني <khaled@libreoffice.org> | 2023-06-18 22:01:53 +0200 |
commit | 68a4f005bc3e74d847e82dddf3237137cf3a1648 (patch) | |
tree | 3712971edf90e5fb753369a6874093a9e90c73d7 | |
parent | 94bf26798bb973c7df26e2aa841099bb9cbaf3cb (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>
-rw-r--r-- | canvas/source/cairo/cairo_textlayout.cxx | 23 | ||||
-rw-r--r-- | canvas/source/cairo/cairo_textlayout.hxx | 3 | ||||
-rw-r--r-- | canvas/source/directx/dx_textlayout.cxx | 21 | ||||
-rw-r--r-- | canvas/source/directx/dx_textlayout.hxx | 3 | ||||
-rw-r--r-- | canvas/source/directx/dx_textlayout_drawhelper.cxx | 5 | ||||
-rw-r--r-- | canvas/source/directx/dx_textlayout_drawhelper.hxx | 1 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_canvashelper.cxx | 6 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_textlayout.cxx | 20 | ||||
-rw-r--r-- | canvas/source/opengl/ogl_textlayout.hxx | 3 | ||||
-rw-r--r-- | canvas/source/vcl/textlayout.cxx | 24 | ||||
-rw-r--r-- | canvas/source/vcl/textlayout.hxx | 3 | ||||
-rw-r--r-- | cppcanvas/source/inc/implrenderer.hxx | 1 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/implrenderer.cxx | 6 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/textaction.cxx | 29 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/textaction.hxx | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/rendering/XTextLayout.idl | 47 |
16 files changed, 190 insertions, 6 deletions
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx index 955a180330d4..ff12a6092c13 100644 --- a/canvas/source/cairo/cairo_textlayout.cxx +++ b/canvas/source/cairo/cairo_textlayout.cxx @@ -131,6 +131,26 @@ namespace cairocanvas 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.cairo", "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 ); @@ -263,8 +283,9 @@ namespace cairocanvas if (maLogicalAdvancements.hasElements()) { KernArray aOffsets(setupTextOffsets(maLogicalAdvancements, viewState, renderState)); + o3tl::span<const sal_Bool> aKashidaArray(maKashidaPositions.getConstArray(), maKashidaPositions.getLength()); - rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets, {}, + rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets, aKashidaArray, ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition), ::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) ); } diff --git a/canvas/source/cairo/cairo_textlayout.hxx b/canvas/source/cairo/cairo_textlayout.hxx index ad9f3466081a..ed8265e8b391 100644 --- a/canvas/source/cairo/cairo_textlayout.hxx +++ b/canvas/source/cairo/cairo_textlayout.hxx @@ -60,6 +60,8 @@ namespace cairocanvas 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; @@ -94,6 +96,7 @@ namespace cairocanvas private: css::rendering::StringContext maText; css::uno::Sequence< double > maLogicalAdvancements; + css::uno::Sequence< sal_Bool > maKashidaPositions; CanvasFont::Reference mpFont; SurfaceProviderRef mpRefDevice; sal_Int8 mnTextDirection; diff --git a/canvas/source/directx/dx_textlayout.cxx b/canvas/source/directx/dx_textlayout.cxx index 452b0d48e79c..e64dde596693 100644 --- a/canvas/source/directx/dx_textlayout.cxx +++ b/canvas/source/directx/dx_textlayout.cxx @@ -93,6 +93,26 @@ namespace dxcanvas maLogicalAdvancements = aAdvancements; } + uno::Sequence< sal_Bool > SAL_CALL TextLayout::queryKashidaPositions( ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + return maKashidaPositions; + } + + void SAL_CALL TextLayout::applyKashidaPositions( const uno::Sequence< sal_Bool >& aPositions ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + if( aPositions.hasElements() && aPositions.getLength() != maText.Length ) + { + SAL_WARN("canvas.directx", "TextLayout::applyKashidaPositions(): mismatching number of positions" ); + throw lang::IllegalArgumentException("mismatching number of positions", getXWeak(), 1); + } + + maKashidaPositions = aPositions; + } + geometry::RealRectangle2D SAL_CALL TextLayout::queryTextBounds( ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -205,6 +225,7 @@ namespace dxcanvas rOutputOffset, maText, maLogicalAdvancements, + maKashidaPositions, mpFont, mpFont->getFontMatrix(), bAlphaSurface, diff --git a/canvas/source/directx/dx_textlayout.hxx b/canvas/source/directx/dx_textlayout.hxx index 24d37e2107a4..f0ae523e7b6a 100644 --- a/canvas/source/directx/dx_textlayout.hxx +++ b/canvas/source/directx/dx_textlayout.hxx @@ -61,6 +61,8 @@ namespace dxcanvas 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; @@ -95,6 +97,7 @@ namespace dxcanvas css::rendering::StringContext maText; css::uno::Sequence< double > maLogicalAdvancements; + css::uno::Sequence< sal_Bool > maKashidaPositions; CanvasFont::ImplRef mpFont; sal_Int8 mnTextDirection; }; diff --git a/canvas/source/directx/dx_textlayout_drawhelper.cxx b/canvas/source/directx/dx_textlayout_drawhelper.cxx index 4b223d1cad0f..55956650ed82 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.cxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.cxx @@ -68,6 +68,7 @@ namespace dxcanvas const ::basegfx::B2ISize& rOutputOffset, const css::rendering::StringContext& rText, const css::uno::Sequence< double >& rLogicalAdvancements, + const css::uno::Sequence< sal_Bool >& rKashidaPositions, const css::uno::Reference< css::rendering::XCanvasFont >& rCanvasFont, const css::geometry::Matrix2D& rFontMatrix, @@ -213,11 +214,13 @@ namespace dxcanvas for( sal_Int32 i=0; i<nLen; ++i ) DXArray.push_back(basegfx::fround(rLogicalAdvancements[i])); + o3tl::span<const sal_Bool> aKashidaArray(rKashidaPositions.getConstArray(), rKashidaPositions.getLength()); + // draw the String xVirtualDevice->DrawTextArray( aEmptyPoint, aText, DXArray, - {}, + aKashidaArray, rText.StartPosition, rText.Length, bIsRTL ? SalLayoutFlags::BiDiRtl : SalLayoutFlags::NONE); diff --git a/canvas/source/directx/dx_textlayout_drawhelper.hxx b/canvas/source/directx/dx_textlayout_drawhelper.hxx index 0db8fca69762..8e9383a8aee9 100644 --- a/canvas/source/directx/dx_textlayout_drawhelper.hxx +++ b/canvas/source/directx/dx_textlayout_drawhelper.hxx @@ -52,6 +52,7 @@ namespace dxcanvas const ::basegfx::B2ISize& rOutputOffset, const css::rendering::StringContext& rText, const css::uno::Sequence< double >& rLogicalAdvancements, + const css::uno::Sequence< sal_Bool >& rKashidaPositions, const css::uno::Reference< css::rendering::XCanvasFont >& rCanvasFont, const css::geometry::Matrix2D& rFontMatrix, 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; }; diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx index 34c154257f31..2d56d2f4f074 100644 --- a/canvas/source/vcl/textlayout.cxx +++ b/canvas/source/vcl/textlayout.cxx @@ -121,6 +121,7 @@ namespace vclcanvas rendering::CompositeOperation::SOURCE); KernArray aOffsets(setupTextOffsets(maLogicalAdvancements, aViewState, aRenderState)); + o3tl::span<const sal_Bool> aKashidaArray(maKashidaPositions.getArray(), maKashidaPositions.getLength()); std::vector< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence; ::basegfx::B2DPolyPolygonVector aOutlines; @@ -131,7 +132,8 @@ namespace vclcanvas maText.StartPosition, maText.Length, 0, - aOffsets)) + aOffsets, + aKashidaArray)) { aOutlineSequence.reserve(aOutlines.size()); sal_Int32 nIndex (0); @@ -216,6 +218,23 @@ namespace vclcanvas maLogicalAdvancements = aAdvancements; } + uno::Sequence< sal_Bool > SAL_CALL TextLayout::queryKashidaPositions( ) + { + SolarMutexGuard aGuard; + + return maKashidaPositions; + } + + void SAL_CALL TextLayout::applyKashidaPositions( const uno::Sequence< sal_Bool >& aPositions ) + { + SolarMutexGuard aGuard; + + ENSURE_ARG_OR_THROW( !aPositions.hasElements() || aPositions.getLength() == maText.Length, + "TextLayout::applyKashidaPositions(): mismatching number of positions" ); + + maKashidaPositions = aPositions; + } + geometry::RealRectangle2D SAL_CALL TextLayout::queryTextBounds( ) { SolarMutexGuard aGuard; @@ -337,6 +356,7 @@ namespace vclcanvas { // TODO(P2): cache that KernArray aOffsets(setupTextOffsets(maLogicalAdvancements, viewState, renderState)); + o3tl::span<const sal_Bool> aKashidaArray(maKashidaPositions.getConstArray(), maKashidaPositions.getLength()); // TODO(F3): ensure correct length and termination for DX // array (last entry _must_ contain the overall width) @@ -344,7 +364,7 @@ namespace vclcanvas rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets, - {}, + aKashidaArray, ::canvas::tools::numeric_cast<sal_uInt16>(maText.StartPosition), ::canvas::tools::numeric_cast<sal_uInt16>(maText.Length) ); } diff --git a/canvas/source/vcl/textlayout.hxx b/canvas/source/vcl/textlayout.hxx index 84f5fe6cab91..998383cb029b 100644 --- a/canvas/source/vcl/textlayout.hxx +++ b/canvas/source/vcl/textlayout.hxx @@ -58,6 +58,8 @@ namespace vclcanvas 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; @@ -89,6 +91,7 @@ namespace vclcanvas css::rendering::StringContext maText; css::uno::Sequence< double > maLogicalAdvancements; + css::uno::Sequence< sal_Bool > maKashidaPositions; CanvasFont::Reference mpFont; css::uno::Reference< css::rendering::XGraphicDevice> mxDevice; OutDevProviderSharedPtr mpOutDevProvider; diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx index edf4fcf9efba..1cd4fd91d72e 100644 --- a/cppcanvas/source/inc/implrenderer.hxx +++ b/cppcanvas/source/inc/implrenderer.hxx @@ -195,6 +195,7 @@ namespace cppcanvas::internal int nIndex, int nLength, KernArraySpan pCharWidths, + o3tl::span<const sal_Bool> pKashidaArray, const ActionFactoryParameters& rParms, bool bSubsettable ); diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 10ccaf1ccdbb..958faf8f8378 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -847,6 +847,7 @@ namespace cppcanvas::internal int nIndex, int nLength, KernArraySpan pCharWidths, + o3tl::span<const sal_Bool> pKashidaArray, const ActionFactoryParameters& rParms, bool bSubsettableActions ) { @@ -943,6 +944,7 @@ namespace cppcanvas::internal nIndex, nLength, pCharWidths, + pKashidaArray, rParms.mrVDev, rParms.mrCanvas, rState, @@ -1008,6 +1010,7 @@ namespace cppcanvas::internal 0/*nStartPos*/, nLen, aStrikeoutCharWidths, + pKashidaArray, rParms.mrVDev, rParms.mrCanvas, rState, @@ -2450,6 +2453,7 @@ namespace cppcanvas::internal pAct->GetIndex(), nLen, {}, + {}, rFactoryParms, bSubsettableActions ); } @@ -2471,6 +2475,7 @@ namespace cppcanvas::internal pAct->GetIndex(), nLen, pAct->GetDXArray(), + pAct->GetKashidaArray(), rFactoryParms, bSubsettableActions ); } @@ -2578,6 +2583,7 @@ namespace cppcanvas::internal pAct->GetIndex(), nLen, aDXArray, + {}, rFactoryParms, bSubsettableActions ); } diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx index 4b945c2f2ce3..fb75f661fcad 100644 --- a/cppcanvas/source/mtfrenderer/textaction.cxx +++ b/cppcanvas/source/mtfrenderer/textaction.cxx @@ -229,6 +229,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState, const ::basegfx::B2DHomMatrix* pTextTransform ) @@ -255,6 +256,7 @@ namespace cppcanvas::internal "::cppcanvas::internal::initArrayAction(): Invalid font" ); o_rTextLayout->applyLogicalAdvancements( rOffsets ); + o_rTextLayout->applyKashidaPositions( rKashidas ); } @@ -457,6 +459,10 @@ namespace cppcanvas::internal io_rTextLayout, nLayoutWidth, rSubset ) ); + uno::Sequence< sal_Bool > aOrigKashidaPositions(io_rTextLayout->queryKashidaPositions()); + uno::Sequence< sal_Bool > aKashidaPositions(aOrigKashidaPositions.getArray() + rSubset.mnSubsetBegin, + rSubset.mnSubsetEnd - rSubset.mnSubsetBegin); + xTextLayout->applyKashidaPositions(aKashidaPositions); } io_rTextLayout = xTextLayout; @@ -1017,6 +1023,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState ); @@ -1025,6 +1032,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState, const ::basegfx::B2DHomMatrix& rTextTransform ); @@ -1061,6 +1069,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState ) : mpCanvas( rCanvas ) @@ -1074,6 +1083,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, nullptr ); } @@ -1083,6 +1093,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, const CanvasSharedPtr& rCanvas, const OutDevState& rState, const ::basegfx::B2DHomMatrix& rTextTransform ) : @@ -1097,6 +1108,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, &rTextTransform ); @@ -1206,6 +1218,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState ); @@ -1219,6 +1232,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -1273,6 +1287,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState ) : @@ -1296,6 +1311,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, nullptr ); } @@ -1310,6 +1326,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, const uno::Sequence< double >& rOffsets, + const uno::Sequence< sal_Bool >& rKashidas, VirtualDevice const & rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -1334,6 +1351,7 @@ namespace cppcanvas::internal nStartPos, nLen, rOffsets, + rKashidas, rCanvas, rState, &rTextTransform ); @@ -1967,6 +1985,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, KernArraySpan pDXArray, + o3tl::span<const sal_Bool> pKashidaArray, VirtualDevice& rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -1994,7 +2013,7 @@ namespace cppcanvas::internal static_cast<sal_uInt16>(nStartPos), static_cast<sal_uInt16>(nStartPos), static_cast<sal_uInt16>(nLen), - 0, pDXArray ) ); + 0, pDXArray, pKashidaArray ) ); rVDev.SetFont(aOrigFont); if( !bHaveOutlines ) @@ -2097,6 +2116,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, KernArraySpan pDXArray, + o3tl::span<const sal_Bool> pKashidaArray, VirtualDevice& rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, @@ -2129,6 +2149,7 @@ namespace cppcanvas::internal nStartPos, nLen, pDXArray, + pKashidaArray, rVDev, rCanvas, rState, @@ -2146,6 +2167,8 @@ namespace cppcanvas::internal rVDev, rState )); + const uno::Sequence< sal_Bool > aKashidas(pKashidaArray.data(), pKashidaArray.size()); + // determine type of text action to create // ======================================= @@ -2240,6 +2263,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rCanvas, rState, *rParms.maTextTransformation ); @@ -2250,6 +2274,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rCanvas, rState ); } @@ -2268,6 +2293,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rVDev, rCanvas, rState, @@ -2284,6 +2310,7 @@ namespace cppcanvas::internal nStartPos, nLen, aCharWidths, + aKashidas, rVDev, rCanvas, rState ); diff --git a/cppcanvas/source/mtfrenderer/textaction.hxx b/cppcanvas/source/mtfrenderer/textaction.hxx index 66d08ca8cfa2..bc399f0f8502 100644 --- a/cppcanvas/source/mtfrenderer/textaction.hxx +++ b/cppcanvas/source/mtfrenderer/textaction.hxx @@ -69,6 +69,7 @@ namespace cppcanvas::internal sal_Int32 nStartPos, sal_Int32 nLen, KernArraySpan pDXArray, + o3tl::span<const sal_Bool> pKashidaArray, VirtualDevice& rVDev, const CanvasSharedPtr& rCanvas, const OutDevState& rState, diff --git a/offapi/com/sun/star/rendering/XTextLayout.idl b/offapi/com/sun/star/rendering/XTextLayout.idl index b2318d2554eb..1551b7334203 100644 --- a/offapi/com/sun/star/rendering/XTextLayout.idl +++ b/offapi/com/sun/star/rendering/XTextLayout.idl @@ -143,6 +143,53 @@ interface XTextLayout : ::com::sun::star::uno::XInterface raises (com::sun::star::lang::IllegalArgumentException); + /** Query the Kashida insertion positions in the input string.<p> + + This method returns a sequence of Kashida insertion positions, one for + each character in the input string (<em>not</em> for every + glyph. There might be multiple glyphs per input character, or + multiple input characters per glyph).<p> + + A Kashida insertion position is a boolean indicating if Kashida should + inserted after this character.<p> + + This method can be used to query for the layout's default Kashida + insertion positions, which can subsequently be changed and applied to + the layout via + XTextLayout::applyKashidaPositions().<p> + + @returns a sequence of booleans specifying the Kashida insertion + positions per character. + + @see XTextLayout::applyKashidaPositions) + + @since LibreOffice 7.6 + */ + sequence<boolean> queryKashidaPositions(); + + + /** Apply Kashida insertion positions for the layout string.<p> + + This method applies the specified Kashida insertion positions to every + logical character in the input string (<em>not</em> for every + glyph. There might be multiple glyphs per input character, or + multiple input characters per glyph).<p> + + @param aPositions + A sequence of booleans specifying Kashida insertion positions. + + @see XTextLayout::queryKashidaPositions() + + @throws com::sun::star::lang::IllegalArgumentException + if the size of aPositions is not zero and does not match the number of + characters in the text. + + @since LibreOffice 7.6 + */ + void applyKashidaPositions( [in] sequence< boolean > aPositions ) + raises (com::sun::star::lang::IllegalArgumentException); + + /** Query the overall bounding box of the text.<p> This method is similar to |