Spread the error-bar move evenly around justified text.

(cherry picked from commit 3ab9175553)
This commit is contained in:
Jeff Young 2023-05-27 18:53:04 +01:00
parent 16f286735d
commit c1d8e979f3
1 changed files with 5 additions and 4 deletions

View File

@ -176,15 +176,15 @@ void DS_DRAW_ITEM_TEXT::PrintWsItem( const RENDER_SETTINGS* aSettings, const VEC
const BOX2I DS_DRAW_ITEM_TEXT::GetApproxBBox()
{
// A really dumb approximation because doing it for real (even with the stroke font) shows
// up large in profiles.
// A really dumb over-approximation because doing it for real (even with the stroke font)
// shows up large in profiles.
const TEXT_ATTRIBUTES& attrs = GetAttributes();
const wxString text = GetShownText( true );
BOX2I bbox( GetTextPos() );
bbox.SetWidth( (int) text.length() * attrs.m_Size.x * 3 );
bbox.SetHeight( attrs.m_Size.y * 3 );
bbox.SetWidth( (int) text.length() * attrs.m_Size.x * 1.3 );
bbox.SetHeight( attrs.m_Size.y );
switch( attrs.m_Halign )
{
@ -200,6 +200,7 @@ const BOX2I DS_DRAW_ITEM_TEXT::GetApproxBBox()
case GR_TEXT_V_ALIGN_BOTTOM: bbox.Offset( 0, -bbox.GetHeight() ); break;
}
bbox.Inflate( attrs.m_Size.x, attrs.m_Size.y / 2 );
return bbox;
}