Typography:

- fixed semibold font on Ubuntu
- use font "Montserrat SemiBold" on Fedora

(PR #396)
This commit is contained in:
Karl Tauber
2021-11-24 10:37:48 +01:00
parent 64c7318cfc
commit 7c99872278
3 changed files with 14 additions and 3 deletions

View File

@@ -1324,9 +1324,19 @@ public abstract class FlatLaf
}
// derive font
if( newStyle != baseStyle || newSize != baseSize )
if( newStyle != baseStyle || newSize != baseSize ) {
// hack for font "Ubuntu Medium" on Linux, which curiously belongs
// to family "Ubuntu Light" and using deriveFont() would create a light font
if( "Ubuntu Medium".equalsIgnoreCase( baseFont.getName() ) &&
"Ubuntu Light".equalsIgnoreCase( baseFont.getFamily() ) )
{
Font font = createCompositeFont( "Ubuntu Medium", newStyle, newSize );
if( !isFallbackFont( font ) )
return toUIResource( font );
}
return toUIResource( baseFont.deriveFont( newStyle, newSize ) );
else
} else
return toUIResource( baseFont );
}

View File

@@ -58,7 +58,7 @@ mini.font = -3
[mac]semibold.font = "HelveticaNeue-Medium"
# Linux
[linux]light.font = "Lato Light", "Ubuntu Light", "Cantarell Light"
[linux]semibold.font = "Lato Semibold", "Ubuntu Medium"
[linux]semibold.font = "Lato Semibold", "Ubuntu Medium", "Montserrat SemiBold"
# fallback for unknown platform
light.font = +0
semibold.font = +0

View File

@@ -86,6 +86,7 @@ public class FlatFontsTest
for( Map.Entry<String, Font> e : info.fonts.entrySet() ) {
JLabel label = new JLabel( e.getKey() );
label.setFont( e.getValue().deriveFont( (float) UIScale.scale( 36 ) ) );
label.setToolTipText( e.getValue().toString() );
previewPanel.add( label, "wrap" );
}