LWJGL Forum

Please login or register.

Login with username, password and session length

Author Topic: Bold .ttf font with slick-util  (Read 6241 times)

Aichi

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
Bold .ttf font with slick-util
« on: November 10, 2011, 20:42:22 »

Hey,
I'm trying to display a bold .ttf font with slick-util. Using Font.BOLD at Font.createFont is not possible with my seperate .ttf font, it's only possible on build-in fonts.
I need a bold version of my font to display text with outline.
So is it possible to display bold texts with seperate .ttf fonts using slick-util
or create a second pre-bold font with a font editing tool?
Logged

CodeBunny

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 562
Re: Bold .ttf font with slick-util
« Reply #1 on: November 13, 2011, 13:55:33 »

When you want fonts in games, it's definitely a good idea to not use .ttf fonts. They have to do an incredible amount of extra processing to be converted into images, and it wastes a significant amount of time.

Use this: http://www.angelcode.com/products/bmfont/

It lets you convert a .ttf font into a bitmap font beforehand. They are much, much faster to load. Additionally, you can edit the font image in GIMP or somesuch and have a more intricate look. (Ex: applying grain, edging, glow, blur, etc.)

There is an AngelCodeFont class in Slick2D that loads and uses the fonts generated by the font generator.
Logged

Aichi

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
Re: Bold .ttf font with slick-util
« Reply #2 on: November 14, 2011, 13:06:04 »

Thank you. :)
Does AngelCodeFont also exist as a standalone class?
I prefer to not use Slick2D.
Logged

CodeBunny

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 562
Re: Bold .ttf font with slick-util
« Reply #3 on: November 14, 2011, 19:21:43 »

I think it's marginally integrated with Slick, but that's not too difficult to change. What you should do is take the source code and convert it into a standalone class for your own personal use. It'll help you understand the code better, and it's not too much work (I've done the same thing before, but I integrated it with my existing code base so it's slightly different).
Logged

Aichi

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
Re: Bold .ttf font with slick-util
« Reply #4 on: November 14, 2011, 21:29:36 »

Ok, I decided to use the Slick2D engine now. It's probably the best way I can create Java games with.
I didn't want to use Slick2D firstly because it seems to be no longer in developement, secondly because I thought
that engine would be not fast enough for me (but it's actually extremly fast) and thirdly because I have to live with
some features I miss (sprite rotation and clipping for example). I don't know how grave the last point will be atm.
Logged