Steve Waters
Steve Waters

Reputation: 3548

LibGDX: How to put gradient color in a FreetypeFont?

I found a great arcade type font. I want to make a simple gradient and a one pixel width border to the font.

I managed to make a gradient from white to grey with a tool called Hiero v3.0. However Hiero saves only .fnt-files and Freetype uses ftt-files for fonts.

I managed to make a border with FreeTypeFont's setBorder-method. There's no method to create a gradient, though.

Is there a way to make a FreetypeFont with a cool gradient AND a border to use in a LibGDX game? If not, any suggestions to this situation are welcome.

Upvotes: 0

Views: 260

Answers (1)

Madmenyo
Madmenyo

Reputation: 8584

I have not worked with FreeTypeFont that much but there is no set way to do what you want that I know off. I think you have to code that for yourself.

I think you are better off using Hiero. You can:

  • Create a large font and scale that down to the proper size depending on the target resolution.
  • Create multiple sizes of your font and pick the one depending on the target resolution.

Sorry, not the answer you wanted. If you really want to work with FreeTypeFont you might get some good tips to get started in the IRC chat where the top contributors often hang out. rc.freenode.net #libgdx. There is a thread on the LibGDX forums as well where RobRendell successfully implemented gradients but it does not compile anymore with newer versions of libGDX.

Upvotes: 1

Related Questions