Replace larger text bboxes now that we're not using them for knockouts.

This commit is contained in:
Jeff Young 2023-05-28 18:17:24 +01:00
parent c71cf21e2f
commit 570978fa7f
2 changed files with 4 additions and 5 deletions

View File

@ -565,13 +565,10 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
// bounding box will be moved later according to the actual text options // bounding box will be moved later according to the actual text options
VECTOR2I textsize = VECTOR2I( extents.x, extents.y ); VECTOR2I textsize = VECTOR2I( extents.x, extents.y );
VECTOR2I pos = drawPos; VECTOR2I pos = drawPos;
int fudgeFactor = extents.y * 0.17;
if( font->IsStroke() ) if( font->IsStroke() )
{
int fudgeFactor = extents.y * 0.17;
textsize.y += fudgeFactor; textsize.y += fudgeFactor;
pos.y += fudgeFactor / 2;
}
if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() ) if( IsMultilineAllowed() && aLine > 0 && aLine < (int) strings.GetCount() )
pos.y -= KiROUND( aLine * font->GetInterline( fontSize.y ) ); pos.y -= KiROUND( aLine * font->GetInterline( fontSize.y ) );
@ -629,6 +626,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
switch( GetVertJustify() ) switch( GetVertJustify() )
{ {
case GR_TEXT_V_ALIGN_TOP: case GR_TEXT_V_ALIGN_TOP:
bbox.Offset( 0, -fudgeFactor );
break; break;
case GR_TEXT_V_ALIGN_CENTER: case GR_TEXT_V_ALIGN_CENTER:
@ -637,6 +635,7 @@ BOX2I EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
case GR_TEXT_V_ALIGN_BOTTOM: case GR_TEXT_V_ALIGN_BOTTOM:
bbox.SetY( bbox.GetY() - bbox.GetHeight() ); bbox.SetY( bbox.GetY() - bbox.GetHeight() );
bbox.Offset( 0, fudgeFactor );
break; break;
} }

View File

@ -429,7 +429,7 @@ VECTOR2I FONT::StringBoundaryLimits( const wxString& aText, const VECTOR2I& aSiz
if( IsStroke() ) if( IsStroke() )
{ {
// Inflate by a bit more than thickness/2 to catch diacriticals, descenders, etc. // Inflate by a bit more than thickness/2 to catch diacriticals, descenders, etc.
boundingBox.Inflate( KiROUND( aThickness * 1.25 ) ); boundingBox.Inflate( KiROUND( aThickness * 1.5 ) );
} }
else if( IsOutline() ) else if( IsOutline() )
{ {