YesNoOk
avatar

FNT v2 def file and Bitmap fonts (Fonts) (Read 7282 times)

Started by JustNoPoint, October 29, 2015, 02:04:28 am
Share this topic:
FNT v2 def file and Bitmap fonts (Fonts)
#1  October 29, 2015, 02:04:28 am
  • ******
    • www.justnopoint.com/
A required component of a font in FNT v2 format is the font definition file, which is a text file with a "def" extension. The font may be accompanied by a second file located in the same directory as the def file. What this file is depends on the type of font.

A FNT v2 font can either be a bitmap font or a TrueType font.

Bitmap fonts

An example bitmap font definition file, with inline comments, is shown below.

Code:
[FNT v2]
; FNT v2 version number.  Don't change this.
fntversion = 2,00
; Name of this font.
name = "4x6 variable"
; This font contains the full ASCII character set.
; All letters are uppercase.

[Def]
; This is a bitmap font
Type = bitmap
; Size of font: width, height.  Width is used for spaces.
Size = 3,6
; Spacing between font glyphs: width, height.
Spacing = 1,0
; Drawing offset: x, y.
Offset = 0,1
; Filename of the sff containing the glyphs.  Use sff v2 only.
File = f-4x6.sff

; Note: All units are in pixels.
; Text rendered with bitmap fonts may be in ASCII only.
; See work/font/f-4x6/f-4x6.def for information on creating the sff.
Only characters from the ASCII character set are supported by bitmap fonts. The extended ASCII set is not supported. For a table of the ASCII character set, see "ASCII character reference" below.

Bitmap fonts must be accompanied by an SFF file that contains the sprites for the glyphs. Each character in the font maps to a sprite indexed by 0,<ASCII code> where <ASCII code> is the corresponding ASCII code for the character. For example, the character 'A' (ASCII code 65) maps to sprite 0,65.

Any character which does not have a corresponding sprite will not be rendered.

Bitmap fonts may contain one or more color banks. Each color bank maps to a palette stored in the SFF, and indexed by 0,<color bank number> where <color bank number> is a positive number. If during font rendering, an invalid color bank is specified, the palette of the first sprite in the SFF will be used.
Re: FNT v2 def file and Bitmap fonts (Fonts)
#2  January 28, 2017, 05:51:37 pm
  • ******
  • 90's Kawaii
  • :thinking:
    • Guatemala
Bumping this thread just to add mugen also supports .otf (OpenType) fonts, even though this isn't documented on any official file. Might want to add a small note to the other font threads, @Just No Point: