In-game font

From LBA File Information
Jump to: navigation, search
In-game font




Programs supporting this format

Find entries of this type

LFN files contain fonts used to display in-game dialogs.


 LBA font file format
 Author: Kazimierz Król (zink)
 Revision: 1.01

 Font file is second entry of ress.hqr package for both LBA 1 and 2.

 The first 1024 bytes are offsets of 256 characters (4 bytes per char).
 The offset #256 is the length of entire file.

 The next data contains character maps.
  First 4 bytes of each one are in turn:
   - char width - may be any value from 0 to 255, but LBA 1 will not properly display characters with width higher than 33. This limitation work only for conversation texts. In menus characters with width more than 33 are displayed correctly. I didn't test the maximum value for LBA 2.
   - char height - mame as above, but no LBA 1 limitation,
   - on-screen offset X - distance from origin point in x axis,
   - on-screen offset Y - distance from origin point in Y axis (described more precisely below),
  The next one byte says how many sub-lines one line of the image contains.
  The next two bytes describes the lengths of these sub-lines. They starts from non-visible one. Sum of their lengths must equal the character width.
   Example: line of image (= - transparent, X - non-transparent): XXX==XXXXXXX=XXX.
    The line contains 6 sub-lines (first is zero length).
    Bytes of this line should be (from fifth one):
     #06 - the line has 6 sub-lines
     #00 - first sub-line is 0 length because each line must begin from transparent sub-line,
     #03 - second sub-line is 3 lenght
     #02 - ...and so on...
  The next byte describes the length of the next line. Amount of char lines must fit the char height.
  After last line the next char map begins (width, height, etc.). And so on to the map of the last character.

 Understanding on-screen offset
 It describes what distance the character is from origin point. Origin point is defined by the game.
 Exmaple: a character displayed in game (o - transparent, * - pixels, + - origin point):


 The game starts drawing the char from point that is at on-screen offset x's and on-screen offset y's pixel away from origin point. The example character should have these values set to:
 - on-screen offset x = 4,
 - on-screen offset y = 3,
 it means, that it's top left corner will be at point: x = origin_point_x + 4
                                                         y = origin_point_y + 3
 In other words the on-screen is the vector, which the char is shifted by from the origin point.

Information provided by: Zink