Don't rely on the penWidth already being set when setting the dash style.

Fixes https://gitlab.com/kicad/code/kicad/issues/11908
This commit is contained in:
Jeff Young
2022-06-29 07:34:45 -06:00
parent 4a8aaefdc0
commit dbbdc9d2e6
17 changed files with 111 additions and 89 deletions
+14 -10
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -510,29 +510,33 @@ void PS_PLOTTER::emitSetRGBColor( double r, double g, double b, double a )
}
void PS_PLOTTER::SetDash( PLOT_DASH_TYPE dashed )
void PS_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle )
{
switch( dashed )
switch( aLineStyle )
{
case PLOT_DASH_TYPE::DASH:
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU() );
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DOT:
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOT:
fprintf( m_outputFile, "[%d %d %d %d] 0 setdash\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOTDOT:
fprintf( m_outputFile, "[%d %d %d %d %d %d] 0 setdash\n",
(int) GetDashMarkLenIU(), (int) GetDashGapLenIU(),
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU(),
(int) GetDotMarkLenIU(), (int) GetDashGapLenIU() );
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
default:
fputs( "solidline\n", m_outputFile );
}