Reference:Text

From POV-Wiki
Jump to navigation Jump to search

A text object creates 3-D text as an extruded block letter. Currently only TrueType fonts (ttf) and TrueType Collections (ttc) are supported but the syntax allows for other font types to be added in the future. If TrueType Collections are used, the first font found in the collection will be used. The syntax is:

TEXT_OBECT:
  text {
    ttf "fontname.ttf/ttc" "String_of_Text"
    Thickness, <Offset>
    [OBJECT_MODIFIERS...]
    }

Where fontname.ttf or fontname.ttc is the name of the TrueType font file. It is a quoted string literal or string expression. The string expression which follows is the actual text of the string object. It too may be a quoted string literal or string expression. See section Strings for more on string expressions.

In version 3.7 several fonts are now built-in. It should be noted that this is only a preliminary solution so the benchmark program will run without installing POV-Ray. Future versions may lack this mechanism, so in scene files (other than the built-in benchmark) you should continue to reference the external font files as before. Consequently, the following alternate syntax is available:

TEXT_OBECT:
  text {
    internal Font_Number "String_of_Text"
    Thickness, <Offset>
    [OBJECT_MODIFIERS] }
    }

Where Font_Number is one of the integer values from the list below:

  1. povlogo.ttf
  2. timrom.ttf
  3. cyrvetic.ttf
  4. crystal.ttf

Note: An out of range Font_Number value will default to 0.

The text will start with the origin at the lower left, front of the first character and will extend in the +x-direction. The baseline of the text follows the x-axis and descender drop into the -y-direction. The front of the character sits in the x-y-plane and the text is extruded in the +z-direction. The front-to-back thickness is specified by the required value Thickness.

Characters are generally sized so that 1 unit of vertical spacing is correct. The characters are about 0.5 to 0.75 units tall.

The horizontal spacing is handled by POV-Ray internally including any kerning information stored in the font. The required vector <Offset> defines any extra translation between each character. Normally you should specify a zero for this value. Specifying 0.1*x would put additional 0.1 units of space between each character. Here is an example:

text {
  ttf "timrom.ttf" "POV-Ray" 1, 0
  pigment { Red }
  }

Only printable characters are allowed in text objects. Characters such as return, line feed, tabs, backspace etc. are not supported.

For easy access to your fonts, set the Library_Path to the directory that contains your font collection.