Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show vectorized text using libgdx?

I'm quite a noob with libGDX for Android (nice OpenGL wrapper that can also work on PC), and I've read some nice examples of how to show images and shapes. However, when I wanted to check out how to show text, I noticed that the only thing I could see that this library supports is BitmapFont, which uses a bitmap for each character. It's ok for some resolutions and font sizes, but it becomes blurry/pixelated for other cases.

Is there any other way to show text using this cool library? Some kind of way to show vector fonts, and also use more popular fonts files extensions other than ".fnt"?

like image 703
android developer Avatar asked Mar 10 '12 15:03

android developer


People also ask

What is the use of textarea in libGDX?

I know that the TextArea class in libgdx is used for user input. People use it so that user can input multiple lines of a String. I need something like a TextArea that does the opposite.

What is vectorization of text?

Text Vectorization. Text Vectorization is the process of converting text into numerical representation. Here is some popular methods to accomplish text vectorization: Binary Term Frequency; Bag of Words (BoW) Term Frequency (L1) Normalized Term Frequency (L2) Normalized TF-IDF; Word2Vec

What is a bag-of-words vector?

One of the simplest vectorization methods for text is a bag-of-words (BoW) representation. A BoW vector has the length of the entire vocabulary — that is, the set of unique words in the corpus. The vector’s values represent the frequency with which each word appears in a given text passage:

Is libGDX-FreeType compatible with HTML5?

gdx-freetype is not compatible with HTML5. However, you may use the gdx-freetype-gwt library by Intrigus to enable HTML5 functionality. Version 1.9.10.1 remains compatible with never versions of libGDX, including 1.10.0.


1 Answers

There is a recent entry on the badlogic blog about generating bitmap fonts on the fly from TrueType font files that should address your problems with packaged font files that are ugly when scaled.

When I was new to Android and libGDX I spent some time looking for a vector font solution to draw scalable text via libGDX. I never found anything (not even generic Java or generic Android). Most font solutions I found are built on bitmaps or were very complex rendering systems (that would be hard to adapt to OpenGL). This seems a bit odd to me too, and I haven't found a coherent explanation.

like image 178
P.T. Avatar answered Nov 08 '22 03:11

P.T.