How do I import a font into a Java applet with AWT? I don't want a solution in Swing, so don't bother if that's your advice, thanks.
I know I would have to have the TTF file but then I don't know how to make my applet use the file for my text.
How do I import a font into a Java applet with AWT? I don't want a solution in Swing, so don't bother if that's your advice, thanks.
I know I would have to have the TTF file but then I don't know how to make my applet use the file for my text.
Font#createFont(int, InputStream)
. You can use it directly, but it's better if...GraphicsEnvironment#registerFont
As mentioned:
Updated...
In order to be able to use a Font
within a Applet
context, you the Font
file will need to be included within your applets Jar file.
You will then need to use something like...
InputStream is = getClass().getResourceAsStream("/path/to/font file");
Where the path is relative to your class files.
You would then use this to load the Font