Truncated TTF glyphes fonts

Problems building or running the engine, queries about how to use features etc.
akem321
Bronze Sponsor
Bronze Sponsor
Posts: 153
Joined: Mon Jul 31, 2006 8:29 pm
Location: France
x 7

Truncated TTF glyphes fonts

Post by akem321 »

Hi,

I'm using some TTF fonts but they looks truncated, any idea about this?

Image

Thanks.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Truncated TTF glyphes fonts

Post by xavier »

Could you be a bit more vague?

Start with explaining where you are "using some TTF fonts".
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
akem321
Bronze Sponsor
Bronze Sponsor
Posts: 153
Joined: Mon Jul 31, 2006 8:29 pm
Location: France
x 7

Re: Truncated TTF glyphes fonts

Post by akem321 »

I can be more vague : "Hey, i have a problem, can you help me?"
nah sorry :)
I mean, i'm using textOverlays with TTF fonts, so i load them and set parameters, specially char_width/height, but as you can see on the pic the characters looks truncated on the right for some reason...like if the width would not be large enough for some glyphes...

Otherwise they are regular fonts with their .fontdef files like:

Code: Select all

brawl
{
	type 		truetype
	source	font/brawl.ttf
	size 		16
	resolution 	72
}
Any idea what am i missing?

Thanks.
User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US
x 22

Re: Truncated TTF glyphes fonts

Post by xavier »

Where did the .ttf come from? It looks like it's not set up properly. Are there any sizes that work right?
Do you need help? What have you tried?

Image

Angels can fly because they take themselves lightly.
akem321
Bronze Sponsor
Bronze Sponsor
Posts: 153
Joined: Mon Jul 31, 2006 8:29 pm
Location: France
x 7

Re: Truncated TTF glyphes fonts

Post by akem321 »

Yes, the font comes from a website, not sure which one, i tried different width/height size without success.
But i do have one simple fixed font i generally use to display things which works just fine:

Image
(the pixelated look is totaly ok, the font is called "arcade", and no crop or anything like in the previous one)

Now here is a try with another stylised font http://font-styles.com/cool-fonts-61.html,
which looks like:

Image

and in Ogre:

Image

Either my font setup is wrong, missing some config/parameters, i dunno, or there is something special with theses fonts :/
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: Truncated TTF glyphes fonts

Post by jacmoe »

Try .font files instead of .fontdef (which I think is deprecated?) you can specify horizontal and vertical resolution in a .font file.

Alternatively, try this tool:
Font Studio :wink:

Please notice that this tool exports to Ogre/CEGUI font definitions.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
akem321
Bronze Sponsor
Bronze Sponsor
Posts: 153
Joined: Mon Jul 31, 2006 8:29 pm
Location: France
x 7

Re: Truncated TTF glyphes fonts

Post by akem321 »

Hi, thanks, well i want to use TTF over Bitmaps because of the large choice of fonts, and simplicity to use everywhere.
The .fontdef are correctly parsed(the manual is still using .fontdef), i' m using Ogre 1.6 atm, i can change to .font, np.
btw there is no char_width parameter... :)
---
I start to believe it is a bug when Ogre is generating the texture/UVs, however if someone could confirm me he got the same problem with the brooklyn font i linked previously, that would be great!
(that font is working just fine in the Gimp or Blender)
---
This is definitly a bug when Ogre is generating the texture, strange that nobody spotted this before...
here are the glyphs within the generated texture(+an overlay ABCDEF...):
Image
---
Ok, i got it somehow fixed for now...
Image
If someone has this problem while waiting for a better solution, in OgreFont.cpp, loadResource() there is a variable named char_spacer which is set to 5 for some reason, you can play with this value so that characters aren't eating each others in the generated texture, then you need to modify u2/v2 in the setGlyphTexCoords call later. However this is not the good way to fix this...
cyrfer
Orc
Posts: 424
Joined: Wed Aug 01, 2007 8:13 pm
Location: Venice, CA, USA
x 7

Re: Truncated TTF glyphes fonts

Post by cyrfer »

Ha! I knew there had to be some kind of a empty-space parameter. I've been trying to figure out how OGRE maps the UV for the glyphs. I think you just sent me in the right direction. I'll check out the OgreFont class. Thanks!