Package com.formdev.flatlaf
Class LinuxFontPolicy
- java.lang.Object
-
- com.formdev.flatlaf.LinuxFontPolicy
-
class LinuxFontPolicy extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description LinuxFontPolicy()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.awt.FontcreateFontEx(java.lang.String family, int style, int size)Create a font for the given family, style and size.private static java.lang.StringgetConfigEntry(java.util.List<java.lang.String> config, java.lang.String group, java.lang.String key)(package private) static java.awt.FontgetFont()private static java.awt.FontgetGnomeFont()Gets the default font for Gnome.private static doublegetGnomeFontScale()private static java.awt.FontgetKDEFont()Gets the default font for KDE from KDE configuration files.private static booleanisSystemScaling()Returns true if the JRE scales, which is the case if: - environment variable GDK_SCALE is set and running on Java 9 or later - running on JetBrains Runtime 11 or later and scaling is enabled in system Settingsprivate static java.lang.StringmapFcName(java.lang.String name)map GTK/fontconfig names to equivalent JDK logical font nameprivate static java.util.List<java.lang.String>readConfig(java.lang.String filename)
-
-
-
Method Detail
-
getFont
static java.awt.Font getFont()
-
getGnomeFont
private static java.awt.Font getGnomeFont()
Gets the default font for Gnome.
-
createFontEx
private static java.awt.Font createFontEx(java.lang.String family, int style, int size)Create a font for the given family, style and size. If the font family does not match any font on the system, then the last word (usually a font weight) from the family name is removed and tried again. E.g. family 'URW Bookman Light' is not found, but 'URW Bookman' is found. If still not found, then font of family 'Dialog' is returned.
-
getGnomeFontScale
private static double getGnomeFontScale()
-
mapFcName
private static java.lang.String mapFcName(java.lang.String name)
map GTK/fontconfig names to equivalent JDK logical font name
-
getKDEFont
private static java.awt.Font getKDEFont()
Gets the default font for KDE from KDE configuration files. The Swing fonts are not updated when the user changes system font size (System Settings > Fonts > Force Font DPI). An application restart is necessary. This is the same behavior as in native KDE applications. The "display scale factor" (kdeglobals: [KScreen] > ScaleFactor) is not used KDE also does not use it to calculate font size. Only forceFontDPI is used by KDE. If user changes "display scale factor" (System Settings > Display and Monitors > Displays > Scale Display), the forceFontDPI is also changed to reflect the scale factor.
-
readConfig
private static java.util.List<java.lang.String> readConfig(java.lang.String filename)
-
getConfigEntry
private static java.lang.String getConfigEntry(java.util.List<java.lang.String> config, java.lang.String group, java.lang.String key)
-
isSystemScaling
private static boolean isSystemScaling()
Returns true if the JRE scales, which is the case if: - environment variable GDK_SCALE is set and running on Java 9 or later - running on JetBrains Runtime 11 or later and scaling is enabled in system Settings
-
-