Texts were drawn with a minimal line thickness = GetDefaultPenWidth(). The default pen width can be to large for small texts. So the actual text thickness is now always clamped.
@ -149,15 +149,19 @@ void EDA_TEXT::SwapEffects( EDA_TEXT& aTradingPartner )
}
int EDA_TEXT::GetEffectiveTextPenWidth() const
int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const
{
int width = GetTextThickness();
if( width <= 0 )
if( width <= 1 )
width = aDefaultWidth;
if( IsBold() )
width = GetPenSizeForBold( GetTextWidth() );
else
// Avoid using a 0 width for text: it can create issues when drawing it
width = 1;
@ -146,7 +146,7 @@ void SCH_FIELD::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
COLOR4D color = aSettings->GetLayerColor( IsForceVisible() ? LAYER_HIDDEN : m_Layer );
int orient;
wxPoint textpos;
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
int penWidth = GetEffectiveTextPenWidth( aSettings->GetDefaultPenWidth() );
if( ( !IsVisible() && !IsForceVisible() ) || IsVoid() )
return;
@ -483,8 +483,8 @@ bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_FIELD::Plot( PLOTTER* aPlotter )
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( GetLayer() );
int penWidth = std::max( GetEffectiveTextPenWidth(),
aPlotter->RenderSettings()->GetDefaultPenWidth() );
int penWidth = GetEffectiveTextPenWidth(
if( !IsVisible() )
@ -325,8 +325,7 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows )
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
m_schSettings.GetDefaultPenWidth() );
float width = (float) aItem->GetEffectiveTextPenWidth( m_schSettings.GetDefaultPenWidth() );
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();
@ -337,8 +336,7 @@ float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows
float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadows )
@ -592,8 +592,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
static std::vector<wxPoint> Poly;
int penWidth = GetEffectiveTextPenWidth( aPlotter->RenderSettings()->GetDefaultPenWidth() );
aPlotter->SetCurrentLineWidth( penWidth );
@ -156,7 +156,12 @@ public:
*/
void SetTextThickness( int aWidth ) { m_e.penwidth = aWidth; };
int GetTextThickness() const { return m_e.penwidth; };
int GetEffectiveTextPenWidth() const;
/**
* The EffectiveTextPenWidth uses the text thickness if > 1 or
* aDefaultWidth.
int GetEffectiveTextPenWidth( int aDefaultWidth = 0 ) const;
virtual void SetTextAngle( double aAngle )