From a808e2396bdb091929fbd81b70f801eefab01ebe Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 18 Jan 2022 14:19:57 +0000 Subject: [PATCH] Run font/laguage checks only on Mac. --- common/font/fontconfig.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/font/fontconfig.cpp b/common/font/fontconfig.cpp index 9548a3c26d..bfd6c36a3e 100644 --- a/common/font/fontconfig.cpp +++ b/common/font/fontconfig.cpp @@ -133,7 +133,6 @@ void FONTCONFIG::ListFonts( std::vector& 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& aFonts ) std::string theFamily( reinterpret_cast( 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& aFonts ) if( !langSupported ) continue; +#endif std::string theFile( reinterpret_cast( file ) ); std::string theStyle( reinterpret_cast( style ) );