From 57b015d04d8f823163066cf455ba1ee3de43f2bb Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 9 Aug 2017 13:04:51 +0100 Subject: autoformat dialog can draw 'None' invisible sometimes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if you switch from an entry which last draws white text, i.e. the "Gray" entry, to "None" then the white text color is persistent and the preview appears to be missing. Instead of getting and resetting the Font to keep the output device font unchanged, push/pop the font and text color setting Change-Id: Ia3a8f0120f8df4b1ec57217e8e6071b0113b3a93 Reviewed-on: https://gerrit.libreoffice.org/40919 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- svtools/source/control/scriptedtext.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/svtools/source/control/scriptedtext.cxx b/svtools/source/control/scriptedtext.cxx index c077786e20e0..16f737fd22a1 100644 --- a/svtools/source/control/scriptedtext.cxx +++ b/svtools/source/control/scriptedtext.cxx @@ -123,7 +123,7 @@ const vcl::Font& SvtScriptedTextHelper_Impl::GetFont( sal_uInt16 _nScript ) cons void SvtScriptedTextHelper_Impl::CalculateSizes() { maTextSize.Width() = maTextSize.Height() = 0; - maDefltFont = mrOutDevice.GetFont(); + mrOutDevice.Push(PushFlags::FONT | PushFlags::TEXTCOLOR); // calculate text portion widths and total width maWidthVec.clear(); @@ -163,7 +163,7 @@ void SvtScriptedTextHelper_Impl::CalculateSizes() SetOutDevFont( i18n::ScriptType::COMPLEX ); maTextSize.Height() = std::max( maTextSize.Height(), mrOutDevice.GetTextHeight() ); - mrOutDevice.SetFont( maDefltFont ); + mrOutDevice.Pop(); } void SvtScriptedTextHelper_Impl::CalculateBreaks( const uno::Reference< i18n::XBreakIterator >& _xBreakIter ) @@ -265,7 +265,8 @@ void SvtScriptedTextHelper_Impl::DrawText( const Point& _rPos ) DBG_ASSERT( maPosVec.size() - 1 == maScriptVec.size(), "SvtScriptedTextHelper_Impl::DrawText - invalid vectors" ); DBG_ASSERT( maScriptVec.size() == maWidthVec.size(), "SvtScriptedTextHelper_Impl::DrawText - invalid vectors" ); - maDefltFont = mrOutDevice.GetFont(); + mrOutDevice.Push(PushFlags::FONT | PushFlags::TEXTCOLOR); + Point aCurrPos( _rPos ); sal_Int32 nThisPos = maPosVec[ 0 ]; sal_Int32 nNextPos; @@ -286,7 +287,8 @@ void SvtScriptedTextHelper_Impl::DrawText( const Point& _rPos ) aCurrPos.X() += mrOutDevice.GetTextHeight() / 5; // add 20% of font height as portion spacing nThisPos = nNextPos; } - mrOutDevice.SetFont( maDefltFont ); + + mrOutDevice.Pop(); } -- cgit