How to generate oolite-font.png?

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
doctorfrog
Average
Average
Posts: 11
Joined: Thu Nov 08, 2012 11:06 pm

How to generate oolite-font.png?

Post by doctorfrog » Tue Nov 13, 2012 8:38 pm

I'm a bit surprised there isn't more than one font mod (tty.oxp), given how many texture mods there already are. The default font is nice n' readable, but has all the appeal of a new Microsoft Word document. No offense to anyone who prefers its no-nonsense simplicity.

Is there a simple way to go about replacing the font, or is it something you have to do very painfully in an image editor? I've already used tty.oxp, but I'd like to pick my own font.

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: How to generate oolite-font.png?

Post by JensAyton » Wed Nov 14, 2012 8:09 am

Hey, now. Office doesn’t have the class to use Helvetica. ;-)

The font files (oolite-font.png and oolite-font.plist) are generated using a custom tool that’s Mac-only, and the font to use is hard-coded in the source. If you happen to have a Mac, you can get Xcode, check out the source and play around with it (tools/fonttexgen). Otherwise, there are many similar tools out there. Details to note:
  • The first two rows are special. Copy them as they are.
  • The remaining rows are characters 32 to 255 of Windows-1252 encoding, except that the Euro symbol is replaced with the Brazilian cruzeiro symbol, ₢.
  • All glyphs except the first two rows are moved down by 1/8th of a box. This is hard-coded in Oolite.
  • The “widths” list in oolite-font.plist specifies the advances of the glyphs in eighths of an em. If you use a third-party tool, you’ll probably have to scale the output. Don’t forget that the first 32 entries should be kept as-is.

doctorfrog
Average
Average
Posts: 11
Joined: Thu Nov 08, 2012 11:06 pm

Re: How to generate oolite-font.png?

Post by doctorfrog » Wed Nov 14, 2012 9:14 am

That's a lot of good info. The ultimate object may be beyond my ken, but at least I can figure out how it's done. Thanks.

User avatar
edgepixel
Average
Average
Posts: 15
Joined: Wed Oct 20, 2010 3:00 pm

Re: How to generate oolite-font.png?

Post by edgepixel » Fri May 30, 2014 2:26 pm

1. As a person interested in typography who wants to make a font for Oolite, I know what an em is, but "advances of the glyphs" sound a little bit nebulous. What does it measure exactly, point-A-to-point-B-style?
2. I guess the ₢ symbol be changed to something else, say a newly-designed icon, like the ones on the top two rows. Am I right?
3. I intend to change the top two icon rows, too. Could you share some info on how they work?
4. What is the purpose of moving the non-icon glyphs down one eighth of a box size?

Thanks.

User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4018
Joined: Fri Nov 11, 2011 6:19 pm

Re: How to generate oolite-font.png?

Post by cim » Fri May 30, 2014 3:44 pm

1) Width of the printable part of the glyph, essentially. Compare the values for e.g. "i" and "W" in the default font.

2) Yes, you could.

3) These are characters 0 to 31 in the character set, which are normally mostly unprintable control characters in ASCII or compatible character sets. Many of them have been repurposed for Oolite-specific characters:
0..7: government icons (used on F6 screen and elsewhere)
8: filled star (used in Elite rank text)
9..15: unused. 9, 10 and 13 are printable characters (tab, line feed, carriage return) and should definitely remain unused.
16..23: economy icons (used on F6 screen and elsewhere)
24: hollow star (used in Deadly rank text)
25..30: unused
31: very narrow space (used to align text on some screens e.g. the contracts interfaces), must be all black.

4) I assume this is to leave a gap between rows to make the font texture easier to check visually without a descender on one character appearing to merge with the accent on another.

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: How to generate oolite-font.png?

Post by JensAyton » Fri May 30, 2014 8:06 pm

4. The ascenders of the default font would extend outside the box widths otherwise. (We could have changed the Y extents of the rectangle used for each glyph instead, but the effect would be the same; or we could have used a smaller font size and got less detail for the memory use.)

Post Reply