Pixel Perfect Font Problem


I’m trying to get pixel fonts working and I’m having some problems. I’m using egg-mkfont do make the .egg but I have some questions, starting by what command should I run…

I think the basic is:

egg-mkfont -noaa -sf 1 -o thefont.egg thefont.ttf

So, let’s say I wanna tf_tempesta_seven.ttf font.
In Gimp, if I put size 8, and set aa off, I get a nice pixelated font.
I tried to set the ps to 8 but I think I should not. This is the closest I could get with this font:

egg-mkfont -noaa -sf 1 -o thefont.egg thefont.ttf -ppu 8

But then I get some blurriness in some words (maybe is the same problem treeform was getting in this thread)

I already tried with other fonts, such visitor and profont and sometimes I get blurriness sometimes not: (with profont:)

#This line gives blurriness
tn.setText("enemy enemy enemy enemy enemy You can't jump from an enemy zone to an enemy zone\nYOU SIMPLY CAN'T!")

#This line doesn't
tn.setText("enemy enemy enemy enemy You can't jump from an enemy zone to an enemy zone\nYOU SIMPLY CAN'T!")

Any ideas?

Sorry for the double post (but I guess isn’t good a long first post)

Here are some data to test…

The interesting is that the texture file (.png) is perfect! But I think it’s some error on uv or vertices positions.

-I get one error with egg-palletize and the default border 2 (I had 2 images of 128x128 and my final texture was 256x128 with 2px border… so, it rescaled my image, thing I didn’t want… So I set the border to 0, but if there’s a best solution, let me know). This error generated some kind of blurriness too… (So maybe the same thing is happening?)

  • Why if I call -nopal I get differents results loading the font? Shouldn’t the result be the same on game?

  • Have I to use egg-trans to merge similar texture and apply UV?

Sorry for one more bump, but I guess it’s improving…

I made:

egg-trans profont.egg -t -T -o newprofont.egg

Then I set the filters to nearest to the texture.
And now the fonts look more nice, but in some letters like “i” in the visitor font get blurred and the “q” gains a weird offset. Some pixels are chosen wrong as well…

I tried this patch, but still not perfect.

tnp.setTexOffset(TextureStage.getDefault(), 0.5/128, -0.5/64)

It’s almost perfect…
Any ideas?

EDIT: well, I guess it’s more like a problem of the font/freetype/egg-mkfont problem… anyway, with some fonts I get a acceptable result.
And: Why the -nopal option gives so much diference ingame?