Skip to content

How to load font in Java?

try {
  
    Font font = Font.createFont(Font.TRUETYPE_FONT,
                                new File("./Fonts/AyyBoyyy.ttf"));
    Font bold = font.deriveFont(Font.BOLD, 12);
	Font plain = font.deriveFont(Font.PLAIN, 12);
  
} catch (FontFormatException | IOException e) {
  e.printStackTrace();
}
See also  CSS code snippet - How to add background image in a container ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.