Skip to content

Creating Fonts

Robert Campbell edited this page Jun 3, 2023 · 1 revision

Ultraviolet provides a command line utility for generating font textures and definition files, called uvfont. This utility, along with Ultraviolet's other command line tools, is provided through the Ultraviolet.Tools NuGet package.

The Basics

Generating a simple font is straightforward.

uvfont "Segoe UI"

The above command will generate a texture in the current directory which contains all four faces of the Segoe UI font family. In addition, it will create an XML font definition file with complete kerning information.

The default font size is 16pt. You can override this with the -fontsize parameter:

uvfont "Segoe UI" -fontsize:24

If you don't want to generate all four font faces, you can disable some of them using the -nobold and -noitalic parameters. Note that specifying either of these will disable the BoldItalic face.

uvfont "Segoe UI" -nobold -noitalic

Some fonts, particularly those which are extremely slanted or which have large overhangs, may not generate correctly with the default settings. You can add additional pixels of padding to each glyph with the -overhang parameter, which are automatically accounted for in the kerning data:

uvfont "Palace Script MT" -overhang:16

All of the above commands will generate the standard glyph set. You can generate fonts with a different glyph set by specifying a source text. The font generated by the following command, for example, will only contain glyphs for the letters H e l o , w r d ! ? - note that the substitution glyph ? is always included.

uvfont "Arial" "-sourcetext:Hello, world!"

You can also specify a list of files which contain the source text:

uvfont "Arial" -sourcefile:file1,file2

The generated font will contain all of the glyphs necessary to render the text in the specified files.

If any of the files specified by -sourcefile are Ultraviolet localization databases, uvfont will automatically pull out only the string variants contained therein, ignoring the XML markup around them. You can control which culture's strings are read by this process with the -sourceculture parameter:

uvfont "Arial" -sourcefile:file1 -sourceculture:fr-FR
Clone this wiki locally