diff options
author | Jan Holesovsky <kendy@suse.cz> | 2012-11-24 20:07:24 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2012-11-24 20:09:19 +0100 |
commit | a4910e36ef5391f6b22fb3c0ef6d317f47cb6709 (patch) | |
tree | e147b0c364f9b765c20b9e546a28bcf881d38a9a /svx | |
parent | c7bd4073e4fc82e37d5484c1cf80f578a183a20e (diff) |
Apply Style: Correct the font size when it is too big to fit nicely.
Change-Id: I6bfa1d5d4064de70974508fe6122f5289972e9a7
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 8d561f7997b7..8d288a228e7c 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -638,7 +638,17 @@ void SvxStyleBox_Impl::UserDraw( const UserDrawEvent& rUDEvt ) Point aPos( rUDEvt.GetRect().TopLeft() ); aPos.X() += nLeftDistance; - aPos.Y() += std::max( 0L, ( rUDEvt.GetRect().GetHeight() - aTextRect.Bottom() ) / 2 ); + if ( aTextRect.Bottom() > rUDEvt.GetRect().GetHeight() ) + { + // the text does not fit, adjust the font size + double ratio = static_cast< double >( rUDEvt.GetRect().GetHeight() ) / aTextRect.Bottom(); + aPixelSize.Width() *= ratio; + aPixelSize.Height() *= ratio; + aFont.SetSize( aPixelSize ); + pDevice->SetFont( aFont ); + } + else + aPos.Y() += ( rUDEvt.GetRect().GetHeight() - aTextRect.Bottom() ) / 2; pDevice->DrawText( aPos, aStyleName ); |