Font Conversion & Repair: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
mNo edit summary
No edit summary
Line 5: Line 5:
There are two tools which are archived on ftp in case they disappear from the internet download sites I got them:
There are two tools which are archived on ftp in case they disappear from the internet download sites I got them:


ExportFontToDoom
* ExportFontToDoom
Q3Font
* Q3Font


My understanding is that ExportFontToDoom is more suitable than Q3Font for converting. It is what I used to convert a lot of ttf fonts. See notes with that tool as to how use it. But be aware of copyright issues if converting ttf fonts.
My understanding is that ExportFontToDoom is more suitable than Q3Font for converting. It is what I used to convert a lot of ttf fonts. See notes with that tool as to how use it. But be aware of copyright issues if converting ttf fonts.
Line 14: Line 14:
Doom fonts have 3 dat files:
Doom fonts have 3 dat files:


fontImage_12.dat
* fontImage_12.dat
fontImage_24.dat
* fontImage_24.dat
fontImage_48.dat
* fontImage_48.dat


But when repairing I found '24' was the only one being used by our readables generally so I never bothered with '12' and '48'.
But when repairing I found '24' was the only one being used by our readables generally so I never bothered with '12' and '48'.
Line 22: Line 22:
Copy the dat file(s) to the q3font folder and use this syntax to get a readable .fnt file:
Copy the dat file(s) to the q3font folder and use this syntax to get a readable .fnt file:


q3font.exe -decompile fontImage_24.dat
q3font.exe -decompile fontImage_24.dat


A common problem is this:
A common problem is this:
Line 36: Line 36:


In the readable .fnt files the characters are ASCII numbers.
In the readable .fnt files the characters are ASCII numbers.
A to Z are 65 to 90
A to Z are 65 to 90
a to z are 97 to 122
a to z are 97 to 122
 
f = 102
f = 102
g = 103
g = 103
j = 106
j = 106
p = 112
p = 112
y = 121
y = 121


Search the net for an ascii code list for others.
Search the net for an ascii code list for others.
Line 49: Line 48:
They fnt file can be converted back to .dat files using...
They fnt file can be converted back to .dat files using...


q3font.exe fontImage_24
q3font.exe fontImage_24


You will need to relaunch Doom each adjustment as there is no quick way to reload fonts.
You will need to relaunch Doom each adjustment as there is no quick way to reload fonts.


[[Category:Tutorial]]
[[Category:Tutorial]]

Revision as of 06:23, 30 March 2009

written by Fidcal

These are some rough notes about converting ttf fonts to doom3 and repairing if necessary.

There are two tools which are archived on ftp in case they disappear from the internet download sites I got them:

  • ExportFontToDoom
  • Q3Font

My understanding is that ExportFontToDoom is more suitable than Q3Font for converting. It is what I used to convert a lot of ttf fonts. See notes with that tool as to how use it. But be aware of copyright issues if converting ttf fonts.

With ExportFontToDoom there were quite a few spacing errors. Q3Font I found a bit puzzling so never did any conversions (it may be better for all I know.) BUT it can convert the dat files to readables for editing and back again so I used Q3Font to fix the errors.

Doom fonts have 3 dat files:

  • fontImage_12.dat
  • fontImage_24.dat
  • fontImage_48.dat

But when repairing I found '24' was the only one being used by our readables generally so I never bothered with '12' and '48'.

Copy the dat file(s) to the q3font folder and use this syntax to get a readable .fnt file:

q3font.exe -decompile fontImage_24.dat

A common problem is this:

Characters have an actual width but they also have a distance value from where they start being 'written' to the start of the next letter (xskip in the readable .fnt files.)

The true type font to doom font convertor named ExportFontToDoom3 appears to calculate this based on the character width (my guess.)

If lower case letters have descenders that curl back under the previous letter on the line, eg, f, g, j, p, y (q is OK because it curls forward) then the actual width of the character is greater than the distance from its start point to the start of the next character.

So, ExportFontToDoom3 makes xskip too big in the case of the above letters. Reducing xskip in the .fnt files and restoring them to .dat files cures the problem.

In the readable .fnt files the characters are ASCII numbers.

A to Z are 65 to 90
a to z are 97 to 122
f = 102
g = 103
j = 106
p = 112
y = 121

Search the net for an ascii code list for others.

They fnt file can be converted back to .dat files using...

q3font.exe fontImage_24

You will need to relaunch Doom each adjustment as there is no quick way to reload fonts.