lwjgl3
lwjgl3 copied to clipboard
Suggestion: Add FreeType Binding
My humble suggestion is to add bindings for FreeType. It is pretty much the industry standard library for font loading/rasterisation and I'd love to be able to use it with LWJGL. To be honest I have little experience with C++/JNI but I might be able to help implement it.
Thanks very much if you could consider this.
@Spasi said that he is looking at STB (which is great because it does fonts, images and also ogg sounds) on the forums. At the same time, a friend of mine is working on a JNI library to Freetype. You can find his repository here: https://github.com/gamingchris3/jfreetype/
The stb bindings have been added. See this post for details.
If you think there's an important font rendering feature that stb does not provide, please reply here.
Thanks for the info. I think stb is what I (and probably many others) require. Shall I close the issue?
The first thing that would spring to my mind is that FreeType would support the OpenType format and stb only supports the TrueType format. But on the other hand FreeType is a huge library.
@Spasi I don't see a way change the font size in the OverSample demo.
Did you try pressing 'S'? If you mean arbitrary zoom in/out like the other two demos, this demo doesn't support it.
@Spasi I mean change the font size directly, like specifying a point size for it to use, like in the previous demo (not Oversample, just TrueType)
Change the values in this array. They are used in PackFontRange
, here.
@Spasi Right, but that gives odd results, and it's questionable how to change that. Why are there two values?
There are two values because there are two font sizes that you can toggle by pressing 'S'. Both sizes are packed in the same texture and the initial texture size is 512x512. It's quite possible that if you increase the font sizes then they won't fit, that's why you might be seeing odd results. Try to increase the font size as well.
Note that I didn't write this demo. It's a Java port of the same demo in the stb repository.
LWJGL 3.2.2-snapshot+8
is now available with FreeType bindings.
Is there an example on how to use it, 'cause it's pretty difficult and I can't get it right