From 11c61649343e8942a012c3de6c442542515db5fb Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 20 Jun 2024 15:33:03 -0700 Subject: [PATCH] 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 --- common/font/fontconfig.cpp | 16 ++++- eeschema/sch_io/altium/sch_io_altium.cpp | 7 +++ .../sch_io/cadstar/sch_io_cadstar_archive.cpp | 7 +++ eeschema/sch_io/eagle/sch_io_eagle.cpp | 21 ++++--- eeschema/sch_io/easyeda/sch_io_easyeda.cpp | 16 +++-- .../sch_io/easyedapro/sch_io_easyedapro.cpp | 4 ++ .../sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp | 48 ++++++++------- include/font/fontconfig.h | 9 +++ pcbnew/kicad_clipboard.cpp | 3 + .../altium/pcb_io_altium_circuit_maker.cpp | 4 ++ .../altium/pcb_io_altium_circuit_studio.cpp | 5 ++ .../pcb_io/altium/pcb_io_altium_designer.cpp | 6 ++ pcbnew/pcb_io/altium/pcb_io_solidworks.cpp | 3 + .../pcb_io/cadstar/pcb_io_cadstar_archive.cpp | 6 ++ pcbnew/pcb_io/eagle/pcb_io_eagle.cpp | 6 ++ .../pcb_io/easyeda/pcb_io_easyeda_plugin.cpp | 6 ++ .../pcb_io/easyedapro/pcb_io_easyedapro.cpp | 6 ++ pcbnew/pcb_io/geda/pcb_io_geda.cpp | 4 ++ .../pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp | 58 +++++++++++-------- 19 files changed, 177 insertions(+), 58 deletions(-) diff --git a/common/font/fontconfig.cpp b/common/font/fontconfig.cpp index 67f71d2d9c..8d3a0b6b2b 100644 --- a/common/font/fontconfig.cpp +++ b/common/font/fontconfig.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #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 ); diff --git a/eeschema/sch_io/altium/sch_io_altium.cpp b/eeschema/sch_io/altium/sch_io_altium.cpp index 8f57efcf2a..19b01a4215 100644 --- a/eeschema/sch_io/altium/sch_io_altium.cpp +++ b/eeschema/sch_io/altium/sch_io_altium.cpp @@ -53,6 +53,7 @@ #include #include +#include #include #include #include @@ -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 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*/ ); diff --git a/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp b/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp index df0da6a2d6..4e0772e5e1 100644 --- a/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp +++ b/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -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" ) ); diff --git a/eeschema/sch_io/eagle/sch_io_eagle.cpp b/eeschema/sch_io/eagle/sch_io_eagle.cpp index 9f80d60840..a87d0f56cf 100644 --- a/eeschema/sch_io/eagle/sch_io_eagle.cpp +++ b/eeschema/sch_io/eagle/sch_io_eagle.cpp @@ -36,29 +36,30 @@ #include #include +#include #include -#include #include +#include #include +#include #include #include -#include -#include #include -#include #include +#include +#include #include -#include #include +#include #include #include #include #include -#include +#include #include +#include #include #include -#include // 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*/ ); diff --git a/eeschema/sch_io/easyeda/sch_io_easyeda.cpp b/eeschema/sch_io/easyeda/sch_io_easyeda.cpp index 9fd3931c34..dc7430518f 100644 --- a/eeschema/sch_io/easyeda/sch_io_easyeda.cpp +++ b/eeschema/sch_io/easyeda/sch_io_easyeda.cpp @@ -25,14 +25,14 @@ #include "sch_easyeda_parser.h" #include "sch_io_easyeda.h" -#include -#include -#include +#include #include #include -#include +#include +#include +#include #include - +#include #include #include #include @@ -309,6 +309,9 @@ void SCH_IO_EASYEDA::EnumerateSymbolLib( wxArrayString& aSymbolNameList, { std::map 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 ) diff --git a/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp b/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp index aa1f6485fd..acec22e3c5 100644 --- a/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp +++ b/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp @@ -25,6 +25,7 @@ #include "sch_easyedapro_parser.h" #include "sch_io_easyedapro.h" +#include #include #include #include @@ -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 ) diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp index 819cb2cae2..f8e8251777 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp @@ -28,41 +28,43 @@ #include #include #include +#include + #include #include #include -#include +#include +#include +#include #include +#include +#include +#include #include #include -#include #include // SYMBOL_ORIENTATION_T +#include +#include +#include +#include #include #include -#include -#include #include +#include #include -#include -#include -#include -#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include // for PropPowerSymsOnly definition. -#include +#include +#include +#include +#include +#include #include +#include // for PropPowerSymsOnly definition. +#include #include // for ::ResolvePossibleSymlinks() -#include -#include 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& 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: diff --git a/include/font/fontconfig.h b/include/font/fontconfig.h index 6f12bdb4e8..9ad5514749 100644 --- a/include/font/fontconfig.h +++ b/include/font/fontconfig.h @@ -30,6 +30,7 @@ #include #include +class REPORTER; namespace fontconfig { @@ -67,9 +68,17 @@ public: */ void ListFonts( std::vector& 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 m_fontInfoCache; wxString m_fontCacheLastLang; + static REPORTER* s_reporter; /** * Matches the two rfc 3306 language entries, used for when searching for matching family names diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 5d24f4a623..13edb40cf6 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -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 ); diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp index 3963ee3322..56f2b3afab 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_maker.cpp @@ -28,11 +28,13 @@ #include +#include #include #include #include #include #include +#include #include @@ -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 ); diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp index 1958f6b4c4..61c5cd3b2b 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_altium_circuit_studio.cpp @@ -28,11 +28,14 @@ #include +#include + #include #include #include #include #include +#include #include @@ -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 ); diff --git a/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp b/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp index c001e5b96a..5838c67568 100644 --- a/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_altium_designer.cpp @@ -28,6 +28,7 @@ #include +#include #include #include #include @@ -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 ); diff --git a/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp b/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp index 2bb9640879..cbeb88e50a 100644 --- a/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp +++ b/pcbnew/pcb_io/altium/pcb_io_solidworks.cpp @@ -19,6 +19,7 @@ #include +#include #include #include #include @@ -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 ); diff --git a/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp b/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp index 29ca2acc36..1857f2ca8b 100644 --- a/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp +++ b/pcbnew/pcb_io/cadstar/pcb_io_cadstar_archive.cpp @@ -24,12 +24,14 @@ */ #include +#include #include #include #include #include #include #include +#include std::map 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*/ ); diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp index 210693def4..ded24c82e7 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp +++ b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp @@ -61,6 +61,7 @@ Load() TODO's #include #include +#include #include #include #include @@ -77,6 +78,7 @@ Load() TODO's #include #include #include +#include #include #include @@ -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 ); diff --git a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp index d74c2ead74..fbd2167cd9 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp @@ -27,12 +27,14 @@ #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -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(); diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp index c8a778a80b..bad27567eb 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro.cpp @@ -29,10 +29,12 @@ #include #include +#include #include #include #include #include +#include #include #include @@ -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; diff --git a/pcbnew/pcb_io/geda/pcb_io_geda.cpp b/pcbnew/pcb_io/geda/pcb_io_geda.cpp index 0cf71a09db..a8d2d9ba1c 100644 --- a/pcbnew/pcb_io/geda/pcb_io_geda.cpp +++ b/pcbnew/pcb_io/geda/pcb_io_geda.cpp @@ -32,6 +32,7 @@ #include // for KiROUND #include +#include #include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #include #include @@ -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 ) diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp index 90bdfe68a9..d198b48a00 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -22,50 +22,52 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +// base64 code. Needed for PCB_REFERENCE_IMAGE +#define wxUSE_BASE64 1 +#include +#include +#include +#include +#include +#include + #include #include #include +#include #include #include // for enum RECT_CHAMFER_POSITIONS definition -#include +#include +#include +#include +#include #include #include #include -#include -#include #include -#include -#include -#include -#include #include +#include +#include +#include +#include #include +#include +#include +#include #include #include #include -#include -#include #include -#include #include #include -#include -#include -#include -#include #include +#include +#include +#include #include -#include -#include -#include -#include -#include +#include -// 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 -#include +#include #include @@ -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 )