FXY File Format

From Bohemia Interactive Community
Jump to navigation Jump to search

Template:unsupported-doc

Introduction

PAA layout of a font

The OFP and ArmA engines use a limited set of bit mapped fonts developed by Bohemia Interactive for the engine. They are bitmaps and each glyph within is treated as a texture.

A character set (such as Ascii) is a series of 'glyphs' (characters) where any one of these characters is always identified by the same index value. For example the letter A is always hex 41 and so on. Regardless of the font set employed, the character set within it, is set-in-concrete. Hex 41 always renders a glyph that 'looks like' the letter A. Be it bold, italic, or fills the entire screen, it is the letter 'A'.

The character set for all BI fonts in OFP is different for each language version. For Western languages it approximates US-Ascii codepage 437. In ArmA Unicode is used for fonts.

A font set is a collection of displayable characters (termed glyphs) that have a common appearance. Eg all glyphs in THIS set are bold, or all the glyphs are italic, all the glyphs are Times Roman (seriffed).

Individual font sets exist for Tahoma, Garamond, and so on.

The glyphs within these sets, are contained in .paa files. Generally, the entire font set = one, paa file.

And, because these are bitmapped fonts, eg fixed dimensions, non-scaleable, there are unique font sets, for, unique sizes.

For example, in Resistance engine, the popular Tahoma font is in three different font sets. 24 point, 36 point, 48 point.

A 'point' approximates 1/72th of an inch. Thus the Tahoma fonts available (for Resistance) are approximately a third, a half, and two thirds of an inch tall when displayed.

Description

An fxy file is the 'character set' index. It is, the codepage.

An fxy file is implicitly associated with one or more paa files within the same folder. The fxy file is the header entry for these files, it describes the position in the paa file and the size to be rendered on screen, for a 'glyph'.

Association of files between fxy and paa is implicit. The CourierNewB64.fxy is implicitly associated with the CourierNewB64-xx.paa file(s). xx indicating one of several CourierNewB64 paa's.

Legend

see Generic FileFormat Data Types

Struct

Fxy
{
  bytes     ArmaSignature[8]; // ARMA ONLY
  FxyEntry  Entry1;
         ....
  FxyEntry  EntryLast;
}

ArmaSignature

ArmaSignature
{
  char Magic[4]; //"BIFo"
  ulong Version; // 0x101
}

FxyEntry

FxyEntry 
{
  ushort  CharCode;      // 0x21 = 'A' <<< see note
  ushort  PaaFileNumber; // 01
  ushort  X,Y            // Top-left Corner of char on the texture in pixels
  ushort  Width,Height;  // Size of the char on the texture in pixels
  ushort  KerningWidth;  // ARMA only. Width used to determine this character spacing
};

Apart from the ARMA header (in Arma fxy files only), the fxy is a contiguous series of 12 byte (ofp) or 14 byte (Arma) entries.

CharCode

OFP uses a USASCII character set. Arma, uses Unicode.

  • For OFP, there are 224 entries. This because the first 32 indexes of (most) Ascii codepages are unprintable, which leaves 256-32= 224.
  • ArmA fxy's have 464 entries, as each font supports both Western European, Eastern European and Cyrillic character sets.
The Arma Unicode Codepage is broken up as follows
  • 0... FF 'International' Codepage equivalent to Windows(tm) ANSI 1252
  • 100... 15F Alt Language 1
  • 3E0... 3FF Alt Language 2
  • 400... 43F Alt Language 3
  • 1FF0...1FFF Special chars

Note that while the Charcode is of technical interest, it is redundant. There is a direct correspondence between the index value (eg the entry number) and the character it represents. Thus for Ascii, index entry 0x41-x20 always represents the glyph character 'A'

Ascii = index + 0x20; // and
index = Charcode; // (ignoring Unicode alt languages)

Technically, the engines probably accommodate lack of characters (eg no lower case supplied), and even alternate mapping (index 0x21 != Charcode 0x21) but neither of these arrangements exist in any BI fxy file.

PaaFileNumber

-number of texture file: This is simply a convenience to allow large fonts to be spread across several paa's.

font name is "CourierNewB64" 
Fxy file is "CourierNewB64.fxy", 
First texture file is "CourierNewB64-01.paa", 
second is "CourierNewB64-02.paa".

Usage

This example using the new font name in a ArmA description.ext.

class RscText
{
       type = CT_STATIC;
       idc = -1;
       style = ST_LEFT;
       colorBackground[] = {0, 0, 0, 0};
       colorText[] = {1, 1, 1, 1};
       font = Bitstream;
       sizeEx = 0.04;
};

Paa Content

Resistance

.paa files used for the font must be in 8080 format: (Alpha luminosity)

8bit - Brightness (all with 255 value - "white");
8bit - Alpha (255 for character, 0 for space);

ArmA

Arma Glyph files (paa) are formatted in DXT5 compressed textures. Using the TAGG labelling, they must additionally specify

Avg Color: any
Max Color: always FFFFFFFF
AlphaFlag: 1

Available Fonts

Resistance and CWC

AudreysHand 48pt Italic
AudreysHand 48pt Bold
CourierNew Bold 64pt
Garamond 64
Steelfish bold 64 and 128 pt
SteelfishCE bold 64 
Tahoma 24/36/48 bold

Elite

Arial Bold 7,8,10,11,12 pt
Arial Italic 9,13,18,48
CourierNew 9pt
Hel67-CM 10,11 pt
HelvCondLight 8,9,10 pt
Helvetica-Narrow 11pt
Helvetica-Narrow Bold 8pt
Helvetica37-CondensedThin bold 10pt
Helvetica57-Condensed 10,13,16pt
Helvetica57-Condensed 9 ,13,14 pt Bold 
Helvetica67-Condensed 10,11,9pt Medium
HelveticaNarrow 10,11pt
HelveticaNarrow bold 10,13,18,22
HelveticaNeue 10,11,12,13,14,22
HelveticaNeue  Bold 22 B22-01.paa
LucidaConsole Bold 11,8
MSS Bold 9
System 10pt
System 10pt Bold
Tahoma 10,11,12,14,16,20,21pt
Tahoma 5,6,7,9,10,11,12,13,14,16,20,21 pt bold
Tahoma 12pt Bold Italic

ArmA

Arial Bold 7->24 pt
BitStreamVersans bold 7->20, 22, 28 pt
Zeppelin32 12->20,22,28 pt
Zeppelin33 12->20,22,28 pt
Zeppelin33 12->20,22,28 pt italic