I haven't seen another solution to this problem, so I'll leave mine here. I've spent far too much time finding it, so I hope it will help some of you!
BurstFont is the font you are going to use.
the import lines are:
File f = new File("file.ttf");
try {
FileInputStream in = new FileInputStream(f);
Font dynamicFont, dynamicFont32;
dynamicFont = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(f));
dynamicFont32 = dynamicFont.deriveFont(32f);
java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont(dynamicFont32);
greenfoot.Font BurstFont = new greenfoot.Font(dynamicFont32.getName(), dynamicFont32.getStyle() % 2 == 1, dynamicFont32.getStyle() / 2 == 1, dynamicFont32.getSize());
in.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (FontFormatException e) {
e.printStackTrace();
}import greenfoot.*; import java.awt.Font; import java.awt.FontFormatException; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException;
