Class FlatJetBrainsMonoFont
Font home page: https://www.jetbrains.com/mono
GitHub project: https://github.com/JetBrains/JetBrainsMono
To install the font, invoke following once (e.g. in your main()
method; on AWT thread).
For lazy loading use:
FlatJetBrainsMonoFont.installLazy();
Or load immediately with:
FlatJetBrainsMonoFont.install();
Use as application monospaced font (invoke before setting up FlatLaf):
FlatLaf.setPreferredMonospacedFontFamily( FlatJetBrainsMonoFont.FAMILY );
Create single fonts:
new Font( FlatJetBrainsMonoFont.FAMILY, Font.PLAIN, 12 );
new Font( FlatJetBrainsMonoFont.FAMILY, Font.ITALIC, 12 );
new Font( FlatJetBrainsMonoFont.FAMILY, Font.BOLD, 12 );
new Font( FlatJetBrainsMonoFont.FAMILY, Font.BOLD | Font.ITALIC, 12 );
If using lazy loading, invoke following before creating the font:
FontUtils.loadFontFamily( FlatJetBrainsMonoFont.FAMILY );
E.g.:
FontUtils.loadFontFamily( FlatJetBrainsMonoFont.FAMILY );
Font font = new Font( FlatJetBrainsMonoFont.FAMILY, Font.PLAIN, 12 );
Or use following:
Font font = FontUtils.getCompositeFont( FlatJetBrainsMonoFont.FAMILY, Font.PLAIN, 12 );
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Family name for basic styles (regular, italic and bold).static final String
Use forinstallStyle(String)
to install single font styles.static final String
Use forinstallStyle(String)
to install single font styles.static final String
Use forinstallStyle(String)
to install single font styles.static final String
Use forinstallStyle(String)
to install single font styles. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
install()
Creates and registers the fonts for all styles.static void
Registers the fonts for lazy loading viaFontUtils.registerFontFamilyLoader(String, Runnable)
.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( FlatJetBrainsMonoFont.FAMILY, Font.PLAIN, 12 ); new Font( FlatJetBrainsMonoFont.FAMILY, Font.ITALIC, 12 ); new Font( FlatJetBrainsMonoFont.FAMILY, Font.BOLD, 12 ); new Font( FlatJetBrainsMonoFont.FAMILY, Font.BOLD | Font.ITALIC, 12 );
- See Also:
-
STYLE_REGULAR
Use forinstallStyle(String)
to install single font styles.- See Also:
-
STYLE_ITALIC
Use forinstallStyle(String)
to install single font styles.- See Also:
-
STYLE_BOLD
Use forinstallStyle(String)
to install single font styles.- See Also:
-
STYLE_BOLD_ITALIC
Use forinstallStyle(String)
to install single font styles.- See Also:
-
-
Constructor Details
-
FlatJetBrainsMonoFont
private FlatJetBrainsMonoFont()
-
-
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()
. -
installStyle
Creates and registers the font for the given style. SeeSTYLE_
constants.
-