Class FlatInterFont
Note: This font does not work correctly in older Java 8 versions (before 8u212) and in Java 9 because it is displayed way too large.
Font home page: https://rsms.me/inter/
GitHub project: https://github.com/rsms/inter
To install the font, invoke following once (e.g. in your main()
method; on AWT thread).
For lazy loading use:
FlatInterFont.installLazy();
Or load immediately with:
FlatInterFont.install();
// or
FlatInterFont.installBasic();
FlatInterFont.installLight();
FlatInterFont.installSemiBold();
Use as application font (invoke before setting up FlatLaf):
FlatLaf.setPreferredFontFamily( FlatInterFont.FAMILY );
FlatLaf.setPreferredLightFontFamily( FlatInterFont.FAMILY_LIGHT );
FlatLaf.setPreferredSemiboldFontFamily( FlatInterFont.FAMILY_SEMIBOLD );
Create single fonts:
new Font( FlatInterFont.FAMILY, Font.PLAIN, 12 );
new Font( FlatInterFont.FAMILY, Font.ITALIC, 12 );
new Font( FlatInterFont.FAMILY, Font.BOLD, 12 );
new Font( FlatInterFont.FAMILY, Font.BOLD | Font.ITALIC, 12 );
new Font( FlatInterFont.FAMILY_LIGHT, Font.PLAIN, 12 );
new Font( FlatInterFont.FAMILY_LIGHT, Font.ITALIC, 12 );
new Font( FlatInterFont.FAMILY_SEMIBOLD, Font.PLAIN, 12 );
new Font( FlatInterFont.FAMILY_SEMIBOLD, Font.ITALIC, 12 );
If using lazy loading, invoke one of following before creating the font:
FontUtils.loadFontFamily( FlatInterFont.FAMILY );
FontUtils.loadFontFamily( FlatInterFont.FAMILY_LIGHT );
FontUtils.loadFontFamily( FlatInterFont.FAMILY_SEMIBOLD );
E.g.:
FontUtils.loadFontFamily( FlatInterFont.FAMILY );
Font font = new Font( FlatInterFont.FAMILY, Font.PLAIN, 12 );
Or use following:
Font font = FontUtils.getCompositeFont( FlatInterFont.FAMILY, Font.PLAIN, 12 );
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Family name for basic styles (regular, italic and bold).static final String
Family name for light styles.static final String
Family name for semibold styles.static final String
Use forinstallStyle(String)
to install single font style.static final String
Use forinstallStyle(String)
to install single font style.static final String
Use forinstallStyle(String)
to install single font style.static final String
Use forinstallStyle(String)
to install single font style.static final String
Use forinstallStyle(String)
to install single font style.static final String
Use forinstallStyle(String)
to install single font style.static final String
Use forinstallStyle(String)
to install single font style.static final String
Use forinstallStyle(String)
to install single font style. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
install()
Creates and registers the fonts for all styles.static void
Creates and registers the fonts for basic styles (regular, italic and bold).static void
Registers the fonts for lazy loading viaFontUtils.registerFontFamilyLoader(String, Runnable)
.static void
Creates and registers the fonts for light styles.static void
Creates and registers the fonts for semibold styles.static boolean
installStyle
(String name) Creates and registers the font for the given style.
-
Field Details
-
FAMILY
Family name for basic styles (regular, italic and bold).Usage:
new Font( FlatInterFont.FAMILY, Font.PLAIN, 12 ); new Font( FlatInterFont.FAMILY, Font.ITALIC, 12 ); new Font( FlatInterFont.FAMILY, Font.BOLD, 12 ); new Font( FlatInterFont.FAMILY, Font.BOLD | Font.ITALIC, 12 );
- See Also:
-
FAMILY_LIGHT
Family name for light styles.Usage:
new Font( FlatInterFont.FAMILY_LIGHT, Font.PLAIN, 12 ); new Font( FlatInterFont.FAMILY_LIGHT, Font.ITALIC, 12 );
- See Also:
-
FAMILY_SEMIBOLD
Family name for semibold styles.Usage:
new Font( FlatInterFont.FAMILY_SEMIBOLD, Font.PLAIN, 12 ); new Font( FlatInterFont.FAMILY_SEMIBOLD, Font.ITALIC, 12 );
- See Also:
-
STYLE_REGULAR
Use forinstallStyle(String)
to install single font style.- See Also:
-
STYLE_ITALIC
Use forinstallStyle(String)
to install single font style.- See Also:
-
STYLE_BOLD
Use forinstallStyle(String)
to install single font style.- See Also:
-
STYLE_BOLD_ITALIC
Use forinstallStyle(String)
to install single font style.- See Also:
-
STYLE_LIGHT
Use forinstallStyle(String)
to install single font style.- See Also:
-
STYLE_LIGHT_ITALIC
Use forinstallStyle(String)
to install single font style.- See Also:
-
STYLE_SEMIBOLD
Use forinstallStyle(String)
to install single font style.- See Also:
-
STYLE_SEMIBOLD_ITALIC
Use forinstallStyle(String)
to install single font style.- See Also:
-
-
Constructor Details
-
FlatInterFont
private FlatInterFont()
-
-
Method Details
-
installLazy
public static void installLazy()Registers the fonts for lazy loading viaFontUtils.registerFontFamilyLoader(String, Runnable)
.This is the preferred method (when using FlatLaf) to avoid unnecessary loading of maybe unused fonts.
Note: When using '
new Font(...)
', you need to first invokeFontUtils.loadFontFamily(String)
to ensure that the font family is loaded. When FlatLaf loads a font, or when usingFontUtils.getCompositeFont(String, int, int)
, this is done automatically. -
install
public static void install()Creates and registers the fonts for all styles.When using FlatLaf, consider using
installLazy()
. -
installBasic
public static void installBasic()Creates and registers the fonts for basic styles (regular, italic and bold).When using FlatLaf, consider using
installLazy()
. -
installLight
public static void installLight()Creates and registers the fonts for light styles.When using FlatLaf, consider using
installLazy()
. -
installSemiBold
public static void installSemiBold()Creates and registers the fonts for semibold styles.When using FlatLaf, consider using
installLazy()
. -
installStyle
Creates and registers the font for the given style. SeeSTYLE_
constants.
-