Run font/laguage checks only on Mac.

This commit is contained in:
Jeff Young 2022-01-18 14:19:57 +00:00
parent 8445783216
commit a808e2396b
1 changed files with 11 additions and 1 deletions

View File

@ -133,7 +133,6 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
FcChar8* family;
FcLangSet* langSet;
FcBool outline;
bool langSupported = false;
if( FcPatternGetString( font, FC_FILE, 0, &file ) == FcResultMatch
&& FcPatternGetString( font, FC_FAMILY, 0, &family ) == FcResultMatch
@ -150,6 +149,16 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
std::string theFamily( reinterpret_cast<char *>( family ) );
#ifdef __WXMAC__
// On Mac (at least) some of the font names are in their own language. If
// the OS doesn't support this language then we get a bunch of garbage names
// in the font menu.
//
// GTK, on the other hand, doesn't appear to support wxLocale::IsAvailable(),
// so we can't run these checks.
bool langSupported = false;
if( !langStr )
{
// Symbol fonts (Wingdings, etc.) have no language
@ -179,6 +188,7 @@ void FONTCONFIG::ListFonts( std::vector<std::string>& aFonts )
if( !langSupported )
continue;
#endif
std::string theFile( reinterpret_cast<char *>( file ) );
std::string theStyle( reinterpret_cast<char *>( style ) );