Text

Function
This useful function calls on software basically identical to GL Render for character generation. You can type in your text, or use variables and links to insert characters, making it an ideal tool for generating slates. There is an example at the end of this page.

You can use any TrueType (.ttf) and Type 1 (Postscript, .pfa for ASCII and .pfb for binary) fonts. If an Adobe Font Metrics (.afm) file is present for the font (i.e., you have both MyFont.pfa and MyFont.afm), it is supported and provides kerning for the font. Shake will first look for fonts in its distribution directory, under fonts. You can also place them in a direct path by setting the environment variable NR_FONT_PATH. Finally, Shake will also detect fonts placed in the standard directories for your OS:

NT: [SystemDrive]:\Windows\Fonts
SGI: /usr/lib/X11/fonts/Type1

This function uses the Shake implementation of the GL Render. It allows you to not only manipulate the characters in 3D space (including X,Y,Z position, rotation, and scaling), but also a camera field of view. Because of this, if you are animating the fonts, it is better to do it within the Text (or AddText) function, as this will ensure crisp, clean edges.

When selecting a font in the interface, remember that right-clicking on the font name in pop-up menu allows you to quickly test the font without closing the pop-up menu. Click with the left button to open the menu, drag to a blank space at the end of the list, and right-click. Now test your fonts with right-click. To validate your selection, use the left button.

You can also use these shortcuts at any time without any special formating:

Text Shortcut: writes:
{parameter}

prints either the local or global parameter value, ie
Script={scriptName}
would write
Script=My_Script.shk

{nodeName.parameter}

prints the parameter's value from a selected node, ie
Red Val = {Mult1.red}
could write
Red Val = .6

\n

New line. Example:

Hello\nWorld

returns

Hello
World

%f unpadded frame number
%F 4-digit padded frame number
%t short non-dropframe time code: no 00: (if not needed)
%T long non-dropframe time code: hr:mn:sc:fr
%tD short dropframe time code: no 00: (if not needed)
%TD long dropframe time code: hr:mn:sc:fr
%H host name
%U username
%c,%C locale's center
%d locale's day 01-31
%D locale's abbreviated day name: Wed
%E locale's full day name: Wednesday
%m locale's month: 01-12
%M locale's abbreviated month name: Nov
%N locale's full month name: November
%x,%X full date representation: mm/dd/yy
%y year without century: 00-99
%Y year as ccyy

Examples 1:

Text String writes:
My name is Dufus
My name is Dufus
My name is %U

If login = Dufus:

My name is Dufus
My name is %U.\nToday is %M. %d
My name is Dufus.
Today is Nov. 12
Mult red = {Mult1.red}

Assuming the node Mult1 exists, and the red value is .46:

Mult red = .46


Finally, you can also use full C formatting for your strings. The use of this is initialized with a : at the start of the text string:

: stringf(
  "Red = %4.2f  at Frame %03d", 
  Grad1.red1, time
)

To append strings from another parameter, use something like this:

in Text1.text:    Hello
in Text2.text:    : Text1.text + " World" 
Parameters
Type
Defaults
Function
width,height
int
GetDefaultWidth(), GetDefaultHeight() The width and height of the image
bytes
int
1 The bit-depth of the image. 1 = 8 bits, 2 = 16 bits, 4 = 32 bits, or float.
text
string
text The characters to be printed
font
string
  The font to be used.
x,yFontScale
float
100, xFontScale The x and y scaling of the font
leading
float
1 The amount of spacing between each line
x, y, zPos
float
width/2, height/2, 0 The 3D position of the characters.
xAlign
int
1 The horizontal alignment of the fonts. 1 = left, 2 = center, 3 = right alignment
yAlign
int
1 The vertical alignment of the fonts. 1 = up, 2 = center, 3 = down.
red, green, blue, alpha
float
1, 1, 1, 1 The color of the text
x, y, zAngle
float
0, 0, 0

The 3D rotation angles of the text.

fieldOfView
float
45 The aperture angle in degrees of the virtual camera.
kerning float 0 The spacing between each letter. You can also have negative values.
fontQuality float 1 The polygonalization factor of the font splines. We have conservatively set this to a high value. For flat artwork, you can probably get away with a value of 0. When you have extreme perspective, you will want to keep it high.

Synopsis

image Text( 
  image,
  int width,
  int height,
  int bytes, 
  const char * text,
  const char * font,
  float xFontScale,
  float yFontScale,
  float leading,
  float xPos,
  float yPos,
  float zPos,
  int xAlign,
  int yAlign,
  float red,
  float green,
  float blue,
  float alpha,
  float xAngle,
  float yAngle,
  float zAngle,
  float fieldOfView,
  float kerning,
  float fontQuality
);

Script

image Text( 
  image, 
  width,
  height,
  bytes,
  "text",
  "font",
  xFontScale,
  yFontScale,
  leading,
  xPos,
  yPos,
  zPos,
  xAlign,
  yAlign,
  red,
  green,
  blue,
  alpha,
  xAngle,
  yAngle,
  zAngle,
  fieldOfView,
  kerning,
  fontQuality
);

Command Line

-text text font xScale yScale etc...

Example 2

slatemacro.shk

This macro is to set a FileOut, and inserts a slate at the frame before the first frame, i.e. if your frame range is 1-100, frame 0 gets a printed slate. Load the script up in the interface to see what it does, moving the time slider from frame 1 to 0. There are 3 text generators. One (AText1) provides the headers (ie, "Shot:", "Show:", "Frame Range", etc. The second one (AddText2) gets the information either from the script, or as inputs to the macro that are provided by the user. A last text generator (AddText1) will print the frame number in the corner if markFrame is set to 1. Open up the macro in the interface by putting the cursor over mySlate and hitting enter. Then go ahead an view the parameters for each sub-node. Or, of course, just open the script in a text editor.

See Also
AddText