This is RenderMan 21 Documentation you are viewing. The Rmanwiki home page will redirect you to the current documentation.

Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

'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) 


 (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().


Code Block
# Make the "Hello"
f = ice.FontChoices()[0]
label1 = ice.DrawString("Hello ", (50, 50), f) 
label2 = ice.DrawString("World!", (50, 50), f) 
# X offset calculation: just grab the x size of the first label 
# and use it to translate the second before addition 
offset = [label1.DataBox()[1], 0]
result = label1.Add(label2.Translate(offset))


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.

list FontChoices(fontMapFile)

list FontChoices(family,style,path)

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) Path to the font file (str).


Code Block
# List all the fonts that are currently available for use
for f in ice.FontChoices(): print