svx/source/styles/CommonStylePreviewRenderer.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
New commits: commit 0cdb364d0f8b30f857da212e6c663f36b91087d1 Author: Khaled Hosny <kha...@libreoffice.org> AuthorDate: Sun Sep 24 18:10:21 2023 +0300 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Mon Sep 25 13:33:41 2023 +0200 tdf#157067: Fix missing background color in style preview Set the colors after setting the font not before as otherwise they seem to get overridden. Change-Id: I258cb762fd2328369bd8adae63e94ec87c666bb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157208 Tested-by: Jenkins Reviewed-by: خالد حسني <kha...@libreoffice.org> (cherry picked from commit d9eed9b489d8ad208df307588595f3a8d3b7539b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157212 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/svx/source/styles/CommonStylePreviewRenderer.cxx b/svx/source/styles/CommonStylePreviewRenderer.cxx index c23861e92a72..d92aac21d89c 100644 --- a/svx/source/styles/CommonStylePreviewRenderer.cxx +++ b/svx/source/styles/CommonStylePreviewRenderer.cxx @@ -335,12 +335,6 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend mrOutputDev.DrawRect(aRectangle); } - if (maFontColor != COL_AUTO) - mrOutputDev.SetTextColor(maFontColor); - - if (maHighlightColor != COL_AUTO) - mrOutputDev.SetTextFillColor(maHighlightColor); - Point aFontDrawPosition = aRectangle.TopLeft(); aFontDrawPosition.AdjustY(mnBaseLine); if (eRenderAlign == RenderAlign::CENTER) @@ -376,10 +370,16 @@ bool CommonStylePreviewRenderer::render(const tools::Rectangle& aRectangle, Rend mrOutputDev.Push(vcl::PushFlags::FONT); if (oFont) - { mrOutputDev.SetFont(*oFont); + + if (maFontColor != COL_AUTO) + mrOutputDev.SetTextColor(maFontColor); + + if (maHighlightColor != COL_AUTO) + mrOutputDev.SetTextFillColor(maHighlightColor); + + if (oFont) oFont->QuickDrawText(&mrOutputDev, aFontDrawPosition, rText, nStart, nEnd - nStart, {}); - } else mrOutputDev.DrawText(aFontDrawPosition, rText, nStart, nEnd - nStart);