Fix some more pen width issues from global removal.
Fixes https://gitlab.com/kicad/code/kicad/issues/4408
This commit is contained in:
parent
06dea92bcb
commit
301ac3461c
|
@ -159,10 +159,8 @@ int EDA_TEXT::GetEffectiveTextPenWidth( int aDefaultWidth ) const
|
||||||
|
|
||||||
if( IsBold() )
|
if( IsBold() )
|
||||||
width = GetPenSizeForBold( GetTextWidth() );
|
width = GetPenSizeForBold( GetTextWidth() );
|
||||||
|
else if( width <= 1 )
|
||||||
// Avoid using a 0 width for text: it can create issues when drawing it
|
width = GetPenSizeForNormal( GetTextWidth() );
|
||||||
if( width <= 1 )
|
|
||||||
width = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clip pen size for small texts:
|
// Clip pen size for small texts:
|
||||||
|
|
|
@ -54,6 +54,12 @@ int GetPenSizeForBold( int aTextSize )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GetPenSizeForNormal( int aTextSize )
|
||||||
|
{
|
||||||
|
return KiROUND( aTextSize / 8.0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Clamp_Text_PenSize
|
* Function Clamp_Text_PenSize
|
||||||
* Don't allow text to become cluttered up in its own fatness. Bold fonts are generally around
|
* Don't allow text to become cluttered up in its own fatness. Bold fonts are generally around
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
|
#include <sch_painter.h>
|
||||||
#include <plotter.h>
|
#include <plotter.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <eeschema_config.h>
|
#include <eeschema_config.h>
|
||||||
|
@ -743,12 +744,22 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const
|
||||||
|
|
||||||
void SCH_LINE::Plot( PLOTTER* aPlotter )
|
void SCH_LINE::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
|
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||||
|
int penWidth;
|
||||||
|
|
||||||
if( m_color != COLOR4D::UNSPECIFIED )
|
if( m_color != COLOR4D::UNSPECIFIED )
|
||||||
aPlotter->SetColor( m_color );
|
aPlotter->SetColor( m_color );
|
||||||
else
|
else
|
||||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
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->SetCurrentLineWidth( penWidth );
|
||||||
aPlotter->SetDash( GetLineStyle() );
|
aPlotter->SetDash( GetLineStyle() );
|
||||||
|
|
|
@ -823,19 +823,19 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||||
// Bitmaps are drawn first to ensure they are in the background
|
// Bitmaps are drawn first to ensure they are in the background
|
||||||
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
||||||
// the bitmap PS command clears the screen
|
// the bitmap PS command clears the screen
|
||||||
for( auto item : bitmaps )
|
for( SCH_ITEM* item : bitmaps )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto item : other )
|
for( SCH_ITEM* item : other )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto item : junctions )
|
for( SCH_ITEM* item : junctions )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter );
|
||||||
|
|
|
@ -73,6 +73,13 @@ int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold = true );
|
||||||
*/
|
*/
|
||||||
int GetPenSizeForBold( int aTextSize );
|
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
|
* Function GraphicTextWidth
|
||||||
* @return the X size of the graphic text
|
* @return the X size of the graphic text
|
||||||
|
|
Loading…
Reference in New Issue