Silence font replace warnings for libs

When loading schematics/pcbs, notification of font replacements might be
warranted but in libraries, this warning is not helpful and intrusive
This commit is contained in:
Seth Hillbrand 2024-06-20 15:33:03 -07:00
parent 92c8ddfddb
commit 11c6164934
19 changed files with 192 additions and 73 deletions

View File

@ -26,6 +26,7 @@
#include <string_utils.h>
#include <macros.h>
#include <cstdint>
#include <reporter.h>
#ifdef __WIN32__
#define WIN32_LEAN_AND_MEAN
@ -37,6 +38,8 @@ using namespace fontconfig;
static FONTCONFIG* g_config = nullptr;
static bool g_fcInitSuccess = false;
REPORTER* FONTCONFIG::s_reporter = nullptr;
/**
* A simple wrapper to avoid exporing fontconfig in the header
*/
@ -57,6 +60,12 @@ FONTCONFIG::FONTCONFIG()
};
void fontconfig::FONTCONFIG::SetReporter( REPORTER* aReporter )
{
s_reporter = aReporter;
}
/**
* This is simply a wrapper to call FcInit() with SEH for Windows
* SEH on Windows can only be used in functions without objects that might be unwinded
@ -317,12 +326,15 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
if( retval == FF_RESULT::FF_ERROR )
{
wxLogWarning( _( "Error loading font '%s'." ), qualifiedFontName );
if( s_reporter )
s_reporter->Report( wxString::Format( _( "Error loading font '%s'." ), qualifiedFontName ) );
}
else if( retval == FF_RESULT::FF_SUBSTITUTE )
{
fontName.Replace( ':', ' ' );
wxLogWarning( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName );
if( s_reporter )
s_reporter->Report( wxString::Format( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName ) );
}
FcPatternDestroy( pat );

View File

@ -53,6 +53,7 @@
#include <bezier_curves.h>
#include <compoundfilereader.h>
#include <font/fontconfig.h>
#include <geometry/ellipse.h>
#include <string_utils.h>
#include <sch_edit_frame.h>
@ -390,6 +391,9 @@ SCH_SHEET* SCH_IO_ALTIUM::LoadSchematicFile( const wxString& aFileName, SCHEMATI
fileName.SetExt( FILEEXT::KiCadSchematicFileExtension );
m_schematic = aSchematic;
// Show the font substitution warnings
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
// Delete on exception, if I own m_rootSheet, according to aAppendToMe
std::unique_ptr<SCH_SHEET> deleter( aAppendToMe ? nullptr : m_rootSheet );
@ -4513,6 +4517,9 @@ long long SCH_IO_ALTIUM::getLibraryTimestamp( const wxString& aLibraryPath ) con
void SCH_IO_ALTIUM::ensureLoadedLibrary( const wxString& aLibraryPath,
const STRING_UTF8_MAP* aProperties )
{
// Suppress font substitution warnings
fontconfig::FONTCONFIG::SetReporter( nullptr );
if( m_libCache.count( aLibraryPath ) )
{
wxCHECK( m_timestamps.count( aLibraryPath ), /*void*/ );

View File

@ -22,6 +22,7 @@
#include <sch_io/cadstar/sch_io_cadstar_archive.h>
#include <io/cadstar/cadstar_parts_lib_parser.h>
#include <font/fontconfig.h>
#include <lib_symbol.h>
#include <progress_reporter.h>
#include <project_sch.h>
@ -68,6 +69,9 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi
{
wxCHECK( !aFileName.IsEmpty() && aSchematic, nullptr );
// Show the font substitution warnings
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
SCH_SHEET* rootSheet = nullptr;
@ -240,6 +244,9 @@ void SCH_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary( const wxString& aLibraryPath,
wxFileName csafn;
wxString fplibname = "cadstarpcblib";
// Suppress font substitution warnings
fontconfig::FONTCONFIG::SetReporter( nullptr );
if( aProperties && aProperties->count( "csa" ) )
{
csafn = wxFileName( aProperties->at( "csa" ) );

View File

@ -36,29 +36,30 @@
#include <wx/txtstrm.h>
#include <wx/xml/xml.h>
#include <font/fontconfig.h>
#include <io/eagle/eagle_parser.h>
#include <string_utils.h>
#include <lib_id.h>
#include <progress_reporter.h>
#include <project.h>
#include <project/net_settings.h>
#include <project_sch.h>
#include <sch_bus_entry.h>
#include <sch_symbol.h>
#include <project/net_settings.h>
#include <sch_edit_frame.h>
#include <sch_junction.h>
#include <sch_io/kicad_legacy/sch_io_kicad_legacy.h>
#include <sch_junction.h>
#include <sch_label.h>
#include <sch_marker.h>
#include <sch_screen.h>
#include <sch_pin.h>
#include <sch_screen.h>
#include <sch_shape.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <sch_sheet_pin.h>
#include <sch_label.h>
#include <sch_symbol.h>
#include <schematic.h>
#include <string_utils.h>
#include <symbol_lib_table.h>
#include <wildcards_and_files_ext.h>
#include <progress_reporter.h>
// Eagle schematic axes are aligned with x increasing left to right and Y increasing bottom to top
@ -344,6 +345,9 @@ SCH_SHEET* SCH_IO_EAGLE::LoadSchematicFile( const wxString& aFileName, SCHEMATIC
wxASSERT( !aFileName || aSchematic != nullptr );
LOCALE_IO toggle; // toggles on, then off, the C locale.
// Show the font substitution warnings
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
m_filename = aFileName;
m_schematic = aSchematic;
@ -520,6 +524,9 @@ long long SCH_IO_EAGLE::getLibraryTimestamp( const wxString& aLibraryPath ) cons
void SCH_IO_EAGLE::ensureLoadedLibrary( const wxString& aLibraryPath )
{
// Suppress font substitution warnings
fontconfig::FONTCONFIG::SetReporter( nullptr );
if( m_eagleLibs.find( m_libName ) != m_eagleLibs.end() )
{
wxCHECK( m_timestamps.count( m_libName ), /*void*/ );

View File

@ -25,14 +25,14 @@
#include "sch_easyeda_parser.h"
#include "sch_io_easyeda.h"
#include <schematic.h>
#include <sch_sheet.h>
#include <sch_screen.h>
#include <font/fontconfig.h>
#include <kiplatform/environment.h>
#include <project_sch.h>
#include <wildcards_and_files_ext.h>
#include <sch_screen.h>
#include <sch_sheet.h>
#include <schematic.h>
#include <string_utils.h>
#include <wildcards_and_files_ext.h>
#include <wx/log.h>
#include <wx/stdstream.h>
#include <wx/zipstrm.h>
@ -309,6 +309,9 @@ void SCH_IO_EASYEDA::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
{
std::map<wxString, int> namesCounter;
// Suppress font substitution warnings
fontconfig::FONTCONFIG::SetReporter( nullptr );
try
{
wxFFileInputStream in( aLibraryPath );
@ -612,6 +615,9 @@ SCH_SHEET* SCH_IO_EASYEDA::LoadSchematicFile( const wxString& aFileName, SCHEMAT
{
wxCHECK( !aFileName.IsEmpty() && aSchematic, nullptr );
// Show the font substitution warnings
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
SCH_SHEET* rootSheet = nullptr;
if( aAppendToMe )

View File

@ -25,6 +25,7 @@
#include "sch_easyedapro_parser.h"
#include "sch_io_easyedapro.h"
#include <font/fontconfig.h>
#include <schematic.h>
#include <sch_sheet.h>
#include <sch_screen.h>
@ -429,6 +430,9 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName,
{
wxCHECK( !aFileName.IsEmpty() && aSchematic, nullptr );
// Show the font substitution warnings
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
SCH_SHEET* rootSheet = nullptr;
if( aAppendToMe )

View File

@ -28,41 +28,43 @@
#include <wx/base64.h>
#include <wx/log.h>
#include <wx/mstream.h>
#include <boost/algorithm/string/join.hpp>
#include <advanced_config.h>
#include <base_units.h>
#include <build_version.h>
#include <trace_helpers.h>
#include <ee_selection.h>
#include <font/fontconfig.h>
#include <io/kicad/kicad_io_utils.h>
#include <locale_io.h>
#include <progress_reporter.h>
#include <schematic.h>
#include <schematic_lexer.h>
#include <sch_bitmap.h>
#include <sch_bus_entry.h>
#include <sch_symbol.h>
#include <sch_edit_frame.h> // SYMBOL_ORIENTATION_T
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr_common.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr_lib_cache.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.h>
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_pin.h>
#include <sch_shape.h>
#include <sch_no_connect.h>
#include <sch_pin.h>
#include <sch_rule_area.h>
#include <sch_text.h>
#include <sch_textbox.h>
#include <sch_table.h>
#include <sch_tablecell.h>
#include <sch_screen.h>
#include <sch_shape.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <schematic.h>
#include <sch_screen.h>
#include <io/kicad/kicad_io_utils.h>
#include <schematic_lexer.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr_lib_cache.h>
#include <sch_io/kicad_sexpr/sch_io_kicad_sexpr_common.h>
#include <symbol_lib_table.h> // for PropPowerSymsOnly definition.
#include <ee_selection.h>
#include <sch_symbol.h>
#include <sch_table.h>
#include <sch_tablecell.h>
#include <sch_text.h>
#include <sch_textbox.h>
#include <string_utils.h>
#include <symbol_lib_table.h> // for PropPowerSymsOnly definition.
#include <trace_helpers.h>
#include <wx_filename.h> // for ::ResolvePossibleSymlinks()
#include <progress_reporter.h>
#include <boost/algorithm/string/join.hpp>
using namespace TSCHEMATIC_T;
@ -107,6 +109,9 @@ SCH_SHEET* SCH_IO_KICAD_SEXPR::LoadSchematicFile( const wxString& aFileName, SCH
wxFileName fn = aFileName;
// Show the font substitution warnings
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
// Unfortunately child sheet file names the legacy schematic file format are not fully
// qualified and are always appended to the project path. The aFileName attribute must
// always be an absolute path so the project path can be used for load child sheet files.
@ -1585,6 +1590,9 @@ void SCH_IO_KICAD_SEXPR::saveInstances( const std::vector<SCH_SHEET_INSTANCE>& a
void SCH_IO_KICAD_SEXPR::cacheLib( const wxString& aLibraryFileName,
const STRING_UTF8_MAP* aProperties )
{
// Suppress font substitution warnings
fontconfig::FONTCONFIG::SetReporter( nullptr );
if( !m_cache || !m_cache->IsFile( aLibraryFileName ) || m_cache->IsFileChanged() )
{
// a spectacular episode in memory management:

View File

@ -30,6 +30,7 @@
#include <unordered_map>
#include <font/fontinfo.h>
class REPORTER;
namespace fontconfig
{
@ -67,9 +68,17 @@ public:
*/
void ListFonts( std::vector<std::string>& aFonts, const std::string& aDesiredLang );
/**
* Set the reporter to use for reporting font substitution warnings.
*
* @param aReporter The reporter to use for reporting font substitution warnings.
*/
static void SetReporter( REPORTER* aReporter );
private:
std::map<std::string, FONTINFO> m_fontInfoCache;
wxString m_fontCacheLastLang;
static REPORTER* s_reporter;
/**
* Matches the two rfc 3306 language entries, used for when searching for matching family names

View File

@ -29,6 +29,7 @@
#include <board.h>
#include <build_version.h>
#include <core/ignore.h>
#include <font/fontconfig.h>
#include <pad.h>
#include <pcb_group.h>
#include <pcb_generator.h>
@ -508,6 +509,8 @@ BOARD* CLIPBOARD_IO::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
wxLogNull doNotLog; // disable logging of failed clipboard actions
fontconfig::FONTCONFIG::SetReporter( nullptr );
auto clipboard = wxTheClipboard;
wxClipboardLocker clipboardLock( clipboard );

View File

@ -28,11 +28,13 @@
#include <wx/string.h>
#include <font/fontconfig.h>
#include <pcb_io_altium_circuit_maker.h>
#include <pcb_io_altium_designer.h>
#include <altium_pcb.h>
#include <io/altium/altium_binary_parser.h>
#include <pcb_io/pcb_io.h>
#include <reporter.h>
#include <board.h>
@ -67,6 +69,8 @@ BOARD* PCB_IO_ALTIUM_CIRCUIT_MAKER::LoadBoard( const wxString& aFileName, BOARD*
m_board = aAppendToMe ? aAppendToMe : new BOARD();
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
// Give the filename to the board if it's new
if( !aAppendToMe )
m_board->SetFileName( aFileName );

View File

@ -28,11 +28,14 @@
#include <wx/string.h>
#include <font/fontconfig.h>
#include <pcb_io_altium_circuit_studio.h>
#include <pcb_io_altium_designer.h>
#include <altium_pcb.h>
#include <io/altium/altium_binary_parser.h>
#include <pcb_io/pcb_io.h>
#include <reporter.h>
#include <board.h>
@ -67,6 +70,8 @@ BOARD* PCB_IO_ALTIUM_CIRCUIT_STUDIO::LoadBoard( const wxString& aFileName, BOARD
m_board = aAppendToMe ? aAppendToMe : new BOARD();
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
// Give the filename to the board if it's new
if( !aAppendToMe )
m_board->SetFileName( aFileName );

View File

@ -28,6 +28,7 @@
#include <wx/string.h>
#include <font/fontconfig.h>
#include <pcb_io_altium_designer.h>
#include <altium_pcb.h>
#include <io/io_utils.h>
@ -96,10 +97,13 @@ bool PCB_IO_ALTIUM_DESIGNER::CanReadLibrary( const wxString& aFileName ) const
BOARD* PCB_IO_ALTIUM_DESIGNER::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
const STRING_UTF8_MAP* aProperties, PROJECT* aProject )
{
m_props = aProperties;
m_board = aAppendToMe ? aAppendToMe : new BOARD();
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
// Give the filename to the board if it's new
if( !aAppendToMe )
m_board->SetFileName( aFileName );
@ -170,6 +174,8 @@ long long PCB_IO_ALTIUM_DESIGNER::GetLibraryTimestamp( const wxString& aLibraryP
void PCB_IO_ALTIUM_DESIGNER::loadAltiumLibrary( const wxString& aLibraryPath )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
try
{
auto it = m_fplibFiles.find( aLibraryPath );

View File

@ -19,6 +19,7 @@
#include <wx/string.h>
#include <font/fontconfig.h>
#include <pcb_io_solidworks.h>
#include <pcb_io_altium_designer.h>
#include <altium_pcb.h>
@ -59,6 +60,8 @@ BOARD* PCB_IO_SOLIDWORKS::LoadBoard( const wxString& aFileName, BOARD* aAppendTo
m_board = aAppendToMe ? aAppendToMe : new BOARD();
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
// Give the filename to the board if it's new
if( !aAppendToMe )
m_board->SetFileName( aFileName );

View File

@ -24,12 +24,14 @@
*/
#include <cadstar_pcb_archive_loader.h>
#include <font/fontconfig.h>
#include <pcb_io_cadstar_archive.h>
#include <board.h>
#include <footprint.h>
#include <string_utf8_map.h>
#include <io/io_utils.h>
#include <pcb_io/pcb_io.h>
#include <reporter.h>
std::map<wxString, PCB_LAYER_ID> PCB_IO_CADSTAR_ARCHIVE::DefaultLayerMappingCallback(
@ -100,6 +102,8 @@ BOARD* PCB_IO_CADSTAR_ARCHIVE::LoadBoard( const wxString& aFileName, BOARD* aApp
m_board = aAppendToMe ? aAppendToMe : new BOARD();
clearLoadedFootprints();
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
CADSTAR_PCB_ARCHIVE_LOADER tempPCB( aFileName, m_layer_mapping_handler,
m_show_layer_mapping_warnings, m_progressReporter );
tempPCB.Load( m_board, aProject );
@ -232,6 +236,8 @@ long long PCB_IO_CADSTAR_ARCHIVE::GetLibraryTimestamp( const wxString& aLibraryP
void PCB_IO_CADSTAR_ARCHIVE::ensureLoadedLibrary( const wxString& aLibraryPath )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
if( m_cache.count( aLibraryPath ) )
{
wxCHECK( m_timestamps.count( aLibraryPath ), /*void*/ );

View File

@ -61,6 +61,7 @@ Load() TODO's
#include <wx/window.h>
#include <convert_basic_shapes_to_polygon.h>
#include <font/fontconfig.h>
#include <string_utils.h>
#include <locale_io.h>
#include <string_utf8_map.h>
@ -77,6 +78,7 @@ Load() TODO's
#include <padstack.h>
#include <pcb_text.h>
#include <pcb_dimension.h>
#include <reporter.h>
#include <pcb_io/pcb_io.h>
#include <pcb_io/eagle/pcb_io_eagle.h>
@ -326,6 +328,8 @@ BOARD* PCB_IO_EAGLE::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
LOCALE_IO toggle; // toggles on, then off, the C locale.
wxXmlNode* doc;
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
init( aProperties );
m_board = aAppendToMe ? aAppendToMe : new BOARD();
@ -3152,6 +3156,8 @@ wxDateTime PCB_IO_EAGLE::getModificationTime( const wxString& aPath )
void PCB_IO_EAGLE::cacheLib( const wxString& aLibPath )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
try
{
wxDateTime modtime = getModificationTime( aLibPath );

View File

@ -27,12 +27,14 @@
#include <pcb_io/easyeda/pcb_io_easyeda_parser.h>
#include <pcb_io/pcb_io.h>
#include <font/fontconfig.h>
#include <progress_reporter.h>
#include <common.h>
#include <macros.h>
#include <board.h>
#include <footprint.h>
#include <board_design_settings.h>
#include <reporter.h>
#include <wx/log.h>
#include <wx/wfstream.h>
@ -140,6 +142,8 @@ BOARD* PCB_IO_EASYEDA::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe,
m_props = aProperties;
m_board = aAppendToMe ? aAppendToMe : new BOARD();
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
// Give the filename to the board if it's new
if( !aAppendToMe )
m_board->SetFileName( aFileName );
@ -379,6 +383,8 @@ FOOTPRINT* PCB_IO_EASYEDA::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
PCB_IO_EASYEDA_PARSER parser( nullptr );
m_loadedFootprints.clear();

View File

@ -29,10 +29,12 @@
#include <pcb_io/pcb_io.h>
#include <board.h>
#include <font/fontconfig.h>
#include <footprint.h>
#include <progress_reporter.h>
#include <common.h>
#include <macros.h>
#include <reporter.h>
#include <fstream>
#include <wx/txtstrm.h>
@ -108,6 +110,8 @@ BOARD* PCB_IO_EASYEDAPRO::LoadBoard( const wxString& aFileName, BOARD* aAppendTo
if( !aAppendToMe )
m_board->SetFileName( aFileName );
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
if( m_progressReporter )
{
m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) );
@ -312,6 +316,8 @@ FOOTPRINT* PCB_IO_EASYEDAPRO::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, bool aKeepUUID,
const STRING_UTF8_MAP* aProperties )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
PCB_IO_EASYEDAPRO_PARSER parser( nullptr, nullptr );
FOOTPRINT* footprint = nullptr;

View File

@ -32,6 +32,7 @@
#include <math/util.h> // for KiROUND
#include <board.h>
#include <font/fontconfig.h>
#include <footprint.h>
#include <pad.h>
#include <locale_io.h>
@ -39,6 +40,7 @@
#include <pcb_text.h>
#include <pcb_shape.h>
#include <pcb_io/geda/pcb_io_geda.h>
#include <reporter.h>
#include <wx_filename.h>
#include <wx/dir.h>
@ -933,6 +935,8 @@ FOOTPRINT* PCB_IO_GEDA::FootprintLoad( const wxString& aLibraryPath,
bool aKeepUUID,
const STRING_UTF8_MAP* aProperties )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true );
if( footprint )

View File

@ -22,50 +22,52 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <advanced_config.h>
#include <board.h>
#include <board_design_settings.h>
#include <confirm.h>
#include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
#include <string_utils.h>
#include <kiface_base.h>
#include <locale_io.h>
#include <macros.h>
#include <fmt/core.h>
#include <callback_gal.h>
#include <pad.h>
#include <footprint.h>
#include <pcb_group.h>
#include <pcb_generator.h>
#include <pcb_shape.h>
#include <pcb_dimension.h>
#include <pcb_reference_image.h>
#include <pcb_target.h>
#include <pcb_text.h>
#include <pcb_textbox.h>
#include <pcb_tablecell.h>
#include <pcb_table.h>
#include <pcb_track.h>
#include <zone.h>
#include <pcbnew_settings.h>
#include <pgm_base.h>
#include <io/kicad/kicad_io_utils.h>
#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <trace_helpers.h>
#include <progress_reporter.h>
#include <wildcards_and_files_ext.h>
// base64 code. Needed for PCB_REFERENCE_IMAGE
#define wxUSE_BASE64 1
#include <wx/base64.h>
#include <wx/dir.h>
#include <wx/ffile.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <build_version.h>
// For some reason wxWidgets is built with wxUSE_BASE64 unset so expose the wxWidgets
// base64 code. Needed for PCB_REFERENCE_IMAGE
#define wxUSE_BASE64 1
#include <wx/base64.h>
#include <wx/mstream.h>
#include <advanced_config.h>
#include <board.h>
#include <board_design_settings.h>
#include <callback_gal.h>
#include <confirm.h>
#include <convert_basic_shapes_to_polygon.h> // for enum RECT_CHAMFER_POSITIONS definition
#include <fmt/core.h>
#include <font/fontconfig.h>
#include <footprint.h>
#include <io/kicad/kicad_io_utils.h>
#include <kiface_base.h>
#include <locale_io.h>
#include <macros.h>
#include <pad.h>
#include <pcb_dimension.h>
#include <pcb_generator.h>
#include <pcb_group.h>
#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.h>
#include <pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.h>
#include <pcb_reference_image.h>
#include <pcb_shape.h>
#include <pcb_table.h>
#include <pcb_tablecell.h>
#include <pcb_target.h>
#include <pcb_text.h>
#include <pcb_textbox.h>
#include <pcb_track.h>
#include <pcbnew_settings.h>
#include <pgm_base.h>
#include <progress_reporter.h>
#include <reporter.h>
#include <string_utils.h>
#include <trace_helpers.h>
#include <wildcards_and_files_ext.h>
#include <zone.h>
#include <build_version.h>
#include <filter_reader.h>
@ -2573,6 +2575,8 @@ BOARD* PCB_IO_KICAD_SEXPR::LoadBoard( const wxString& aFileName, BOARD* aAppendT
unsigned lineCount = 0;
fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() );
if( m_progressReporter )
{
m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aFileName ) );
@ -2642,6 +2646,8 @@ void PCB_IO_KICAD_SEXPR::init( const STRING_UTF8_MAP* aProperties )
void PCB_IO_KICAD_SEXPR::validateCache( const wxString& aLibraryPath, bool checkModified )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
if( !m_cache || !m_cache->IsPath( aLibraryPath ) || ( checkModified && m_cache->IsModified() ) )
{
// a spectacular episode in memory management:
@ -2739,6 +2745,8 @@ FOOTPRINT* PCB_IO_KICAD_SEXPR::ImportFootprint( const wxString& aFootprintPath,
wxString fcontents;
wxFFile f( aFootprintPath );
fontconfig::FONTCONFIG::SetReporter( nullptr );
if( !f.IsOpened() )
return nullptr;
@ -2755,6 +2763,8 @@ FOOTPRINT* PCB_IO_KICAD_SEXPR::FootprintLoad( const wxString& aLibraryPath,
bool aKeepUUID,
const STRING_UTF8_MAP* aProperties )
{
fontconfig::FONTCONFIG::SetReporter( nullptr );
const FOOTPRINT* footprint = getFootprint( aLibraryPath, aFootprintName, aProperties, true );
if( footprint )