Fonts: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
'''Morrowind .fnt fonts'''
Morrowind uses a custom .fnt file format. It is not compatible with the Windows Font File .fnt format, nor compatible with .fnt formats from any other Bethesda games. To our knowledge, the format is undocumented and no tools for viewing or editing these fonts exist.
OpenMW can load this format and convert it on the fly into something usable (see font loader [https://github.com/OpenMW/openmw/blob/master/apps/openmw/mwgui/fontloader.cpp#L151 source code]). In OpenMW 0.32, an --export-fonts command line option was added to write the converted font (a PNG image and an XML file describing the position of each glyph in the image) to the current directory.
'''TrueType fonts'''
'''TrueType fonts'''


Line 6: Line 12:
* Open resources/mygui/openmw_font.xml in your OpenMW installation.
* Open resources/mygui/openmw_font.xml in your OpenMW installation.
* Add a Resource element for the new font. You can use the existing one for DejaVuLGCSansMono.ttf as a template. Some important values:
* Add a Resource element for the new font. You can use the existing one for DejaVuLGCSansMono.ttf as a template. Some important values:
name="Magic Cards"
** name="Magic Cards"
<Codes> specifies which glyphs are included in the font texture.  
** <Codes> specifies which glyphs are included in the font texture. For international glyphs, you might need to add a few more. You can check the code for a glyph in a font editor (e.g. FontForge)
For international glyphs, you might need to add a few more. You can check the code for a glyph in a font editor (e.g. FontForge)


TODO: Add examples
TODO: Add examples
'''Bitmap fonts'''
Morrowind .fnt files are essentially a bitmap font, but using them is discouraged because of no Unicode support.
MyGUI has its own format for bitmap fonts. An example can be seen by using the --export-fonts command line option (see above), which converts Morrowind .fnt to a MyGUI bitmap font. This is the recommended format to use if you wish to edit Morrowind's bitmap font or create a new bitmap font.

Revision as of 17:33, 14 August 2014

Morrowind .fnt fonts

Morrowind uses a custom .fnt file format. It is not compatible with the Windows Font File .fnt format, nor compatible with .fnt formats from any other Bethesda games. To our knowledge, the format is undocumented and no tools for viewing or editing these fonts exist.

OpenMW can load this format and convert it on the fly into something usable (see font loader source code). In OpenMW 0.32, an --export-fonts command line option was added to write the converted font (a PNG image and an XML file describing the position of each glyph in the image) to the current directory.

TrueType fonts

Unlike vanilla Morrowind, OpenMW directly supports TrueType (.ttf) fonts. This is the recommended way to create new fonts.

  • Delete the original magic cards .fnt file (from your Data Files/Fonts directory).
  • Open resources/mygui/openmw_font.xml in your OpenMW installation.
  • Add a Resource element for the new font. You can use the existing one for DejaVuLGCSansMono.ttf as a template. Some important values:
    • name="Magic Cards"
    • <Codes> specifies which glyphs are included in the font texture. For international glyphs, you might need to add a few more. You can check the code for a glyph in a font editor (e.g. FontForge)

TODO: Add examples

Bitmap fonts

Morrowind .fnt files are essentially a bitmap font, but using them is discouraged because of no Unicode support. MyGUI has its own format for bitmap fonts. An example can be seen by using the --export-fonts command line option (see above), which converts Morrowind .fnt to a MyGUI bitmap font. This is the recommended format to use if you wish to edit Morrowind's bitmap font or create a new bitmap font.