Spacing problem with custom font and Cegui (but not CEED)

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Jefferian
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Wed May 08, 2013 21:55

Spacing problem with custom font and Cegui (but not CEED)

Postby Jefferian » Thu May 09, 2013 21:06

Basically, as the title says. I've developed a custom font for my application. The space character works fine in Fontforge,Windows Font Viewer and CEED, but it has a much smaller width when used in my application (using the same exact resources i was using in CEED, obviously).
CEED
Application

I don't think this problem is strictly related to Cegui; If i try with Arial, for example, all goes well, so it must be something related either in how the space width get determined, or something missing in the font file. The matter is, if i could understand why there is such a difference when using CEED and Cegui, i could understand where lies the problem. I've been working on this for at least 10 days and i don't know what else to do, since i've tried changing the width of the space (without results in the application), em, disabling autohints and whatever i could think of. Seeing as text is such a fundamental part of the GUI, though, someone may have already encountered a similiar problem. And, hopefully, resolved it.

Here is the essential section of the cegui log from the application; albeit, i can't see any error or anything related to my problem, even at Insane logging level (i can see the space glyph is successfully created, but i already knew that - the space character is there, just with a reduced width).

Code: Select all

---- Version 0.7.9 (Build: Jan 22 2013 Debug Microsoft Windows g++ 4.7.1-dw2 32 bit) ----
---- Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module. ----
---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
---- Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine. ----
---- Scripting module is: None ----


Thank you very much for the help.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Spacing problem with custom font and Cegui (but not CEED

Postby CrazyEddie » Thu May 09, 2013 22:01

Hello,

I can't offer an immediate solution right now, but I'll instead speak about various things that may or may not be related to the issue. The thing that you may not be aware of is that CEED uses CEGUI to perform text rendering in layouts and such!

So, what does this mean for your issue? Well, we have to look at what's different. You're using CEGUI 0.7.9 (nothing wrong with that, of course), whereas CEED uses unreleased development versions of CEGUI - now, I don't think there have been any CEGUI::Font related changes that might cause this difference between the two versions of CEGUI (I will try and check tomorrow to be sure).

The other thing may be different is the version of the freetype2 dependency used (freetype2 provides some underlying font services for CEGUI). Which dependencies did you compile CEGUI with? The old prebuilt mingw ones? Or did you make your own? If you built your own, which version did you use? Of course, the version of freetype2 used should not really make any difference, but I'm just trying to think of any possible differences between your CEGUI and the CEGUI used by CEED - because clearly something is causing the issue :)

Could you also post the XML for the font definition (or the code you use to create it if you do that in code), thanks.

CE.

Jefferian
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Wed May 08, 2013 21:55

Re: Spacing problem with custom font and Cegui (but not CEED

Postby Jefferian » Thu May 09, 2013 22:53

I did use the old prebuilt minGW dependencies (i've followed this nicely done tutorial to build Cegui).
Regarding the font xml, i used this simple code in .font files.

Code: Select all

<?xml version="1.0" ?>
<Font Name="Awa-12" Filename="Awa.ttf" Type="FreeType" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true"/>

Varying size and names, obviously.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Spacing problem with custom font and Cegui (but not CEED

Postby CrazyEddie » Fri May 10, 2013 10:32

What you might try then - and do note, I have no idea if this will change anything, I'm only suggesting it because I have nothing else to suggest - is to build a newer freetype2 and use it in place of the one in the old deps package.

Probably the easiest way is to grab our beta6 source based dependency pack intended for 0.8 (http://sourceforge.net/projects/crayzed ... p/download) and build the freetype lib in there (that build requires cmake to generate whatever build files you want to use). The only snag is that the configs produced by the 0.8 deps and the configs expected by 0.7 are slightly different, and I can't remember if that is significant when using mingw. Anyway, the idea is to just build freetype, then replace the freetype headers in the old deps pack with the new ones (which will be at dependencies/include wherever you built the new deps package) and replace the freetype libs in the old deps pack with the one in dependencies/lib/static from the newly built one - take the static one for all configs, that's important and related to the config change mentioned above). Once you've done that, rebuild cegui using the new freetype version.

I must reiterate that this is quite a long shot, but honestly, I don't really know what else to suggest.

CE.

Jefferian
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Wed May 08, 2013 21:55

Re: Spacing problem with custom font and Cegui (but not CEED

Postby Jefferian » Fri May 10, 2013 15:06

Mh...guess i could rather wait for the 0.8 release, then, since it is coming out in a couple weeks (and thus, with the updated dependencies you've also linked here). While annoying, this isn't something that stops me from going on, and i would have updated cegui at the new version anyway. If it is solved with the updated dependencies, it's all good. If not...i'll have to search further, i guess.
Indeed, quite a bizzarre problem. Thanks for the suggestions, anyway.

Jefferian
Not too shy to talk
Not too shy to talk
Posts: 37
Joined: Wed May 08, 2013 21:55

Re: Spacing problem with custom font and Cegui (but not CEED

Postby Jefferian » Mon May 13, 2013 12:24

I'm an idiot. I had a font with the same name in another folder that was loaded in place of the corrected ones. Thus making all the corrections useless and making me wonder what was happening.
If someone ever gets a similar problem, start with seeing what resources is using your program.

I would add a "solved" tag, but the title is too large.
Better let this thread sink in the abyss of stupidity.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 19 guests