Browse Source

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.

(cherry picked from commit f0f6b5a09b)
9.0
Wayne Stambaugh 8 months ago
parent
commit
a4f71ae3ee
  1. 19
      eeschema/eeschema_jobs_handler.cpp
  2. 2
      kicad/cli/command_sch_export_plot.cpp

19
eeschema/eeschema_jobs_handler.cpp

@ -24,6 +24,7 @@
#include <cli/exit_codes.h>
#include <sch_plotter.h>
#include <drawing_sheet/ds_proxy_view_item.h>
#include <font/kicad_font_name.h>
#include <jobs/job_export_sch_bom.h>
#include <jobs/job_export_sch_pythonbom.h>
#include <jobs/job_export_sch_netlist.h>
@ -32,6 +33,7 @@
#include <jobs/job_sym_export_svg.h>
#include <jobs/job_sym_upgrade.h>
#include <schematic.h>
#include <schematic_settings.h>
#include <wx/dir.h>
#include <wx/file.h>
#include <memory>
@ -261,7 +263,22 @@ int EESCHEMA_JOBS_HANDLER::JobExportPlot( JOB* aJob )
std::unique_ptr<SCH_RENDER_SETTINGS> renderSettings = std::make_unique<SCH_RENDER_SETTINGS>();
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<EESCHEMA_SETTINGS*>( mgr.GetAppSettings<EESCHEMA_SETTINGS>( "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<SCH_PLOTTER> schPlotter = std::make_unique<SCH_PLOTTER>( sch );

2
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 )
{

Loading…
Cancel
Save