Package romanemperorsscraper.ui
Class FontUtils
- java.lang.Object
-
- romanemperorsscraper.ui.FontUtils
-
public class FontUtils extends java.lang.Object
Utility class used to import True Type Fonts (.ttf ones) from files and subsequently obtain them as Font objects ready to be used in text styling- Author:
- Matteo Collica
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.HashMap<java.lang.String,java.awt.Font>
importedFonts
-
Constructor Summary
Constructors Modifier Constructor Description private
FontUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.Font
getFont(java.lang.String fontFileName, int fontStyle, float fontSize)
Given a True Type Font placed in the fonts/ directory's file name, a font style and the font size, if there are no imported fonts yet import them, then get the specified font's Font object already derived to be in the given style and size.static void
importFonts()
Import some specific fonts located in the fonts/directory and update the importedFonts HashMap adding the font file name as key and the file object as value
-
-
-
Method Detail
-
getFont
public static java.awt.Font getFont(java.lang.String fontFileName, int fontStyle, float fontSize)
Given a True Type Font placed in the fonts/ directory's file name, a font style and the font size, if there are no imported fonts yet import them, then get the specified font's Font object already derived to be in the given style and size.- Parameters:
fontFileName
- the font's file name in the fonts/ directoryfontStyle
- the font's desired style (like Font.PLAIN or Font.BOLD)fontSize
- the font's desired size
-
importFonts
public static void importFonts()
Import some specific fonts located in the fonts/directory and update the importedFonts HashMap adding the font file name as key and the file object as value
-
-