mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Windows: fixed rendering of Unicode characters (issue #81)
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 0.30
|
||||
|
||||
- Windows: Fixed rendering of Unicode characters. Previously not all Unicode
|
||||
characters were rendered on Windows. (issue #81)
|
||||
|
||||
|
||||
## 0.29
|
||||
|
||||
- Linux: Fixed scaling if `GDK_SCALE` environment variable is set or if running
|
||||
|
||||
@@ -54,6 +54,7 @@ import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
import javax.swing.plaf.UIResource;
|
||||
import javax.swing.plaf.basic.BasicLookAndFeel;
|
||||
import javax.swing.text.StyleContext;
|
||||
import javax.swing.text.html.HTMLEditorKit;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
@@ -324,7 +325,7 @@ public abstract class FlatLaf
|
||||
if( SystemInfo.IS_WINDOWS ) {
|
||||
Font winFont = (Font) Toolkit.getDefaultToolkit().getDesktopProperty( "win.messagebox.font" );
|
||||
if( winFont != null )
|
||||
uiFont = new FontUIResource( winFont );
|
||||
uiFont = createCompositeFont( winFont.getFamily(), winFont.getStyle(), winFont.getSize() );
|
||||
|
||||
} else if( SystemInfo.IS_MAC ) {
|
||||
String fontName;
|
||||
@@ -335,7 +336,8 @@ public abstract class FlatLaf
|
||||
// default font on older systems (see com.apple.laf.AquaFonts)
|
||||
fontName = "Lucida Grande";
|
||||
}
|
||||
uiFont = new FontUIResource( fontName, Font.PLAIN, 13 );
|
||||
|
||||
uiFont = createCompositeFont( fontName, Font.PLAIN, 13 );
|
||||
|
||||
} else if( SystemInfo.IS_LINUX ) {
|
||||
Font font = LinuxFontPolicy.getFont();
|
||||
@@ -343,7 +345,7 @@ public abstract class FlatLaf
|
||||
}
|
||||
|
||||
if( uiFont == null )
|
||||
return;
|
||||
uiFont = createCompositeFont( Font.SANS_SERIF, Font.PLAIN, 12 );
|
||||
|
||||
uiFont = UIScale.applyCustomScaleFactor( uiFont );
|
||||
|
||||
@@ -365,6 +367,14 @@ public abstract class FlatLaf
|
||||
defaults.put( "defaultFont", uiFont );
|
||||
}
|
||||
|
||||
static FontUIResource createCompositeFont( String family, int style, int size ) {
|
||||
// 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 );
|
||||
return (font instanceof FontUIResource) ? (FontUIResource) font : new FontUIResource( font );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the default color palette for action icons and object icons to the given UIDefaults.
|
||||
* <p>
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.text.StyleContext;
|
||||
import com.formdev.flatlaf.util.StringUtils;
|
||||
import com.formdev.flatlaf.util.SystemInfo;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
@@ -90,9 +89,7 @@ class LinuxFontPolicy
|
||||
}
|
||||
|
||||
private static Font createFont( String family, int style, int size, double dsize ) {
|
||||
// using StyleContext.getFont() here because it uses
|
||||
// sun.font.FontUtilities.getCompositeFontUIResource()
|
||||
Font font = new StyleContext().getFont( family, style, size );
|
||||
Font font = FlatLaf.createCompositeFont( family, style, size );
|
||||
|
||||
// set font size in floating points
|
||||
font = font.deriveFont( style, (float) dsize );
|
||||
|
||||
Reference in New Issue
Block a user