How to show vector text with libgdx?

I am pretty noob with libGDX for Android (a good OpenGL shell that can also work on PCs) and I read some good examples on how to display images and shapes. However, when I wanted to check how to display the text, I noticed that the only thing I saw that this library supports is BitmapFont , which uses a bitmap for each character. This is normal for some resolutions and font sizes, but it becomes blurry / pixel for other cases.

Is there any other way to display text using this cool library? Some way to show vector fonts, as well as use more popular font extensions other than ".fnt"?

+6
source share
2 answers

The recent blog entry on badlogic blogging about generating bitmap fonts on the fly from TrueType font files that should solve your problems with font-packed files that are ugly to scale.

When I was new to Android and libGDX, I spent some time looking for a vector font solution for drawing scalable text through libGDX. I never found anything (not even shared Java or shared Android). Most font solutions that I found were built on bitmap images or were very complex rendering systems (which would be difficult to adapt to OpenGL). This is also a little strange for me, and I did not find a consistent explanation.

+4
source

I don’t think there are the right ways to do this, because libgdx also works in openGL. OpenGL uses textures to display images so that your device can speed up drawing images. I do not use libgdx, but perhaps you can write your own function to draw your vector patterns on the texture first, and then draw the texture on the screen. β†’ But then he is no longer vectorized.

0
source

Source: https://habr.com/ru/post/910404/


All Articles