Jump to content

Font collection (OpenXcom): Difference between revisions

From UFOpaedia
Redirected page to OpenXcom
Tag: New redirect
Line 1: Line 1:
'''Font collection''' is bitmap fonts used by game engine to represent text.
#REDIRECT [[OpenXcom]]
 
Original UFO/TFTD engine uses two font types: big ([[BIGLETS.DAT]], 16x16 pixels per character) and small ([[SMALLSET.DAT]], 8x9 pixels per character) for Battlescape and Geoscape. But OpenXcom uses four font types: FontBig, FontGeoBig, FontSmall, FontGeoSmall. All of them described in *.dat file (which is actually YAML-file). Default font collection is placed in Language folder and named simply '''Font.dat'''.
 
{|style="background:darkgray; border:1px solid dimgray;color:white" border="0" height="230" align="center" valign="bottom" cellpadding=10px cellspacing=0px
|+style="background:white; color:black"|'''Font.dat''' fonts (gray background used for transparent files)
|-align="center"
 
| [[File:FontBig.png|border|none]]
| [[File:FontGeoBig.png|border|none]]
| [[File:FontSmall.png|border|none]]
| [[File:FontGeoSmall.png|border|none]]
|-align="center" valign="top"
|'''FontBig.png'''
|'''FontGeoBig.png'''
|'''FontSmall.png'''
|'''FontGeoSmall.png'''
|}
 
 
''*.dat'' is divided in two sections: ''chars'' and ''fonts''. ''chars'' is string which contain all available characters, provided by this font collection. ''font'' section is bit more complicated:
 
{| class="wikitable" width="100%"
! width="150"| Value
! width="*"  | Description
! width="80" | Default
|-
| '''id'''
| Type of charmap
| Should be '''FONT_BIG''', '''FONT_SMALL''', '''FONT_GEO_BIG''', or '''FONT_GEO_SMALL'''
|-
| '''image'''
| Relative path to PNG-file with contains actual glyphes
|
|-
| '''width'''
| Width of a character
|
|-
| '''height'''
| Height of a character
|
|-
| '''spacing'''
| Spacing between two characters.
|
|}
 
Each character in PNG-file have own rectangle with ''width'' and ''height''. Characters shouldn't overlapping each other. Characters in *.png-file placed by groups with 16 characters in each group and ordered accordingly ''chars'' string. So if you want find actual character in *.png file, here formula:
 
<code>
y = (''<number in chars>'' div 16) * ''height''
 
x = (''<number in chars>'' mod 16) * ''width''
</code>
 
Here example for default ''Font.dat'':
 
<pre>
chars: >
  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖŐŰÙÚÛÜÝÞŸßàáâãäåæçèéêëìíîïðñòóôõöőűùúûüýþÿФИСВУАПРШОЛДЬТЩЗЙКЫЕГМЦЧНЯфисвуапршолдьтщзйкыегмцчнябБжЖхХъЪэЭюЮĆĘęąŁćłĄŚśźżŻŹŃńĂăȘȚșțČĎĚŇŘŠŤŮŽčďěňřšťůžЄєŒœіІїЇøØĞŞİğşıΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρστυφχψωΆΈΉΊΌΎΏάέήίόύώςΐϊĹĽŔĺľŕ∞Ёё
fonts:
  - id: FONT_BIG
    image: FontBig.png
    width: 16
    height: 16
    spacing: 0
  - id: FONT_SMALL
    image: FontSmall.png
    width: 8
    height: 9
    spacing: -1
  - id: FONT_GEO_BIG
    image: FontGeoBig.png
    width: 5
    height: 9
    spacing: 1
  - id: FONT_GEO_SMALL
    image: FontGeoSmall.png
    width: 5
    height: 7
    spacing: 1
</pre>
 
 
==Customizing==
If you want customize font you can make it as mod. During initialization OpenXcom engine searches in [[Ruleset Reference (OpenXcom)|Ruleset]] ''fontName'' string, which by default is ''Font.dat''. You can redefine this string to another file, for example ''MyFont.dat'', and replace some ''image'' strings to your *.png-files.
 
Just remember, *.dat file should be placed in Language folder, and *.png files are searched relative to *.dat file!
 
 
[[Category:OpenXcom]]

Revision as of 14:00, 10 March 2026

Redirect to: