Make outline font min segment length configurable

This was hard coded at 10IU, which was way too small for pcbnew and
still too small for schematic editor.  Instead, we set a default of 50
and allow the user to adjust (smaller for less powerful machines)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16568
This commit is contained in:
Seth Hillbrand 2024-01-11 18:26:42 -08:00
parent e1495d1825
commit 42e02552ac
3 changed files with 21 additions and 4 deletions

View File

@ -103,6 +103,7 @@ static const wxChar EnableGit[] = wxT( "EnableGit" );
static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo" );
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
static const wxChar MinimumSegmentLength[] = wxT( "MinimumSegmentLength" );
} // namespace KEYS
@ -245,6 +246,8 @@ ADVANCED_CFG::ADVANCED_CFG()
m_PcbSelectionVisibilityRatio = 1.0;
m_MinimumSegmentLength = 50;
loadFromConfigFile();
}
@ -437,6 +440,10 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
&m_PcbSelectionVisibilityRatio,
m_PcbSelectionVisibilityRatio, 0.0, 1.0 ) );
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::MinimumSegmentLength,
&m_MinimumSegmentLength,
m_MinimumSegmentLength, 10, 1000 ) );
// Special case for trace mask setting...we just grab them and set them immediately
// Because we even use wxLogTrace inside of advanced config
wxString traceMasks;

View File

@ -24,6 +24,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <advanced_config.h>
#include <font/outline_decomposer.h>
#include <bezier_curves.h>
@ -176,10 +177,8 @@ bool OUTLINE_DECOMPOSER::approximateCubicBezierCurve( GLYPH_POINTS& aResul
{
wxASSERT( aCubicBezier.size() == 4 );
// minimumSegmentLength defines the "smoothness" of the
// curve-to-straight-segments conversion: the larger, the coarser
// TODO: find out what the minimum segment length should really be!
constexpr int minimumSegmentLength = 10;
static int minimumSegmentLength = ADVANCED_CFG::GetCfg().m_MinimumSegmentLength;
BEZIER_POLY converter( aCubicBezier );
converter.GetPoly( aResult, minimumSegmentLength );

View File

@ -498,6 +498,17 @@ public:
* Default value: 1
*/
double m_PcbSelectionVisibilityRatio;
/**
* Length of the minimum segment for the outline decomposer. This is in IU, so
* it is nm in pcbnew and 100nm in eeschema.
*
* Setting name: "MinimumSegmentLength"
* Valid values: 10 to 1000
* Default value: 50
*/
int m_MinimumSegmentLength;
///@}