Difference between revisions of "Fonts.tbl"

From FreeSpace Wiki
Jump to: navigation, search
m
(General Info: OTF is supported)
 
(11 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
{{SCP_table}}
 
{{SCP_table}}
 +
{{TableVersionGit|2016-08-02|b4db345}}
 +
{{Tables}}
 +
The '''fonts.tbl''' is a recent addition to the SCP allowing the definition of non-standard fonts. The number of possible fonts is unlimited. The HUD gauges, show-subtitle-text sexp and the [[Fiction Viewer|fiction viewer]] can be manually set to any font in fonts.tbl. The rest of the fonts used in FSO (e.g. techroom text) are hardcoded to one of the first three fonts that are parsed.
  
{{TableVersion|5751}}
+
This table is one of the [[Modular Tables]] and can be extended with xxx-fnt.tbm
  
The '''fonts.tbl''' is a recent addition to the SCP allowing the definitiion of non-standard fonts at certain places within the game. Currently, fonts.tbl is utilized in only two situations - either as part of the [[Fiction Viewer|fiction viewer]] or with the show-subtitle-text sexp. Currently, up to five fonts are supported.
+
==General Info==
 +
*Begins with #Fonts
 +
*Consists of at least 3 entries
 +
*Ends with #End
  
 +
Currently, there are two different types of supported fonts. The old "VFNT" type (which probably means '''V'''olition '''F'''o'''nt''') and the new TrueType fonts. The old font use the usual ''$Font:'' option while the new fonts use ''$TrueType:''.  TrueType fonts can be TTF or OTF.
  
[[Tables|List of Tables]]
+
===$Font:===
 +
*Lists a font file to use.
 +
*This font type is not supported if the engine is in [[Game_settings.tbl#$Unicode mode:|Unicode text mode]]!
 +
*Syntax: '''String'''
 +
 
 +
====+Name:====
 +
{{Table38|
 +
*Sets the name of this font. Defaults to the specified filename if not provided. Be aware that using a number as the name makes referring to the font by name impossible, as numbers are parsed as the font index not the font name.
 +
*Syntax: '''String'''
 +
}}
 +
 
 +
====+Default Special Character Index:====
 +
{{Table372|
 +
*Specifies the index of the first special character (e.g., infinity symbol, "match speed" icon) in the font. Must be within the range of 0-249. Does not apply to language entries below that use [[Fonts.tbl#+Special Character Index:|+Special Character Index:]].
 +
*Syntax: '''Integer'''
 +
{{Note|If this parameter is used with the first font, it will override all uses of +Special Character Index: in [[strings.tbl]].}}
 +
}}
 +
 
 +
====+Language:====
 +
{{Table372|
 +
*Specifies the name of a language.
 +
*Currently used for overriding the value of [[Fonts.tbl#+Default Special Character Index:|+Default Special Character Index:]].
 +
*Syntax: '''String'''
 +
 
 +
=====+Special Character Index:=====
 +
*Overrides the value of [[Fonts.tbl#+Default Special Character Index:|+Default Special Character Index:]] for this language.
 +
*Syntax: '''Integer'''
 +
}}
 +
 
 +
====+Top offset:====
 +
{{Table38|
 +
*Specifies the top offset for this font. See [[Fonts.tbl|Top and Bottom offsets]] for more information.
 +
*Syntax: '''float'''
 +
}}
 +
 
 +
====+Bottom offset:====
 +
{{Table38|
 +
*Specifies the bottom offset for this font. See [[Fonts.tbl|Top and Bottom offsets]] for more information.
 +
*Syntax: '''float'''
 +
}}
 +
 
 +
===$TrueType:===
 +
{{Table38|
 +
*Lists a font file to use.
 +
*Syntax: '''String'''
 +
}}
 +
{{Table210|
 +
As of 21.0, this can be OTF in addition to the previously supported TTF.}}
 +
 
 +
====+Name:====
 +
{{Table38|
 +
*Specifies the name of this font, defaults to '''<fontFilename>-<fontSize>'''. Be aware that using a number as the name makes referring to the font by name impossible, as numbers are parsed as the font index not the font name.
 +
*Syntax: '''String'''
 +
}}
 +
 
 +
====+Size:====
 +
{{Table38|
 +
*Specifies the size of the font, defaults to 8.
 +
*Syntax: '''float''', must be greater than 0
 +
}}
 +
 
 +
====+Top offset:====
 +
{{Table38|
 +
*Specifies the top offset for this font. See [[Fonts.tbl|Top and Bottom offsets]] for more information.
 +
*Syntax: '''float'''
 +
}}
 +
 
 +
====+Bottom offset:====
 +
{{Table38|
 +
*Specifies the bottom offset for this font. See [[Fonts.tbl|Top and Bottom offsets]] for more information.
 +
*Syntax: '''float'''
 +
}}
 +
 
 +
====+Letter spacing:====
 +
{{Table38|
 +
*Specifies the letter spacing. Defaults to 0.
 +
*Syntax: '''float''', must be greater or equal to 0.
 +
}}
 +
 
 +
====+Special Character Font:====
 +
{{Table38|
 +
*Specifies the VFNT file to use for the special characters. FSO uses a few special characters for a few things that are not present in standard TrueType fonts. To fix this you can specify a VFNT file from which these characters are loaded. This defaults to '''font01.vf''' which is a default font file from FS2 retail.
 +
*This option not needed and not supported if the engine is in [[Game_settings.tbl#$Unicode mode:|Unicode text mode]]!
 +
*Note! Pointing this to the fifth font entry or later can cause crashes, especially on standalones. See Cyborg for questions until this limit is removed.
 +
*Syntax: '''String'''
 +
}}
 +
 
 +
==Top and Bottom offsets==
 +
The top and bottom offsets can be used to influence the line spacing for a specific font. Before rendering '''top offset''' vertical pixels are skipped. Then the text is rendered and then another '''bottom offset''' pixels are skipped.
  
 
==Sample Entry==
 
==Sample Entry==
Line 15: Line 110:
 
$Font: font02.vf
 
$Font: font02.vf
 
$Font: font03.vf
 
$Font: font03.vf
 +
 +
$TrueType: arial.ttf
 +
+Name: Arial
 +
+Size: 12
  
 
#End
 
#End

Latest revision as of 02:12, 10 March 2024

This feature requires FreeSpace Open

Revision information.....

FSO Git Commit: Date: 2016-08-02 SHA: b4db345
Note: Please update the revision information when the page is updated. If your edit had nothing to do with new code entries then please do not edit the revision information


List of Tables and related code files
* Notes Modular Tables
** Notes tables which only use modular tables
Ai.tbl* /ai/aicode.cpp
Ai_profiles.tbl* /ai/ai_profiles.cpp
Animation.tbl** /model/modelanimation.cpp
Armor.tbl* /ship/ship.cpp
Asteroid.tbl* /asteroid/asteroid.cpp
Autopilot.tbl* /autopilot/autopilot.cpp
Cheats.tbl* /cheats_table/cheats_table.cpp
Colors.tbl* /globalincs/alphacolors.cpp
Curves.tbl* /math/curves.cpp
Controlconfigdefaults.tbl /controlconfig/controlsconfigcommon.cpp
Credits.tbl* /menuui/credits.cpp
Cutscenes.tbl* /cutscene/cutscenes.cpp
Decals.tbl** /decals/decals.cpp
Fireball.tbl* /fireball/fireballs.cpp
Fonts.tbl* /graphics/font.cpp
Game_settings.tbl* /mod_table/mod_table.cpp
Glowpoints.tbl* /model/modelread.cpp
Help.tbl* /gamehelp/contexthelp.cpp
Hud_gauges.tbl* /hud/hudparse.cpp
Icons.tbl* /mission/missionbriefcommon.cpp
Iff_defs.tbl* /iff_defs/iff_defs.cpp
Keywords.tbl* Not In Codebase
Lighting_Profiles.tbl* /lighting/lighting_profiles.cpp
Lightning.tbl* /nebula/neblightning.cpp
Mainhall.tbl* /menuui/mainhallmenu.cpp
Medals.tbl* /stats/medals.cpp
Messages.tbl* /mission/missionmessage.cpp
Mflash.tbl* /weapon/muzzleflash.cpp
Music.tbl* /gamesnd/eventmusic.cpp
Nebula.tbl* /nebula/neb.cpp
Objecttypes.tbl* /ship/ship.cpp
Options.tbl* Not In Codebase
Particle effects(-part.tbm)** /particle/effects...
Post_processing.tbl /graphics/gropenglpostprocessing.cpp
Rank.tbl* /stats/scoring.cpp
Scpui.tbl* Not In Codebase
Scripting.tbl* /parse/scripting.cpp
Ships.tbl* /ship/ship.cpp
Sexps.tbl** /parse/sexp/sexp_lookup.cpp
Sounds.tbl* /gamesnd/gamesnd.cpp
Species_defs.tbl* /species_defs/species_defs.cpp
Species.tbl* /menuui/techmenu.cpp
Ssm.tbl* /hud/hudartillery.cpp
Stars.tbl* /starfield/starfield.cpp
Strings.tbl* /localization/localize.cpp
Tips.tbl* /menuui/playermenu.cpp
Traitor.tbl* /stats/scoring.cpp
Tstrings.tbl* /localization/localize.cpp
Virtual_pofs.tbl* /model/modelreplace.cpp
Weapon_expl.tbl* /weapon/weapons.cpp
Weapons.tbl* /weapon/weapons.cpp

The fonts.tbl is a recent addition to the SCP allowing the definition of non-standard fonts. The number of possible fonts is unlimited. The HUD gauges, show-subtitle-text sexp and the fiction viewer can be manually set to any font in fonts.tbl. The rest of the fonts used in FSO (e.g. techroom text) are hardcoded to one of the first three fonts that are parsed.

This table is one of the Modular Tables and can be extended with xxx-fnt.tbm

General Info

  • Begins with #Fonts
  • Consists of at least 3 entries
  • Ends with #End

Currently, there are two different types of supported fonts. The old "VFNT" type (which probably means Volition Font) and the new TrueType fonts. The old font use the usual $Font: option while the new fonts use $TrueType:. TrueType fonts can be TTF or OTF.

$Font:

  • Lists a font file to use.
  • This font type is not supported if the engine is in Unicode text mode!
  • Syntax: String

+Name:

FS2 Open, 3.8:
  • Sets the name of this font. Defaults to the specified filename if not provided. Be aware that using a number as the name makes referring to the font by name impossible, as numbers are parsed as the font index not the font name.
  • Syntax: String

+Default Special Character Index:

FS2 Open, 3.7.2:
  • Specifies the index of the first special character (e.g., infinity symbol, "match speed" icon) in the font. Must be within the range of 0-249. Does not apply to language entries below that use +Special Character Index:.
  • Syntax: Integer
Note: If this parameter is used with the first font, it will override all uses of +Special Character Index: in strings.tbl.

+Language:

FS2 Open, 3.7.2:
+Special Character Index:

+Top offset:

FS2 Open, 3.8:

+Bottom offset:

FS2 Open, 3.8:

$TrueType:

FS2 Open, 3.8:
  • Lists a font file to use.
  • Syntax: String
FS2 Open, 21.0: As of 21.0, this can be OTF in addition to the previously supported TTF.

+Name:

FS2 Open, 3.8:
  • Specifies the name of this font, defaults to <fontFilename>-<fontSize>. Be aware that using a number as the name makes referring to the font by name impossible, as numbers are parsed as the font index not the font name.
  • Syntax: String

+Size:

FS2 Open, 3.8:
  • Specifies the size of the font, defaults to 8.
  • Syntax: float, must be greater than 0

+Top offset:

FS2 Open, 3.8:

+Bottom offset:

FS2 Open, 3.8:

+Letter spacing:

FS2 Open, 3.8:
  • Specifies the letter spacing. Defaults to 0.
  • Syntax: float, must be greater or equal to 0.

+Special Character Font:

FS2 Open, 3.8:
  • Specifies the VFNT file to use for the special characters. FSO uses a few special characters for a few things that are not present in standard TrueType fonts. To fix this you can specify a VFNT file from which these characters are loaded. This defaults to font01.vf which is a default font file from FS2 retail.
  • This option not needed and not supported if the engine is in Unicode text mode!
  • Note! Pointing this to the fifth font entry or later can cause crashes, especially on standalones. See Cyborg for questions until this limit is removed.
  • Syntax: String

Top and Bottom offsets

The top and bottom offsets can be used to influence the line spacing for a specific font. Before rendering top offset vertical pixels are skipped. Then the text is rendered and then another bottom offset pixels are skipped.

Sample Entry

#Fonts

$Font: font01.vf
$Font: font02.vf
$Font: font03.vf

$TrueType: arial.ttf
 +Name: Arial
 +Size: 12

#End

Sample Entry (Fiction Viewer)

#Fiction Viewer

$File: [text file]
$Font: [font file]

References

  1. "Re: Feature Request: 4th font (especially for fiction viewer)", Hard Light Productions Forums, Hard Light Productions, 24-12-2009. Retrieved on January 28, 2011.