Closed HoneyTorres closed 1 year ago
Hey @HoneyTorres,
It would be possible to add the FreeType (and/or HarfBuzz) libraries to LWJGL, but there just hasn't been any interest for it. stb_truetype offers a simple solution, that's easy to integrate and does a good enough job for most applications.
However, if I needed a state-of-the-art solution for my project, I would certainly be looking into licensing the Slug Library.
Whether it's good enough depends on the language of your users. In fact HarfBuzz is the only layout engine solution in modern times.
It took me some time to get the implementation under sun.font to work directly with bgfx's rendering pipeline.
Using AWT Font directly is inefficient without a lot of retrofitting. Computing layouts can be expensive, although most languages do not require executing scripts to compute layouts. You may need to implement your own layout caching and layout increment calculation. It takes some black magic to avoid the waste of multiple copies from the AWT to the rendering backend.
Using stb makes things easier and is sufficient to solve the problem most of the time, but it is important to note that it is not a perfect solution.
The difference between stb and freetype is that freetype has far more capabilities, it's used by more than a billion devices and supports various edge cases which we will not see on stb(because it was created for simple things). I'll just say that I've managed to link old bindings and it runs much better than stb in my case. https://github.com/mlomb/freetype-jni Maybe it will help.
Hey @NekoCaffeine and @Illithidek,
Thank you for your input! Hard to say when I'll have time for it, but I'll try to prioritize #611 higher.
Question
let me use stb font or java native font?