Is there a reason why I shouldn't use AWT?

Started by asyx, August 31, 2016, 23:54:21

Previous topic - Next topic

asyx

Hi!

So, LWJGL 3 includes STB stuff which provides a TTF library. However, a good amount of fonts (especially for east Asian languages) are not in the TTF format because it makes it impossible to provide a font for one script that is localised (this is also an issue with Cyrillic). So instead, those fonts come in the OTF format which can deal with han unification and such things.

But STB_TrueType, of course, doesn't provide OTF support. Since I can't find good FreeType bindings, AWT is the easiest option.

Is there a reason why I shouldn't use the AWT Font class? Nothing else depends on AWT in LWJGL and, generally, in C++, it's suggested to turn exceptions off, for example. But I'm not sure if not using AWT actually has any runtime benefit like disabling exception checking in C++ does.

Thanks.

Cornix

If you use AWT with LWJGL3 you can not deploy your application on Mac as far as I know. This has to do with how the Mac works and there is not much that the LWJGL team can do about it.
Besides that AWT is quite a big library, perhaps you dont like to have to load it all just for fonts. But perhaps you have no problem with that.

kappa

As long as you don't create any windows using AWT, you can use most of AWT with LWJGL3 by running it in headless mode. I've been able to use AWT's font classes with LWJGL3 without issue (including loading OTF files).

Just remember to set AWT to headless mode by passing the following VM parameter to it: -Djava.awt.headless=true

If you don't the JVM may freeze as soon as you touch AWT code.