From db9ef688edd86b31606e0dd6df6a77732faca49b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 18 Jan 2017 17:17:09 +0000 Subject: Resolves: tdf#98593 buttons in writer show different text at different zooms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The DrawControlText always renders with a reference device positions but we pass in a rectangle which is derived a different way. So, add a GetControlTextRect which operates on the same reference device as DrawControlText so the rectangles match The rectangle is mapped from pixels to logic and back from logic to pixel, so add an argument to store the logic size from GetControlTextRect and re-use it without conversion on the cases where we pass back the original rectangle zooming in/out on the button in writer is now stable wrt text shown at all zoom levels Change-Id: Ic581eca67d0ff265e2753ab8b6c40e8fca7e6ae4 Reviewed-on: https://gerrit.libreoffice.org/33277 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/inc/textlayout.hxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'vcl/inc/textlayout.hxx') diff --git a/vcl/inc/textlayout.hxx b/vcl/inc/textlayout.hxx index 97350c0aa405..a8a4124daafb 100644 --- a/vcl/inc/textlayout.hxx +++ b/vcl/inc/textlayout.hxx @@ -92,7 +92,10 @@ namespace vcl Rectangle DrawText( const Rectangle& _rRect, const OUString& _rText, DrawTextFlags _nStyle, - MetricVector* _pVector, OUString* _pDisplayText ); + MetricVector* _pVector, OUString* _pDisplayText, const Size* i_pDeviceSize ); + + Rectangle GetTextRect( const Rectangle& _rRect, + const OUString& _rText, DrawTextFlags _nStyle, Size* o_pDeviceSize ); private: ControlTextRenderer( const ControlTextRenderer& ) = delete; -- cgit