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

Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »


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

[width, height]

Nominal width and height of each character in pixels (list). 

[family, style]

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


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

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.

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) A font family name (str).


(Optional) The style name (str).


(Optional) Path to the font file (str).


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