lwjgl3 icon indicating copy to clipboard operation
lwjgl3 copied to clipboard

Suggestion: Add FreeType Binding

Open neon64 opened this issue 9 years ago • 10 comments

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.

neon64 avatar May 02 '15 08:05 neon64

@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/

sriharshachilakapati avatar May 02 '15 12:05 sriharshachilakapati

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.

Spasi avatar May 25 '15 11:05 Spasi

Thanks for the info. I think stb is what I (and probably many others) require. Shall I close the issue?

neon64 avatar May 25 '15 12:05 neon64

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.

SilverTiger avatar May 25 '15 12:05 SilverTiger

@Spasi I don't see a way change the font size in the OverSample demo.

Tetramputechture avatar Jul 31 '15 19:07 Tetramputechture

Did you try pressing 'S'? If you mean arbitrary zoom in/out like the other two demos, this demo doesn't support it.

Spasi avatar Jul 31 '15 19:07 Spasi

@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)

Tetramputechture avatar Jul 31 '15 20:07 Tetramputechture

Change the values in this array. They are used in PackFontRange, here.

Spasi avatar Jul 31 '15 21:07 Spasi

@Spasi Right, but that gives odd results, and it's questionable how to change that. Why are there two values?

Tetramputechture avatar Jul 31 '15 23:07 Tetramputechture

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.

Spasi avatar Aug 01 '15 07:08 Spasi

LWJGL 3.2.2-snapshot+8 is now available with FreeType bindings.

Spasi avatar Dec 18 '22 08:12 Spasi

Is there an example on how to use it, 'cause it's pretty difficult and I can't get it right

palexdev avatar Nov 15 '23 14:11 palexdev