Skip to content
Dustin edited this page Mar 26, 2015 · 5 revisions

The STRINGS file contains a list of strings to be rendered into alpha textures at compile time. Using pre-rendered strings can speed up the OpenGL rendering cycle as only one texture is used per string. The format of the file entries is:

<ttf font name> <point size> "text" <label>

The font name refers to a truetype font in the ./fonts framework subdirectory, and label is the identifier used within the application. For example:

cmss.ttf 24 '$/lambda$Native HelloWorld slash_/this' title

This will render the string at a point size of 24 using the Computer Modern Sans Serif font and generate a texture title.img that can be used in the application code.

Strings are rendered using unicode xelatex. LaTeX commands use forward slashes in order to prevent shell parsing issues. Two forward slashes will insert a new line, and a forward slash can be escaped with an underscore prefix.

An optional Script parameter can be used for rendering combined characters from a given script. Make sure that the font you use contains the necessary characters. For example, the following renders the translation of the word "yes" in Khmer with proper combining of characters, unlike the circles that appear here on the wiki.

Busra-R.ttf 24 'រឹមត្រូវ' yes Script=Khmer

Using the created texture in a (glgui-pixmap):

(set! gui (make-glgui))
(glgui-pixmap gui 10 10 yes.img White)

Clone this wiki locally