PCB_TEXT::TransformTextToPolySet(): fix missing code for knockout texts.

From master branch
Fixes #14473
https://gitlab.com/kicad/code/kicad/issues/14473
This commit is contained in:
jean-pierre charras 2023-04-02 10:29:18 +02:00
parent 2ece2719d0
commit f59626004c
2 changed files with 34 additions and 3 deletions

View File

@ -493,7 +493,22 @@ void FP_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLay
font->Draw( &callback_gal, GetShownText(), GetTextPos(), attrs ); font->Draw( &callback_gal, GetShownText(), GetTextPos(), attrs );
buffer.Simplify( SHAPE_POLY_SET::PM_FAST ); buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
if( IsKnockout() )
{
SHAPE_POLY_SET finalPoly;
int margin = attrs.m_StrokeWidth * 1.5
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( buffer, SHAPE_POLY_SET::PM_FAST );
aBuffer.Append( finalPoly );
}
else
{
aBuffer.Append( buffer ); aBuffer.Append( buffer );
}
} }

View File

@ -303,7 +303,7 @@ void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLa
// Stroke callback // Stroke callback
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 ) [&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
{ {
TransformOvalToPolygon( aBuffer, aPt1, aPt2, penWidth + ( 2 * aClearance ), TransformOvalToPolygon( buffer, aPt1, aPt2, penWidth + ( 2 * aClearance ),
aError, ERROR_INSIDE ); aError, ERROR_INSIDE );
}, },
// Triangulation callback // Triangulation callback
@ -318,7 +318,23 @@ void PCB_TEXT::TransformTextToPolySet( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLa
font->Draw( &callback_gal, GetShownText(), GetTextPos(), GetAttributes() ); font->Draw( &callback_gal, GetShownText(), GetTextPos(), GetAttributes() );
buffer.Simplify( SHAPE_POLY_SET::PM_FAST ); buffer.Simplify( SHAPE_POLY_SET::PM_FAST );
if( IsKnockout() )
{
TEXT_ATTRIBUTES attrs = GetAttributes();
SHAPE_POLY_SET finalPoly;
int margin = attrs.m_StrokeWidth * 1.5
+ GetKnockoutTextMargin( attrs.m_Size, attrs.m_StrokeWidth );
TransformBoundingBoxToPolygon( &finalPoly, margin );
finalPoly.BooleanSubtract( buffer, SHAPE_POLY_SET::PM_FAST );
aBuffer.Append( finalPoly );
}
else
{
aBuffer.Append( buffer ); aBuffer.Append( buffer );
}
} }