font display a little weird

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
lukeab
Space Krill
Posts: 1
Joined: Tue Aug 07, 2012 11:30 am

font display a little weird

#1 Post by lukeab »

Met all the dependancies, freetype fonts, boost etc etc,
Compiled on Fedora 16, the compile log was pretty much clean, not a single error, FO svn checkout revision 5096 and used GIGI from the source in the FO svn , GIGI revision 1074 in the externals link GG/

But on running freeorion, font's in all controls and dialogs are a little glitchy, readable and all, but something is glitching at the bottom of all the lines, image attached.
Attachments
Glitchy text in all dialogs
Glitchy text in all dialogs
FO_textglitch.png (80.46 KiB) Viewed 1775 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12725
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: font display a little weird

#2 Post by Geoff the Medio »

This is a longstanding known issue:
http://sourceforge.net/tracker/?func=de ... tid=544942
viewtopic.php?p=34755#p34755

It's likely some incompatibility between drivers, GiGi, and FreeType. It sometimes depends on font size or seemingly irrelevant modification to the stringtable, like making a particular (but not other) strings slightly longer, or changing the location of the game.

raptor
Space Squid
Posts: 85
Joined: Sat Jun 02, 2012 11:29 pm

Re: font display a little weird

#3 Post by raptor »

I have the same problem on my openSUSE 12.1 x86_64 system (with freeorion 0.4.0); however, I stumbled upon this:

http://stackoverflow.com/questions/4035 ... and-opengl

See the first answer about changing the pixel byte alignment. Could this have anything to do with it?

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12725
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: font display a little weird

#4 Post by Geoff the Medio »

Try rebuilding the latest SVN with the attached patch applied, which wraps the font render calls with calls to glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

It seems to work for me, but I don't know what would or wouldn't have reproduced the problem before the change for me, so I can't really test...

Note that in the latest SVN, GG code is in the FreeOrion repository, rather than pulled in as an external. Updating might not work right from an older repository version if you don't delete the GG directory first.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]


raptor
Space Squid
Posts: 85
Joined: Sat Jun 02, 2012 11:29 pm

Re: font display a little weird

#5 Post by raptor »

Looks like the simple solution was to remove the .ttf files included with the game, from the shared data directory.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12725
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: font display a little weird

#6 Post by Geoff the Medio »

Random changes like adding or removing a few characters to the stringtable file, or changing its location, or using a different font, have been reported to seemingly fix cause the issue, only to have it return later, so don't assume it's really fixed until you've tested fairly extensively.

raptor
Space Squid
Posts: 85
Joined: Sat Jun 02, 2012 11:29 pm

Re: font display a little weird

#7 Post by raptor »

I found a clue as to why removing the fonts from the data directory and moving the game works:

If the font file paths pointed to in the config.xml are nonexistent, then the game displays fonts just fine.

I'm not sure what this means, or even what it could mean...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12725
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: font display a little weird

#8 Post by Geoff the Medio »

Perhaps you have another copy of the font files that FO uses somewhere in your system path directories? As I said, random changes seem to intermittently fix the issue for others, so using a slightly different font file could do it.

raptor
Space Squid
Posts: 85
Joined: Sat Jun 02, 2012 11:29 pm

Re: font display a little weird

#9 Post by raptor »

There is an equivalent DejaVuSans.ttf in a system directory; however, it md5sums the exact same as the one included with FO.

Using different font files does not fix it either - so far all that I have tested produced the artifacts; the only consistent pattern so far is if they are found in that config.xml or not. If not, then some default (which looks like DejaVuSans.ttf) is loaded from somewhere and renders properly.

I'll still try to see if I can narrow it further.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12725
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: font display a little weird

#10 Post by Geoff the Medio »

raptor wrote:There is an equivalent DejaVuSans.ttf in a system directory; however, it md5sums the exact same as the one included with FO.
What happens if you rename / remove that file as well?

raptor
Space Squid
Posts: 85
Joined: Sat Jun 02, 2012 11:29 pm

Re: font display a little weird

#11 Post by raptor »

Geoff the Medio wrote:What happens if you rename / remove that file as well?
Most interesting: the in-game fonts still work just fine. Are there other font files that I'm not aware of?

raptor
Space Squid
Posts: 85
Joined: Sat Jun 02, 2012 11:29 pm

Re: font display a little weird

#12 Post by raptor »

Sorry to reply to myself -

Even more interesting:

I ran the 'lsof' command to grab any open resource handles that freeorion may be using - it has libfreetype loaded, but there is not a single font file being used by the game. Is there a built-in one?

The plot thickens...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12725
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: font display a little weird

#13 Post by Geoff the Medio »

raptor wrote:Is there a built-in one?
Yes, GiGi has a built-in Vera font in DefaultFont.h. I'd have expected an exception to be thrown and possibly a crash if a font file was requested that didn't exist, though... Crashes due to not being able to find font files were quite commonly reported for a while, before the files were moved around.

raptor
Space Squid
Posts: 85
Joined: Sat Jun 02, 2012 11:29 pm

Re: font display a little weird

#14 Post by raptor »

So this now means that as long as you don't load any other font, then the default one is used, and is the only that works without artifacts.

So I wonder what the difference is between loading the default and loading a font from a file (maybe only on Linux)?

Post Reply