Using a new font

Discuss the future of Warzone 2100 with us.
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Using a new font

Post by wuz21m »

Hi all,

First I would like to thank everyone for working on this project and improving it! I like WZ2100 and would love to help (I already have a patch waiting in the pipeline: http://developer.wz2100.net/ticket/4261)

One thing that I think could be improved upon is the choice of font. From what I gather these are the requirements:
1- The font must be GPL (I think SIL OFL is OK too)
2- The font must have good support for international languages.

I did some searches for good fonts. Currently, WZ2100 uses Deja Vu Sans, which is not very futuristic, but is very readable.

The best font I found was Xolonium: http://openfontlibrary.org/en/font/xolonium
It is GPL licensed. Has a futuristic look and a wide array of languages are supported. The author seems to be very active (see History in the linked page). But there are some issues:
1- It is much denser than Deja Vu Sans. It needs a larger font size. I patched the code and increased the "_glcFont_Regular" font size - used for some ui elements and briefing text) to 14p and 16 (see the attached comparison). I did not however, change "_glcFont_Bold" font size as it already looked good enough.
2- The "r" letter in the font is not very nice looking. I used font forge to make r longer. In all of my comparisons, you see the fixed "r".

For comparison, I have included a zip file (sorry! I had 8 images and I don't think this forum allows that many!) In the zip file, the current font (Deja Vu Sans) is compared against Xolonium in three places:
-Main Menu (Bold Deja Vu and Xolonium at default (21p) )
-In-game Escape Menu (Regular Font, 12p Dejavu, 12p,14 and 16p Xolonium)
-Briefing Menu (Regular: 12p Deja Vu, 12p,14 and 16p "Fixed" Regular Xolonium)

Hope this helps!

P.S.: This must have been mentioned before, but if you want to find alternatives, please use respectable sites. "Free", "Freeware", "GPL" are different things. Some font sites really remind me of those questionable sites. I think this site is good: http://openfontlibrary.org/

EDIT: Adding a little teaser:
Main Menu using Xolonium:
main_menu_xolo.jpg
Briefing using "fixed" Xolonium at 14p:
briefing_xolo14p.jpg
Comparison.zip
(1.12 MiB) Downloaded 386 times
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Using a new font

Post by NoQ »

Nice one.

I think we also need to support some chinese(?) there seems to be such option in the game menu.

Anyway, this could be probably packed as a mod addon(?)
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Using a new font

Post by wuz21m »

You're welcome, NoQ.

I'm afraid that either way, Warzone2100 code needs to get patched. Font sizes are hard-coded in the source (iV_SetFont @ textdraw.cpp). That must change to accommodate the change of font (it should not be a challenge to make it an option, though).

Xolonium does not support Chinese, we could easily make the selection of fonts (loadConfig() @ Configuration.h) more flexible as well, though.

I also checked Exo 2 (Version 2 of the Exo Font used on this very forum for the theme!)
The license is OFL SIL, which is compatible with GPL from what I understand (allows packaging)

Briefing: Exo 2 Medium 16p
briefing_exo16p.jpg
Main Menu: Exo 2 Bold 24p
main_menu_exp_bold_24p.jpg
Escape Menu: Exo 2 Medium 16p
escape_menu_exo16p.jpg
Jorzi
Regular
Regular
Posts: 2063
Joined: 11 Apr 2010, 00:14

Re: Using a new font

Post by Jorzi »

Exo 2 feels very appropriate with the warzone theme and is very readable for me. Xolonium is also cool but feels a bit "flattened". I think I could easily vote for exo 2 as a replacement.
ImageImage
-insert deep philosophical statement here-
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Using a new font

Post by wuz21m »

Yes, Exo2 is so much more readable. I also found a font called Play. That looks nice as well (License is SIL OFL).

Main Menu: Play Bold 26p
main_menu_play_bold26p.jpg
Briefing Menu: Play Regular 18p
briefing_play18p.jpg
Escape Menu: Play Regular 18p
escape_menu_play18p.jpg
Thanks for the comments.
User avatar
NoQ
Special
Special
Posts: 6226
Joined: 24 Dec 2009, 11:35
Location: /var/zone

Re: Using a new font

Post by NoQ »

Briefings somehow repeatedly look out of order. Everything else is cool.
Either color needs to be toned down, or size reduced, or something like that ... (?)

I wonder how skirmish/multiplayer game setup menu looks, it's the most clamped menu we have, i guess.
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Using a new font

Post by wuz21m »

Here it comes:

Exo 2 16p Skirmish:
Skirmish-Exo2-16p.jpg
Play 17p Skirmish:
skirmish_play17p.jpg
Since I downsized Play from 18p to 17p so it could fit properly, here is Play at 17p for cross-examination:
briefing_play17p.jpg
User avatar
vexed
Inactive
Inactive
Posts: 2538
Joined: 27 Jul 2010, 02:07

Re: Using a new font

Post by vexed »

frend1.png
frend1.png (6.48 KiB) Viewed 13414 times
I never did like deja vu's font... wasn't even close to the original.

For what it is worth, only a few fonts support Chinese, and currently, the only way to get a font with that is to install the alternate config file on windows, and then you can load whatever font you want.
/facepalm ...Grinch stole Warzone๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Using a new font

Post by wuz21m »

I could supply a patch to configuration.cpp and textdraw.cpp that would choose a best font based on the current locale and what is installed on the system.

Thus, we could use a font like Play and Exo 2 some people and fall back to Deja Vu Sans if there are no other alternatives. I am sure that people can choose some good fonts for locales such as Chinese, Japanese and Korean.

This can be implemented based on a config file, which will support mods as well. But I am not familiar with the conventions used for config files. From what I gather, a mixture of ini and JSON is used at the moment.
Per
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 3780
Joined: 03 Aug 2006, 19:39

Re: Using a new font

Post by Per »

Nice fonts. I really like exo2. While rewriting the font rendering code, I tested using the Android fonts (Apache 2 license), and I found Roboto Slab to be quite nice as well. I can't make any screenshots with it right now, though.
User avatar
MaNGusT
Art contributor
Posts: 1152
Joined: 22 Sep 2006, 10:31
Location: Russia

Re: Using a new font

Post by MaNGusT »

I vote for xolonium for menu and Exo2 for other stuff :-) Is it possible to use 2 fonts in game? xolonium reminds me the starcraft brood war font, very stilized.
Image
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Using a new font

Post by wuz21m »

Per wrote:Nice fonts. I really like exo2. While rewriting the font rendering code, I tested using the Android fonts (Apache 2 license), and I found Roboto Slab to be quite nice as well. I can't make any screenshots with it right now, though.
Main Menu Roboto Slab Bold 24p
main_menu_roboto_bold_24p.jpg
Skirmish Menu Roboto Slab 15p
skirmish_roboto_15p.jpg
Briefing Roboto Slab 15p
briefing_roboto_15p.jpg
MaNGusT wrote:I vote for xolonium for menu and Exo2 for other stuff :-) Is it possible to use 2 fonts in game? xolonium reminds me the starcraft brood war font, very stilized.
Here is the patch: http://developer.wz2100.net/ticket/4267
I think it is clean enough. It didn't take much effort, the initialization code passed the same font family for both regular and bold. I made it so separate font families are be introduced for either. I tested fallback and it still works although the GLC fallback looks so awful! (Maybe it is my machine!)

The current patch uses Xolonium 24p Bold for Bold and Exo 2 15p Regular for Regular!

There is one catch though. Locale must be supported by both fonts. We need locale-based selection of fonts. We need to think of a solution for that. I don't know how you can query locales in gettext. A dirty solution is to include the font name and size in the .PO files.
User avatar
vexed
Inactive
Inactive
Posts: 2538
Joined: 27 Jul 2010, 02:07

Re: Using a new font

Post by vexed »

I know we need a new font...but, why is it we need multiple fonts ?

Also, you change the defaults from this:

Code: Select all

		default:
		case font_regular:
			iV_SetTextSize(12.f);
			glcFont(_glcFont_Regular);
			break;

		case font_large:
			iV_SetTextSize(21.f);
			glcFont(_glcFont_Bold);
			break;

		case font_medium:
			iV_SetTextSize(16.f);
			glcFont(_glcFont_Regular);
			break;

		case font_small:
			iV_SetTextSize(9.f);
			glcFont(_glcFont_Regular);
			break;
I don't see a reason why, the above are picked since they work for us, but you changed them because why ?
24 is too large, and 15 is one point smaller than medium.
/facepalm ...Grinch stole Warzone๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.
wuz21m
Trained
Trained
Posts: 36
Joined: 18 Dec 2014, 20:57

Re: Using a new font

Post by wuz21m »

vexed wrote:I know we need a new font...but, why is it we need multiple fonts ?

Also, you change the defaults from this:

Code: Select all

		default:
		case font_regular:
			iV_SetTextSize(12.f);
			glcFont(_glcFont_Regular);
			break;

		case font_large:
			iV_SetTextSize(21.f);
			glcFont(_glcFont_Bold);
			break;

		case font_medium:
			iV_SetTextSize(16.f);
			glcFont(_glcFont_Regular);
			break;

		case font_small:
			iV_SetTextSize(9.f);
			glcFont(_glcFont_Regular);
			break;
I don't see a reason why, the above are picked since they work for us, but you changed them because why ?
24 is too large, and 15 is one point smaller than medium.
I added support for dual fonts because MaNGusT suggested it. And I personally agree that Xolonium looks very nice for Main Menu, but not so much for anything else.

As for font size changes, we have to choose font size with respect to the font itself. Xolonium is pretty dense. Exo 2 is denser than Deja Vu sans as well. Observe:

DejaVu Sans 12p (Original):
briefing_dejavu_12p.jpg
Exo 2 12p (Original Size):
briefing_exo12p.jpg
For reference: Exo 2 15p (Bumped up by me)
briefing_exo15p.jpg
Although Exo 2 at 15p is slightly larger than Deja Vu 12p, but looks a lot more readable than before. I also checked the screen at 640x480, it all looks OK. We could also try Exo 2 13p, 14p too.

Of course, both dual-font and different font sizes complicate matters slightly. I also offer to add more code to support font configuration across different locales. However, I argue that it makes things much more readable.

EDIT: I am sorry. I put in DejaVu Medium instead of DejaVu Book that is currently used. Picture updated...
User avatar
vexed
Inactive
Inactive
Posts: 2538
Joined: 27 Jul 2010, 02:07

Re: Using a new font

Post by vexed »

I meant that, not only do we support 640x480, we also support other languages, and the numbers we have in there now, allow for the greatest fit for the more verbose languages.
So, while "Blah blah blah" might fully fill the window in English, use something else and it would cut off the text. That is why we have to be very careful on those numbers.
Look at the options screen for some horrible trouncing of space issues.
/facepalm ...Grinch stole Warzone๐Ÿ™ˆ๐Ÿ™‰๐Ÿ™Š contra principia negantem non est disputandum
Super busy, don't expect a timely reply back.
Post Reply