From f0f6b5a09be9c781a956fd2f1de52dd16eea0515 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sat, 19 Apr 2025 12:56:39 -0400 Subject: [PATCH] Use schematic editor default font setting for plot job. When the user does not define a font on the CLI or when plotting from a job set, use the current schematic editor default font setting rather than always defaulting to the "KiCad Font". Set the --default-font CLI setting to an empty string so the the schematic editor default font setting will be used. Setting the --default-font CLI option will override the schematic editor default font setting. --- eeschema/eeschema_jobs_handler.cpp | 19 ++++++++++++++++++- kicad/cli/command_sch_export_plot.cpp | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/eeschema/eeschema_jobs_handler.cpp b/eeschema/eeschema_jobs_handler.cpp index 3ce4da7dc5..8224ff7101 100644 --- a/eeschema/eeschema_jobs_handler.cpp +++ b/eeschema/eeschema_jobs_handler.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -261,7 +263,22 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob ) std::unique_ptr renderSettings = std::make_unique(); InitRenderSettings( renderSettings.get(), aPlotJob->m_theme, sch, aPlotJob->m_drawingSheet ); - renderSettings->SetDefaultFont( aPlotJob->m_defaultFont ); + + wxString font = aPlotJob->m_defaultFont; + + if( font.IsEmpty() ) + { + SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager(); + EESCHEMA_SETTINGS* cfg = + dynamic_cast( mgr.GetAppSettings( "eeschema" ) ); + + if( cfg ) + font = cfg->m_Appearance.default_font; + else + font = KICAD_FONT_NAME; + } + + renderSettings->SetDefaultFont( font ); renderSettings->SetMinPenWidth( aPlotJob->m_minPenWidth ); std::unique_ptr schPlotter = std::make_unique( sch ); diff --git a/kicad/cli/command_sch_export_plot.cpp b/kicad/cli/command_sch_export_plot.cpp index 7a8e88e60d..dc66bef6b9 100644 --- a/kicad/cli/command_sch_export_plot.cpp +++ b/kicad/cli/command_sch_export_plot.cpp @@ -80,7 +80,7 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName, m_argParser.add_argument( ARG_FONT_NAME ) .help( UTF8STDSTR( _( "Default font name" ) ) ) - .default_value( wxString( KICAD_FONT_NAME ).ToStdString() ); + .default_value( wxString( "" ).ToStdString() ); if( aPlotFormat == SCH_PLOT_FORMAT::PDF ) {