Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OGRE-135] Italic fonts rendered incorrectly #28

Closed
paroj opened this issue Nov 29, 2015 · 2 comments · Fixed by #1707
Closed

[OGRE-135] Italic fonts rendered incorrectly #28

paroj opened this issue Nov 29, 2015 · 2 comments · Fixed by #1707

Comments

@paroj
Copy link
Member

paroj commented Nov 29, 2015

[reporter="eventhorizon", created="Mon, 28 Jan 2013 22:29:14 +0100"]

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 font glyphs 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
glyph_ogre

and CS
glyph_cs

so you can see the problem. In the OGRE image, you can see the right edge of the 'B' glyph leaking into the image, while the right edge of the 'C' glyph is cut off. So far it seems to happen in all italic fonts - don't know about others.

The new getCharacterSpacer feature doesn't solve this issue when adjusting, and only affects the leaked glyph on the left side (no change with the right-side clipping). This happens in all platforms, but the pics were taken using OGRE 1.8.1 on Linux x64 (Debian Squeeze). This seems to happen on all italic fonts, but I can attach the testing one if you need.

@paroj
Copy link
Member Author

paroj commented May 22, 2018

to tackle this one should compare the Ogre loading code

this->setGlyphTexCoords(cp,

to other "freetype texture atlas" samples, like e.g.
https://gist.github.com/baines/b0f9e4be04ba4e6f56cab82eef5008ff

here is what crystalspace is doing:
https://github.com/crystalspace/CS/blob/3029384a26f1f16d0fa7b05142c2d8aaf5102726/plugins/font/server/freefnt2/freefnt2.cpp#L390

@paroj
Copy link
Member Author

paroj commented Dec 10, 2020

the core issue here is that ogre tries to treat glyph advance and glyph width as one. This works fine as long as width < advance, but breaks otherwise. Notably this happens with italic fonts, which would have to be rendered with overlap.

To really fix this we would need to render with advance, but this will silently break code for existing OgreFont users.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant