Notifications
Clear all

Font

1 Posts
1 Users
0 Reactions
253 Views
(@virtualltek)
Reputable Member Admin
Joined: 2 years ago
Posts: 150
Topic starter  

Fonts are used to display text elements/components. There's two formats supported by MUGENext: DEF and FNT.

FNT is a mix of binary & text format, merging them in a single file. To create this kind of font you need both text and image files, then join them together using Elecbyte's fntmaker tool. We'll not be covering the usage of this tool here, as this format is obsolete. But, is interesting to know how it works as MUGENext allow you to use it as separate files (without merging into a single FNT file, so no tool needed) by putting text content into a DEF and the image data as PCX or PNG. MUGENext favors the use of DEF for text and individual files for image/sound data over one binary file, as the later can be replaced by compressing everything in a single ZIP archive (see Virtual FIle System for details).

Fonts have support to "variants" called Banks. A Bank is a color variant of the same glyphs (palette reskin), or different glyphs at all (for Version 2, Bitmap Type, Sprite BankType). Each Font can have one or multiple Banks. TrueType Fonts have no Banks, and their color is defined as RGB values while referencing the Font (see Font element).


Version 1

This is the format used inside FNT files, with just one addition.

 

[Def]

  • type: Font type. Valid values are Fixed and Variable. Fixed means all characters have the same width. Variable allows you to use a custom width per character.
  • offset: Drawing offset (in pixels). Format: XY (comma separated integer values).
  • size: The size of one character (all for Fixed and default value for Variable) (in pixels). Format: Width, Height (comma separated integer values).
  • spacing: Distance between characters (in pixels). Format: XY (comma separated integer values).
  • colors: Number of colors per Bank. The maximum number of colors is 256, so the number of banks for the font is 256 divided by this value.
  • sprites: Filename of the Bitmap file containing the glyphs. Format: image.png/pcx.

 

[Map]: List of characters in the order they appear in sprites (one per line). If type = Variable, you can specify the offset and width of each character by: {char} {offset} {width}

a       ; for type = Fixed

b 5 5 ; for type = Variable

...

 

The sprites parameter is the only difference to FNT, so converting this kind of font to the new is way easier.


Version 2

This is the new format introduced by M.U.G.E.N 1.0.

 

[FNT v2]

  • fntversion: Font version. Always 2,00.
  • name: Name of this font (double quoted string).
  • author: Name of its author (double quoted string).

 

[Def]

  • Type: Font type. Valid values are Bitmap and TrueType (as the name implies, Bitmap font uses one Sprite (image file) per character, and the other uses TTF fonts).
  • BankType: Type of the color bank (Bitmap type only). Valid values are Palette and Sprite. For Palette type, Bank numbers are mapped to palette numbers (0, bank). For Sprite type, Bank numbers are mapped to sprite groups.
  • Size: Size of font (in pixels). Format: Width, Height (comma separated integer values). Width is used for spaces. Only height is used for TrueType fonts.
  • Spacing: Spacing between font glyphs (in pixels). Format: Width, Height (comma separated integer values). Only height is used for TrueType fonts.
  • Offset: Drawing offset (in pixels). Format: XY (comma separated integer values).
  • File: Filename of the Sprites file containing the glyphs. Use SFF V2 or DEF only. For TrueType fonts, it's the filename of the TTF font.
  • Blend: Preferred blending mode (TrueType fonts only). 0 = none, 1 = blended.

 

Bitmap fonts uses a Sprites file where each sprite is identified by "BankNo, CharacterCode" (for Sprite BankType) or "0, CharacterCode" (for Palette BankType). Each palette is identified by "0, BankNo" (for Palette BankType), any numbering otherwise. CharacterCode is the ASCII or Unicode value of the character.

Note that Banks are different from Version 1, who uses a single Palette for all Banks. Version 2 uses one Palette per Bank (for Palette BankType, this is why only SFF V2 is supported as this is the only format that also embbed palettes) or separate sprites for each Bank (for Sprite BankType, each Sprite group is a Bank).

This topic was modified 1 year ago by VirtuallTek

   
Quote
Share: