Italic fonts rendered incorrectly

Problems building or running the engine, queries about how to use features etc.
Post Reply
eventhorizon
Kobold
Posts: 25
Joined: Wed Oct 20, 2010 4:56 am
x 6

Italic fonts rendered incorrectly

Post by eventhorizon »

Hi - I'm currently working with OGRE's font rendering system (finishing an app port, from the Crystal Space engine over to OGRE/Bullet), and am noticing that all italic fonts are being clipped on the right and leak into the previous glyph on the left. I've been debugging OgreFont.cpp and checking it against a dumped glyph map image, and getGlyphTexCoords() is returning texture coordinates that are off (U1 starts near the end of the previous glyph, and U2 stops before the end of the current glyph). I'm attaching an image of the same font rendered in both OGRE and CS so you can see the problem. So far it seems to happen in all italic fonts - don't know about others.

-eventhorizon
Attachments
Glyph rendered in CS
Glyph rendered in CS
glyph_cs.jpg (3.96 KiB) Viewed 706 times
Glyph rendered in OGRE
Glyph rendered in OGRE
glyph_ogre.jpg (5.27 KiB) Viewed 706 times
inzero
Kobold
Posts: 33
Joined: Sun Dec 19, 2010 9:55 am

Re: Italic fonts rendered incorrectly

Post by inzero »

I posted about the same issue 2 years ago, but I haven't used text very much since then so I can't comment on whether or not it's fixed (but going by your post here, it still looks to be a problem).

I didn't get any replies, but you can check out my original post here, which also points out a problem with excess empty space being generated in glyphs at various font sizes: http://www.ogre3d.org/forums/viewtopic.php?f=1&t=62416

Another forum user named KarenRei seemed to fix the issue for his/herself by modifying OgreFont.h and OgreFont.cpp, you can check out his/her post about the problem here (scroll to the end for file changes) http://www.ogre3d.org/forums/viewtopic.php?f=22&t=62640

But again I don't know if those changes will fix the issue for you, as I never tested them myself and have put text rendering aside while I work on other things.

EDIT: Also, what version of Ogre are you using? Following some links in KarenRei's post it looks like this was assigned to someone in the bugtracker and fixed as of 1.8.0 RC (Again I can't verify it's actually fixed :lol:)
User avatar
spacegaier
OGRE Team Member
OGRE Team Member
Posts: 4304
Joined: Mon Feb 04, 2008 2:02 pm
Location: Germany
x 135
Contact:

Re: Italic fonts rendered incorrectly

Post by spacegaier »

If that issue still persists, please create a ticket on our JIRA tracker and also link this thread there. Thanks!
Ogre Admin [Admin, Dev, PR, Finance, Wiki, etc.] | BasicOgreFramework | AdvancedOgreFramework
Don't know what to do in your spare time? Help the Ogre wiki grow! Or squash a bug...
eventhorizon
Kobold
Posts: 25
Joined: Wed Oct 20, 2010 4:56 am
x 6

Re: Italic fonts rendered incorrectly

Post by eventhorizon »

inzero wrote:I posted about the same issue 2 years ago, but I haven't used text very much since then so I can't comment on whether or not it's fixed (but going by your post here, it still looks to be a problem).

I didn't get any replies, but you can check out my original post here, which also points out a problem with excess empty space being generated in glyphs at various font sizes: http://www.ogre3d.org/forums/viewtopic.php?f=1&t=62416

Another forum user named KarenRei seemed to fix the issue for his/herself by modifying OgreFont.h and OgreFont.cpp, you can check out his/her post about the problem here (scroll to the end for file changes) http://www.ogre3d.org/forums/viewtopic.php?f=22&t=62640

But again I don't know if those changes will fix the issue for you, as I never tested them myself and have put text rendering aside while I work on other things.

EDIT: Also, what version of Ogre are you using? Following some links in KarenRei's post it looks like this was assigned to someone in the bugtracker and fixed as of 1.8.0 RC (Again I can't verify it's actually fixed :lol:)
I'm using OGRE 1.8.1 (was normally using 1.7.4 but recently started testing 1.8.1 hoping that the issue was fixed) - I noticed 1.8 had an option where you could change the added spacer value, but that doesn't help this issue (I've tried messing with it). I looked those posts over, and they seem to just be related to that spacer value which affects the final output of the text size, and this issue is somewhat different since the bounding box isn't centered properly on the character glyph. When you increase the spacer value, the final left side appears fine (it doesn't bleed into the neighboring glyph), but the right side is still cut off, showing that the box is still not centered correctly.

-eventhorizon
FloydPepper
Gnoblar
Posts: 9
Joined: Tue May 22, 2018 1:58 pm
Location: France
x 1

Re: Italic fonts rendered incorrectly

Post by FloydPepper »

In 2018 the problem seems still present.
I found the JIRA ticket for this problem, but it is still open : https://ogre3d.atlassian.net/browse/OGR ... %22font%22#

Does anyone has an idea of how to solve this problem ?

It seems that the UV coordinates (call to setGlyphTexCoords in the Font::loadResource method) are wrong in the case of italic fonts.

Thank you in advance.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1995
Joined: Sun Mar 30, 2014 2:51 pm
x 1075
Contact:

Re: Italic fonts rendered incorrectly

Post by paroj »

the texture coordinates are computed here:
https://github.com/OGRECave/ogre/blob/4 ... t.cpp#L403

and the issue is now tracked here:
https://github.com/OGRECave/ogre/issues/28

feel free to create a pull request if you can find the root cause.
Post Reply