Author Topic: Embedded font is heavily anti-aliased  (Read 1447 times)

birjolaxew

  • New Member
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Embedded font is heavily anti-aliased
« on: Sun, May 20, 2012 »
Hello there, Flixelers.

Just got started with Flixel a few days ago, and decided to make a small project to get started. For this project I need a list of 13 FlxText (of which I'm only rendering 9, currently) displayed on my settings screen. It works well if I use the build-in Flixel font, but since the game is designed to work at a 4x zoom, it just doesn't look very good. I decided to embed the Silkscreen font, since it looks decent at a high zoom, and is what I designed the interface with. However, here's how it looks after embedding, compared to what it's supposed to look like:


The only other thread with the same problem is from 2009, so I'm hoping a solution has been found since then. Is the problem really specific for certain fonts, and if so, have anyone ever figured out why? Is there any known way to fix this?

The code I use for font embedding can be found below:

Code: [Select]
// Embed the used font.
[Embed(source = "../lib/slkscr.ttf", fontFamily = "Silkscreen", embedAsCFF="false")]
private var _FontSilkScreen:String;

Code: [Select]
// Populate the _textButtons array.
_textButtons = new Array();
for (var i:int = 0; i < settings.length; i++) {
if (i < 9) {
_textButtons[i] = new FlxText(FlxG.width / 2 - 76, 34 + (i * 9), 152, _textName[i]);
_textButtons[i].setFormat("Silkscreen", 8, 0xd9ebd9, "center", 0x475047, 0, 1);
add(_textButtons[i]);
}
}

PRIZZA

  • Member
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Embedded font is heavily anti-aliased
« Reply #1 on: Mon, May 28, 2012 »
As far as I know, Flixel just doesn't play well with certain fonts. I've tried embedding this particular font before but with no avail.

If you would really like to use that font I would just pre-render the text and embed it as a sprite.

initials

  • Contributor
  • ****
  • Posts: 378
  • Karma: +0/-0
  • Initials
    • View Profile
    • Initials Blog. Code and other things.
Re: Embedded font is heavily anti-aliased
« Reply #2 on: Tue, May 29, 2012 »
There is a problem with multi line text and centering the alignment.
The only way I found to solve it was to use left or right align.
Initials: Super Lemonade Factory, Super Lemonade Factory Part Two, Above The Clouds, Revvolvver, Four Chambers of the Human Heart

LaughingLeader

  • Member
  • **
  • Posts: 64
  • Karma: +0/-0
    • View Profile
    • LaughingLeader Blog
Re: Embedded font is heavily anti-aliased
« Reply #3 on: Tue, May 29, 2012 »
There is a problem with multi line text and centering the alignment.
The only way I found to solve it was to use left or right align.

^ This right here. I've had the same problem with anti-aliasing when I have text with a centered alignment that have line breaks(\n), and changing the align to left or right fixed the problem.

Berzee

  • Member
  • **
  • Posts: 69
  • Karma: +0/-0
    • View Profile
Re: Embedded font is heavily anti-aliased
« Reply #4 on: Wed, May 30, 2012 »
The silkscreen page you linked to mentions that silkscreen doesn't work properly in Flash, but I dunno if that's current.

If none of the other suggestions works, try changing the font size in your setFormat. Many pixelly-fonts only work properly at multiples of some number or other, so it may be that 8 is the wrong size (he mentions that the letters are 5x5, so maybe 5 is the necessary size). These are of course random guesses =P