Ubuntu Linux: fixed poorly rendered font (2nd attempt) (issue #105)

This commit is contained in:
Karl Tauber
2020-05-23 11:06:24 +02:00
parent c7a8d1e1b7
commit c4c6faa943
3 changed files with 11 additions and 7 deletions

View File

@@ -419,7 +419,7 @@ public abstract class FlatLaf
// using StyleContext.getFont() here because it uses
// sun.font.FontUtilities.getCompositeFontUIResource()
// and creates a composite font that is able to display all Unicode characters
Font font = new StyleContext().getFont( family, style, size );
Font font = StyleContext.getDefaultStyleContext().getFont( family, style, size );
return (font instanceof FontUIResource) ? (FontUIResource) font : new FontUIResource( font );
}

View File

@@ -75,9 +75,11 @@ class LinuxFontPolicy
}
// Ubuntu font is rendered poorly (except if running in JetBrains VM)
// --> use default Java font
if( family.startsWith( "Ubuntu" ) && !SystemInfo.IS_JETBRAINS_JVM )
family = "sans";
// --> use Liberation Sans font
if( family.startsWith( "Ubuntu" ) &&
!SystemInfo.IS_JETBRAINS_JVM &&
!Boolean.parseBoolean( System.getProperty( "flatlaf.useUbuntuFont" ) ) )
family = "Liberation Sans";
// scale font size
double dsize = size * getGnomeFontScale();