Package org.fife.ui.rtextarea
Class FontUtil
java.lang.Object
org.fife.ui.rtextarea.FontUtil
Utility methods related to fonts.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FontcreateFont(String family, int style, int size) Creates and returns a font with a default fallback font configured.static FontderiveFont(Font baseFont, String newFamily) Returns a new font with all properties the same as a base font, but with a new font family.static FontderiveFont(Font baseFont, String newFamily, Integer newStyle, Number newSize) Returns a new font with all properties the same as a base font, but with optional changes.static FontReturns the default monospaced font for this operating system.
-
Method Details
-
createFont
Creates and returns a font with a default fallback font configured.- Parameters:
family- The font family.style- The font style.size- The font size.- Returns:
- The font.
-
deriveFont
Returns a new font with all properties the same as a base font, but with a new font family. This saves a few lines of code around creating aMap, since deriving a font with a new family can be tricky to do while avoiding overwriting all otherTextAttributes.- Parameters:
baseFont- The font to start with.newFamily- The new font family, ornullfor no change.- Returns:
- The new font.
- See Also:
-
deriveFont
Returns a new font with all properties the same as a base font, but with optional changes. This saves a few lines of code around creating aMap, since deriving a font with a new family can be tricky to do while avoiding overwriting all otherTextAttributes.- Parameters:
baseFont- The font to start with.newFamily- The new font family, ornullfor no change.newStyle- The new font style, ornullfor no change.newSize- The new font size, ornullfor no change.- Returns:
- The new font.
- See Also:
-
getDefaultMonospacedFont
Returns the default monospaced font for this operating system.- Returns:
- The default font.
-