CryFont is used to generate font textures that are required to render text on the screen. The various features of the font rendering can be seen by using the r_DebugFontRendering console variable.
The output is not only to test the functionality but also to document how the features can be used.
CryFont supports the following features:
Font shaders to configure the appearance of fonts. Multiple passes with configurable offset and color are supported to enable generation of shadows or outlines.
The following XML file shows a sample font shader:
<fontshader> <font path="VeraMono.ttf" w="288" h="416"/> <effect name="default"> <pass> <color r="0" g="0" b="0" a="1"/> <pos x="1" y="1"/> </pass> </effect> <effect name="console"> <pass> <color r="0" g="0" b="0" a="0.5"/> <pos x="2" y="2"/> </pass> </effect> </fontshader>
The attributes w and h of the XML font element specify the width and height of the font texture. The order of the passes in XML defines the order in which the passes are rendered. A pass element without child elements means that the pass is rendered with the default settings. The tag pos allows to offset the font, while color is used to tint it and define the transparency with the alpha channel.