7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 09:40:09 +00:00

Avoid throwing a spurious substitution warnings

If the original font is a bold singleton (not a mod on a face), then we
need to avoid the mismatch between the bold marker and the asked-for
boldness.

At the end, if the font name is the same within case differences, then
it is the same font and we should not warn
This commit is contained in:
Seth Hillbrand 2024-07-16 09:28:07 -07:00
parent aa01eebac4
commit 0f84ddaf39

View File

@ -206,6 +206,17 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString& aFontName, wxString&
if( !g_fcInitSuccess )
return retval;
// If the original font name contains any of these, then it is bold, regardless
// of whether we are looking for bold or not
if( aFontName.Lower().Contains( wxS( "bold" ) ) // also catches ultrabold
|| aFontName.Lower().Contains( wxS( "heavy" ) )
|| aFontName.Lower().Contains( wxS( "black" ) ) // also catches extrablack
|| aFontName.Lower().Contains( wxS( "thick" ) )
|| aFontName.Lower().Contains( wxS( "dark" ) ) )
{
aBold = true;
}
FcConfig* config = FcConfigGetCurrent();
if( aEmbeddedFiles )
@ -345,7 +356,10 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString& aFontName, wxString&
{
fontName.Replace( ':', ' ' );
if( s_reporter )
// If we missed a case but the matching found the original font name, then we are not substituting
if( fontName.CmpNoCase( qualifiedFontName ) == 0 )
retval = FF_RESULT::FF_OK;
else if( s_reporter )
s_reporter->Report( wxString::Format( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName ) );
}