SpriteText

SpriteText is a special Sprite that draws 3D, polygonal text into perspective space. Unlike TagText and the text() and font() functions it actually manifests the text as polygon meshes. Such text can be shaded and transformed like any other geometry. Just as TagText, SpriteText compiles the text to display lists. SpriteText can also be conveniently subclassed to create more specialized text sprites.

SpriteText(parent, name, size, typeface)

  • parent ... the world or another sprite in which this sprite should be nested.
  • name ... the name of this sprite, names have to be unique within the parent element
  • size ... size of the font
  • typeface ... a key for build-in typefaces or a file path to a TrueType file. See font() for valid keys.

<spritetext>.setText(text)
  • text ... that should be printed by the SpriteText object

<spritetext>.setColor(r, g, b, a)
  • r, g, b, a ... red, green, blue, alpha values for the text color, floats from 0.0 to 1.0
<spritetext>.setExtrusion(d)
  • d ... depth of extrusion

Relevant examples: spritetext.py , tagtext.py , text.py , ALL

In Context

class Atlantis(World):
    def onSetup(self):
        self.name = "Typo"
        
        st = SpriteText(self, 'count', 21)
        st.setText('You can read.')
        st.setColor(1.0, 0.5, 0.5, 1.0)
        st.moveBy(1, 0.5, -0.3)
Initiated by Stephan Hechenberger
Thanks to CADRE's 103