Hi all,
I want to load a Font from a .tff file, so I can draw text on a GreenfootImage with another font.
I tried some things, but I can't seem to get it working.
Can anybody help? Thanks.
Font font = new Font("q",0,0);
InputStream is = Glo.class.getResourceAsStream("resources/Vdj.ttf");//location in project folder
Font uniFont = null;
try {
uniFont=Font.createFont(Font.TRUETYPE_FONT,is);
}
catch(java.awt.FontFormatException r){
System.err.println("FontFormatException: " + r.getMessage());
}
catch(java.io.IOException r){
System.err.println("FontFormatException: " + r.getMessage());
}
font = uniFont.deriveFont(24f);//desired font sizeURL url = new URL(getCodeBase(), "resources/Vdj.ttf");