FURWARE text/TextureCreator
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Overview
FURWARE texture creator is a tool for creating font textures for the FURWARE text script from TrueType/OpenType font files. It offers quite flexible configuration options for tweaking per-font and per-symbol options like offsets and scaling. This enables you to create configuration files for specific fonts to fit perfectly for usage with FURWARE text without any additional, manual tweaking of the resulting textures.
The tool is available as a Python 2 script and a pre-compiled package for Windows; see below.
Mode of operation
The most important items in the texture creator directory are the main program file ("TextureCreator.py" or "TextureCreator.exe"), the "fonts" directory, the "scripts" directory and the "output" directory (which might not exist initially, but it is created automatically by the tool when needed).
The basic mode of operation is to load font files together with any custom configurations from the fonts directory, process them using one or more chain and script file(s) and output the resulting texture to the output directory.
The "fonts" directory contains sub-directories; one for each font. Each of these sub-directories usually contains a font file (TrueType (ttf) or OpenType (otf)). If a sub-directory does not contain any font file, it is silently ignored (please see below why many font sub-directories do not contain font files by default).
The texture creator searches each of the font sub-directories for a font file and if it finds one, it continues by searching for one or more "chain" files which contain commands that shall be executed for creating a texture for the font. Such commands might be (figuratively) "create a texture of a certain size", "draw these symbols using the currently loaded font at certain positions" or "continue with commands in another file".
Thus the "chain" files may be seen as the "entry points" for execution of commands for a certain font. The way the texture creator searches for chain files is as follows: First, the font's directory is searched for chain files; this allows you to specify chains that are specific to the font. Only if no chain files are contained in the font's directory, all chains contained in the "scripts" directory are executed.
Chain files may execute commands contained in other files (".script" files). For instance, the default chain files in the scripts directory execute several script files containing commands for initializing the new texture, drawing basic symbols, special symbols, and so on. Note that the only difference between ".chain" and ".script" files is the file extension; the same set of commands is available in both chain and script files, but only files with the ".chain" extension are used as the entry points for script execution.
Note that, just like chain files, ".script" files are also searched for in the font's directory first, then in the global "scripts" directory. This, again, allows you to bundle custom script files specific to a certain font.
Each font sub-directory may also contain a "font.conf" file for font-specific configuration. These files are different from the chain and script files. They may contain font-specific offset and scaling settings, also for individual symbols of the respective font. Whenever a font is being loaded for drawing (also when it is loaded from other script files), that font's configuration is used.
After all commands in a chain file have been executed, the created texture is written out to the "output" directory. By default, the name of the font directory is used for the texture's name (plus the image format's extension), but that name may be changed using script commands.
Script commands
Will follow soon
How to obtain the tool
The Python 2 code is available at GitHub.
Also, there is a pre-compiled package for Windows available from the FURWARE website.