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();
}
try {
GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("A.ttf")));
} catch (IOException|FontFormatException e) {
//Handle exception
}