core.git: Branch 'libreoffice-7-6' - canvas/source
canvas/source/cairo/cairo_canvashelper.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit a2c0ab909195c803401cc710985f19723680e0eb Author: Sarper Akdemir AuthorDate: Mon Jan 15 07:01:01 2024 +0300 Commit: Xisco Fauli CommitDate: Tue Feb 27 19:31:44 2024 +0100 tdf#156830: fix faulty transformation order in cairo canvas for patterns Change-Id: Ib58e845c23dd14bbc3b96e5549a722b650d593a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162069 Tested-by: Jenkins Reviewed-by: Sarper Akdemir (cherry picked from commit 84055d875ead6d7862cd8ddc5697a280240411fe) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162008 Reviewed-by: Thorsten Behrens (cherry picked from commit 3add4092d29b9b03c00dfa24caa917a3fc84540b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163972 Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx index 14113e89361f..2bfca55f317c 100644 --- a/canvas/source/cairo/cairo_canvashelper.cxx +++ b/canvas/source/cairo/cairo_canvashelper.cxx @@ -488,7 +488,7 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: geometry::IntegerSize2D aSize = aTexture.Bitmap->getSize(); cairo_matrix_init_scale( , 1.0/aSize.Width, 1.0/aSize.Height ); -cairo_matrix_multiply( , , ); +cairo_matrix_multiply( , , ); cairo_matrix_invert( ); // we don't care about repeat mode yet, so the workaround is disabled for now
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - canvas/source
canvas/source/vcl/canvashelper_texturefill.cxx | 54 + 1 file changed, 20 insertions(+), 34 deletions(-) New commits: commit 705566856b647760a2ea3c6a7de9efe4ea1d9e7a Author: Patrick Luby AuthorDate: Tue Aug 15 20:00:57 2023 -0400 Commit: Patrick Luby CommitDate: Mon Aug 21 18:36:12 2023 +0200 tdf#144073 and tdf#147645: use bounds and angle for gradient Passing an expanded, rotated polygon noticeably modifies the drawing of the gradient in a slideshow due to moving of the starting and ending colors far off the edges of the drawing surface. So try another way and set the angle of the gradient and draw only the unadjusted bounds. Change-Id: I95441dfa3215396d5bc7edfa9f985335480b37de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155729 Tested-by: Jenkins Reviewed-by: Patrick Luby (cherry picked from commit 9e0249b62afeca701dec27a4371f20829775422a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155705 Reviewed-by: Ilmari Lauhakangas diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx index 1582a3ad7601..5e9399f56841 100644 --- a/canvas/source/vcl/canvashelper_texturefill.cxx +++ b/canvas/source/vcl/canvashelper_texturefill.cxx @@ -154,24 +154,17 @@ namespace vclcanvas // 2 colors and 2 stops (at 0 and 1) is a linear gradient: if( rColors.size() == 2 && rValues.maStops.size() == 2 && rValues.maStops[0] == 0 && rValues.maStops[1] == 1) { -// tdf#144073: Note that the code below adjusts the gradient area this way. -// No, I have no idea why. -aLeftTop -= 2.0*nDiagonalLength*aDirection; -aLeftBottom -= 2.0*nDiagonalLength*aDirection; -aRightTop += 2.0*nDiagonalLength*aDirection; -aRightBottom += 2.0*nDiagonalLength*aDirection; +// tdf#144073 and tdf#147645: use bounds and angle for gradient +// Passing an expanded, rotated polygon noticeably modifies the +// drawing of the gradient in a slideshow due to moving of the +// starting and ending colors far off the edges of the drawing +// surface. So try another way and set the angle of the +// gradient and draw only the unadjusted bounds. Gradient vclGradient( css::awt::GradientStyle_LINEAR, rColors[ 0 ], rColors[ 1 ] ); -::tools::Polygon aTempPoly( static_cast(5) ); -aTempPoly[0] = ::Point( ::basegfx::fround( aLeftTop.getX() ), -::basegfx::fround( aLeftTop.getY() ) ); -aTempPoly[1] = ::Point( ::basegfx::fround( aRightTop.getX() ), -::basegfx::fround( aRightTop.getY() ) ); -aTempPoly[2] = ::Point( ::basegfx::fround( aRightBottom.getX() ), -::basegfx::fround( aRightBottom.getY() ) ); -aTempPoly[3] = ::Point( ::basegfx::fround( aLeftBottom.getX() ), -::basegfx::fround( aLeftBottom.getY() ) ); -aTempPoly[4] = aTempPoly[0]; -rOutDev.DrawGradient( aTempPoly, vclGradient ); +double fRotate = atan2( aDirection.getY(), aDirection.getX() ); +const double nAngleInTenthOfDegrees = 3600.0 - basegfx::rad2deg<10>( fRotate ) + 900.0; +vclGradient.SetAngle( Degree10( ::basegfx::fround( nAngleInTenthOfDegrees ) ) ); +rOutDev.DrawGradient( rBounds, vclGradient ); return; } // 3 colors with first and last being equal and 3 stops (at 0, 0.5 and 1) is an axial gradient: @@ -179,24 +172,17 @@ namespace vclcanvas && rValues.maStops.size() == 3 && rValues.maStops[0] == 0 && rValues.maStops[1] == 0.5 && rValues.maStops[2] == 1) { -// tdf#144073: Note that the code below adjusts the gradient area this way. -// No, I have no idea why. -aLeftTop -= 2.0*nDiagonalLength*aDirection; -aLeftBottom -= 2.0*nDiagonalLength*aDirection; -aRightTop += 2.0*nDiagonalLength*aDirection; -aRightBottom += 2.0*nDiagonalLength*aDirection; +// tdf#144073 and tdf#147645: use bounds and angle for gradient +// Passing an expanded, rotated polygon noticeably modifies the +// drawing of the gradient in a slideshow due to moving of the +// starting and ending colors far off the edges of the drawing +// surface. So try another way and set the angle of the +// gradient and draw only the unadjusted bounds. Gradient vclGradient( css::awt::GradientStyle_AXIAL, rColors[ 1 ],
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - canvas/source
canvas/source/vcl/canvasfont.cxx | 32 ++-- canvas/source/vcl/canvasfont.hxx |3 +++ canvas/source/vcl/impltools.cxx | 27 +++ canvas/source/vcl/impltools.hxx |5 + canvas/source/vcl/textlayout.cxx |8 5 files changed, 53 insertions(+), 22 deletions(-) New commits: commit 7e6fa772f181c1e91d55cb25ce58a62ed7348b4d Author: Khaled Hosny AuthorDate: Mon Jul 10 13:40:28 2023 + Commit: Michael Stahl CommitDate: Tue Jul 11 11:40:45 2023 +0200 tdf#147999: Fix canvas font width for fallback fonts on Windows For some reason we are getting the wrong font width for fallback fonts, which results in rendering them squished. This happens only with VCL canvas, but not with DX one, so it shows when hardware acceleration is disabled (either explicitly or implicitly when Skia is enabled). Change-Id: I5a45b1c1d68f4c6e6dd6b43371602af3330a7cd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154272 Tested-by: Jenkins Reviewed-by: خالد حسني (cherry picked from commit 0f6d25d4768db060e823f726c7727aebbbfbff22) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154254 Reviewed-by: Michael Stahl diff --git a/canvas/source/vcl/canvasfont.cxx b/canvas/source/vcl/canvasfont.cxx index e7fab0492549..41b7da25016d 100644 --- a/canvas/source/vcl/canvasfont.cxx +++ b/canvas/source/vcl/canvasfont.cxx @@ -47,7 +47,8 @@ namespace vclcanvas Size( 0, ::basegfx::fround(rFontRequest.CellSize) ) ) ), maFontRequest( rFontRequest ), mpRefDevice( ), -mpOutDevProvider( rOutDevProvider ) +mpOutDevProvider( rOutDevProvider ), +maFontMatrix( rFontMatrix ) { maFont->SetAlignment( ALIGN_BASELINE ); maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); @@ -63,27 +64,7 @@ namespace vclcanvas maFont->SetLanguage( LanguageTag::convertToLanguageType( rFontRequest.Locale, false)); // adjust to stretched/shrunk font -if( !::rtl::math::approxEqual( rFontMatrix.m00, rFontMatrix.m11) ) -{ -OutputDevice& rOutDev( rOutDevProvider->getOutDev() ); - -const bool bOldMapState( rOutDev.IsMapModeEnabled() ); -rOutDev.EnableMapMode(false); - -const Size aSize = rOutDev.GetFontMetric( *maFont ).GetFontSize(); - -const double fDividend( rFontMatrix.m10 + rFontMatrix.m11 ); -double fStretch = rFontMatrix.m00 + rFontMatrix.m01; - -if( !::basegfx::fTools::equalZero( fDividend) ) -fStretch /= fDividend; - -const ::tools::Long nNewWidth = ::basegfx::fround( aSize.Width() * fStretch ); - -maFont->SetAverageFontWidth( nNewWidth ); - -rOutDev.EnableMapMode(bOldMapState); -} +tools::setupFontWidth(rFontMatrix, maFont.get(), rOutDevProvider->getOutDev()); sal_uInt32 nEmphasisMark = 0; @@ -172,6 +153,13 @@ namespace vclcanvas { return *maFont; } + +const css::geometry::Matrix2D& CanvasFont::getFontMatrix() const +{ +SolarMutexGuard aGuard; + +return maFontMatrix; +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/canvas/source/vcl/canvasfont.hxx b/canvas/source/vcl/canvasfont.hxx index fdfa870f5ed3..834df756e0b7 100644 --- a/canvas/source/vcl/canvasfont.hxx +++ b/canvas/source/vcl/canvasfont.hxx @@ -75,11 +75,14 @@ namespace vclcanvas vcl::Font const & getVCLFont() const; +const css::geometry::Matrix2D& getFontMatrix() const; + private: ::canvas::vcltools::VCLObject maFont; css::rendering::FontRequest maFontRequest; css::uno::Reference< css::rendering::XGraphicDevice> mpRefDevice; OutDevProviderSharedPtr mpOutDevProvider; +css::geometry::Matrix2D maFontMatrix; }; } diff --git a/canvas/source/vcl/impltools.cxx b/canvas/source/vcl/impltools.cxx index 5539a92d1734..0a44f22096f0 100644 --- a/canvas/source/vcl/impltools.cxx +++ b/canvas/source/vcl/impltools.cxx @@ -135,6 +135,33 @@ namespace vclcanvas::tools return true; } +void setupFontWidth(const css::geometry::Matrix2D& rFontMatrix, +vcl::Font& rFont, +OutputDevice& rOutDev) +{ +rFont.SetFontSize(Size(0, rFont.GetFontHeight())); + +if (!::rtl::math::approxEqual(rFontMatrix.m00, rFontMatrix.m11)) +{ +const bool bOldMapState(rOutDev.IsMapModeEnabled()); +rOutDev.EnableMapMode(false); + +
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - canvas/source
canvas/source/cairo/cairo_canvasfont.cxx|9 +++-- canvas/source/cairo/cairo_canvasfont.hxx|3 +++ canvas/source/cairo/cairo_canvashelper_text.cxx |3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) New commits: commit 924d394220db3c20e638fc573ce3f8c60deab9d0 Author: Khaled Hosny AuthorDate: Mon Jun 19 21:19:46 2023 +0300 Commit: خالد حسني CommitDate: Tue Jun 20 09:39:22 2023 +0200 tdf#43671: Pass through emphasis mark setting with cairo canvas Other canvas implementations passed it through, but cairo canvas was not. Change-Id: I9b4cc500998635568c095866f9099f83bf1c984e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153299 Tested-by: Jenkins Reviewed-by: خالد حسني (cherry picked from commit 35803990c9b1881074460659acdac6b2799c99ee) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153283 diff --git a/canvas/source/cairo/cairo_canvasfont.cxx b/canvas/source/cairo/cairo_canvasfont.cxx index 16af11838a91..82f300e8a205 100644 --- a/canvas/source/cairo/cairo_canvasfont.cxx +++ b/canvas/source/cairo/cairo_canvasfont.cxx @@ -27,6 +27,8 @@ #include #include +#include + #include "cairo_canvasfont.hxx" #include "cairo_textlayout.hxx" @@ -36,15 +38,18 @@ namespace cairocanvas { CanvasFont::CanvasFont( const rendering::FontRequest& rFontRequest, -const uno::Sequence< beans::PropertyValue >& /*rExtraFontProperties*/, +const uno::Sequence< beans::PropertyValue >& rExtraFontProperties, const geometry::Matrix2D& rFontMatrix, SurfaceProviderRef rDevice ) : maFont( vcl::Font( rFontRequest.FontDescription.FamilyName, rFontRequest.FontDescription.StyleName, Size( 0, ::basegfx::fround(rFontRequest.CellSize) ) ) ), maFontRequest( rFontRequest ), -mpRefDevice(std::move( rDevice )) +mpRefDevice(std::move( rDevice )), +mnEmphasisMark(0) { +::canvas::tools::extractExtraFontProperties(rExtraFontProperties, mnEmphasisMark); + maFont->SetAlignment( ALIGN_BASELINE ); maFont->SetCharSet( (rFontRequest.FontDescription.IsSymbolFont==css::util::TriState_YES) ? RTL_TEXTENCODING_SYMBOL : RTL_TEXTENCODING_UNICODE ); maFont->SetVertical( rFontRequest.FontDescription.IsVertical==css::util::TriState_YES ); diff --git a/canvas/source/cairo/cairo_canvasfont.hxx b/canvas/source/cairo/cairo_canvasfont.hxx index e510f420c437..d5e015006c98 100644 --- a/canvas/source/cairo/cairo_canvasfont.hxx +++ b/canvas/source/cairo/cairo_canvasfont.hxx @@ -70,10 +70,13 @@ namespace cairocanvas vcl::Font const & getVCLFont() const; +sal_uInt32 getEmphasisMark() const { return mnEmphasisMark; } + private: ::canvas::vcltools::VCLObject maFont; css::rendering::FontRequest maFontRequest; SurfaceProviderRef mpRefDevice; +sal_uInt32 mnEmphasisMark; }; } diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx index 6973607d4824..c8498bddf3b7 100644 --- a/canvas/source/cairo/cairo_canvashelper_text.cxx +++ b/canvas/source/cairo/cairo_canvashelper_text.cxx @@ -190,6 +190,9 @@ namespace cairocanvas aVCLFont.SetColor( aColor ); aVCLFont.SetFillColor( aColor ); +if (pFont->getEmphasisMark()) + aVCLFont.SetEmphasisMark(FontEmphasisMark(pFont->getEmphasisMark())); + // no need to replicate this for mp2ndOutDev, we're modifying only aVCLFont here. if( !setupFontTransform( rOutDev, o_rOutPos, aVCLFont, viewState, renderState ) ) return false;
[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - canvas/source cppcanvas/source offapi/com
canvas/source/cairo/cairo_textlayout.cxx | 23 +- canvas/source/cairo/cairo_textlayout.hxx |3 + canvas/source/directx/dx_textlayout.cxx| 21 + canvas/source/directx/dx_textlayout.hxx|3 + canvas/source/directx/dx_textlayout_drawhelper.cxx |5 +- canvas/source/directx/dx_textlayout_drawhelper.hxx |1 canvas/source/opengl/ogl_canvashelper.cxx |6 ++ canvas/source/opengl/ogl_textlayout.cxx| 20 canvas/source/opengl/ogl_textlayout.hxx|3 + canvas/source/vcl/textlayout.cxx | 24 +- canvas/source/vcl/textlayout.hxx |3 + cppcanvas/source/inc/implrenderer.hxx |1 cppcanvas/source/mtfrenderer/implrenderer.cxx |6 ++ cppcanvas/source/mtfrenderer/textaction.cxx| 29 cppcanvas/source/mtfrenderer/textaction.hxx|1 offapi/com/sun/star/rendering/XTextLayout.idl | 47 + 16 files changed, 190 insertions(+), 6 deletions(-) New commits: commit a20093c2b7f4ad0822a34507980f5be9d47b812c Author: Khaled Hosny AuthorDate: Sun Jun 18 17:35:32 2023 +0300 Commit: خالد حسني CommitDate: Mon Jun 19 07:36:26 2023 +0200 tdf#155810: Pass Kashida insertion positions through canvas This was missed in: commit 3901e029bd39575f700e69a73818565d62226a23 Author: Khaled Hosny 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/+/153224 Tested-by: Jenkins Reviewed-by: خالد حسني 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 aKashidaArray(maKashidaPositions.getConstArray(), maKashidaPositions.getLength()); -rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets, {}, +rOutDev.DrawTextArray( rOutpos, maText.Text, aOffsets, aKashidaArray, ::canvas::tools::numeric_cast(maText.StartPosition), ::canvas::tools::numeric_cast(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