Reply – Re: Text without AWT?
Your Name
or Cancel
In Reply To
Re: Text without AWT?
— by Xerxes Rånby Xerxes Rånby
adi wrote
I have seen it. But there are only two fonts therein, JAVA and UBUNTU.
To load a custom Font you simply need to know where you have your true type .ttf files stored, in a jar or on disk, and then implement your own FontSet.
Indeed the JogAmp JOGL source tree contains only two FontSet's however you can look at the source code to load your own font!

You may also use FontFactory.get to load a Font from a InputStream that supports random-access.
Font f= FontFactory.get ( stream /*InputStream*/, true /* close stream */) ;
or use FontFactory to load a Font from a File
Font f= FontFactory.get ( file /*File*/) ;

Example on my Linux system I can use:
font = FontFactory.get(new File("/usr/share/fonts/truetype/freefont/FreeMono.ttf"));

adi wrote
And why is 'weight' used with volatile?
In the original junit demo  weight was changed at runtime from keyboard input that is running on a differnt thread compared to rendering.
It is volatile as a leftover from the junit test demo code when i flattened it into only one class.