Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 25, 2013 11:57 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sun May 27, 2012 5:35 pm 
Offline

Joined: Sat Sep 17, 2011 10:38 am
Posts: 16
Hello!

I've been using a plain ol' spritesheet font for a while now, and besides making people's eyes bleed with my subpar monospaced fonts, it's worked pretty well thus far.

However, in an effort to reduce the amount of eye bloodloss, I figured I'd look into AngelCode fonts. I've managed to put together a font that looks ok, but I can't seem to figure out how to disable anti aliasing when drawing. Is it even possible? Is this the case with unicode fonts aswell?

If disabling antialiasing isn't possible, are there any other viable alternatives for drawing non-monospaced fonts?


Top
 Profile  
 
PostPosted: Sun May 27, 2012 5:46 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1469
AngelCodeFont is a "bitmap font" in the sense that the glyphs are just a simple image file; Slick isn't anti-aliasing or doing anything else to the font image while rendering it.

The latest dev branch includes a menu option in Hiero to disable anti-aliasing. Unfortunately, the AWT font renderer is not optimal for small pixel fonts (like this one). The solution is to use TWL's font tool which can handle smaller fonts without anti-aliasing, and save as text format (which will be loadable by Slick).


Top
 Profile  
 
PostPosted: Sun May 27, 2012 6:41 pm 
Offline

Joined: Sat Sep 17, 2011 10:38 am
Posts: 16
Edit: It seems that it's the scaling that's the problem, not the font being anti aliased. I guess my next question then would be: is it possible to scale an AngelCodeFont as easily as a SpriteSheetFont, without it becoming blurry in the process?


Hmm, I'm not sure I understand, or I must be doing something wrong. I've tried making a new font with the fonttool, and the image it produces looks fine; no blurryness in the font image.

Here's how it looks like when being rendered:

Image

I guess it's worth mentioning that everything is scaled 300%, would that affect AngelCodeFonts differently than SpriteSheetFonts? Also, how/where do I fumble around with Hiero settings? Would that affect anything in this case?

Oh, and a sincere thank you for helping me, I really appreciate it.


Top
 Profile  
 
PostPosted: Sun May 27, 2012 7:43 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1469
Ah, the blur there is due to bilinear scaling. :) Try using this when creating your font:
Code:
Image fontImage = new Image("res/font.png", false, Image.FILTER_NEAREST);
new AngelCodeFont("res/font.def", fontImage);


Top
 Profile  
 
PostPosted: Sun May 27, 2012 7:53 pm 
Offline

Joined: Sat Sep 17, 2011 10:38 am
Posts: 16
Oh god, how did I miss that :shock:

Thanks a lot for your help and patience, you've saved the day!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group