'it' can render text into images using FreeType. Two functions support this.
ice.Image DrawString(string, [width, height], [family, style])
This function creates a single-channel, 8-bit image with the specified string rendered into it. The returned image has a box such that(0, 0) is at the string baseline. The actual height of the image depends on the string itself, but it is always possible to render a line of text in pieces just by translating by the X size of the previous string rendered.
String to be rendered (str)
Nominal width and height of each character in pixels (list).
(Optional) Font family to use, e.g. Courier (str) and font style to use, e.g. Bold (str). Users are encouraged to use the lists returned from ice.FontChoices().
The above example illustrates the utility of the origin being at the baseline: individual strings have different bounding boxes, but are arranged such that concatenation simply requires the use of an x offset. Note that for the purposes of the above example we could just have rendered both words as a single string.
DrawString always returns a single-channel, 8-bit image. IceMan's built-in operations can be used very easily to create color and transparency as desired.
This function returns a List of Lists enumerating the various font family-style combinations available for use. If called with no argmuents it returns the list of fonts installed on the current system. If called with a single file name argument that file is expected to be a text file where each line has three tab delimited columns of "family", "style" and "font file path". To define a mapping between a family and style to a particular font file user the second form of FontChoices.
(Optional) File to get font mappings from. (str)
(Optional) A font family name (str).
(Optional) The style name (str).
(Optional) Path to the font file (str).