diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 7a7ae767da..bec46f556d 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -159,10 +159,8 @@ int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const if( IsBold() ) width = GetPenSizeForBold( GetTextWidth() ); - - // Avoid using a 0 width for text: it can create issues when drawing it - if( width <= 1 ) - width = 1; + else if( width <= 1 ) + width = GetPenSizeForNormal( GetTextWidth() ); } // Clip pen size for small texts: diff --git a/common/gr_text.cpp b/common/gr_text.cpp index 480e26c1cf..440f87328c 100644 --- a/common/gr_text.cpp +++ b/common/gr_text.cpp @@ -54,6 +54,12 @@ int GetPenSizeForBold( int aTextSize ) } +int GetPenSizeForNormal( int aTextSize ) +{ + return KiROUND( aTextSize / 8.0 ); +} + + /** * Function Clamp_Text_PenSize * Don't allow text to become cluttered up in its own fatness. Bold fonts are generally around diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index bb7954fa8c..ed6e71498e 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -743,12 +744,22 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const void SCH_LINE::Plot( PLOTTER* aPlotter ) { + auto* settings = static_cast( aPlotter->RenderSettings() ); + int penWidth; + if( m_color != COLOR4D::UNSPECIFIED ) aPlotter->SetColor( m_color ); else aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) ); - int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() ); + switch( m_Layer ) + { + case LAYER_WIRE: penWidth = settings->m_DefaultWireThickness; break; + case LAYER_BUS: penWidth = settings->m_DefaultBusThickness; break; + default: penWidth = GetPenWidth(); break; + } + + penWidth = std::max( penWidth, aPlotter->RenderSettings()->GetDefaultPenWidth() ); aPlotter->SetCurrentLineWidth( penWidth ); aPlotter->SetDash( GetLineStyle() ); diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index dd44ea7d63..74c716dba8 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -823,19 +823,19 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter ) // Bitmaps are drawn first to ensure they are in the background // This is particularly important for the wxPostscriptDC (used in *nix printers) as // the bitmap PS command clears the screen - for( auto item : bitmaps ) + for( SCH_ITEM* item : bitmaps ) { aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) ); item->Plot( aPlotter ); } - for( auto item : other ) + for( SCH_ITEM* item : other ) { aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) ); item->Plot( aPlotter ); } - for( auto item : junctions ) + for( SCH_ITEM* item : junctions ) { aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) ); item->Plot( aPlotter ); diff --git a/include/gr_text.h b/include/gr_text.h index 0ea2c2ef11..ab0def72f3 100644 --- a/include/gr_text.h +++ b/include/gr_text.h @@ -73,6 +73,13 @@ int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold = true ); */ int GetPenSizeForBold( int aTextSize ); +/** + * Function GetPensizeForNormal + * @return the "best" value for a pen size to draw/plot a non-bold text + * @param aTextSize = the char size (height or width) + */ +int GetPenSizeForNormal( int aTextSize ); + /** * Function GraphicTextWidth * @return the X size of the graphic text