vispy.visuals.text.text module

class vispy.visuals.text.text.FontManager(method='cpu')

Bases: object

Helper to create TextureFont instances and reuse them when possible

get_font(face, bold=False, italic=False)

Get a font described by face and size

class vispy.visuals.text.text.SDFRendererCPU

Bases: object

Render SDFs using the CPU.

render_to_texture(data, texture, offset, size)
class vispy.visuals.text.text.TextVisual(text=None, color='black', bold=False, italic=False, face='OpenSans', font_size=12, pos=[0, 0, 0], rotation=0.0, anchor_x='center', anchor_y='center', method='cpu', font_manager=None)

Bases: vispy.visuals.visual.Visual

Visual that displays text

textstr | list of str

Text to display. Can also be a list of strings. Note: support for list of str might be removed soon in favor of text collections.

colorinstance of Color

Color to use.


Bold face.


Italic face.


Font face to use.


Point size to use.

postuple | list of tuple

Position (x, y) or (x, y, z) of the text. Can also be a list of tuple if text is a list.


Rotation (in degrees) of the text clockwise.


Horizontal text anchor.


Vertical text anchor.


Rendering method for text characters. Either ‘cpu’ (default) or ‘gpu’. The ‘cpu’ method should perform better on remote backends. The ‘gpu’ method should produce higher quality results.

font_managerobject | None

Font manager to use (can be shared if the GLContext is shared).

property anchors
property bold
property color

The color of the text

property face
property font_size

The font size (in points) of the text

property italic
property pos

The position of the text anchor in the local coordinate frame

property rotation

The rotation of the text (clockwise, in degrees)

property text

The text string

class vispy.visuals.text.text.TextureFont(font, renderer)

Bases: object

Gather a set of glyphs relative to a given font name and size

This currently stores characters in a TextureAtlas object which uses a 2D RGB texture to store unsigned 8-bit integer data. In the future this could be changed to a GL_R8 texture instead of RGB when OpenGL ES 3.0+ is standard. Since VisPy tries to stay compatible with OpenGL ES 2.0 we are using an RGB texture. Using a single channel texture should improve performance by requiring less data to be sent to the GPU and to remote backends (jupyter notebook).


Dict with entries “face”, “size”, “bold”, “italic”.

rendererinstance of SDFRenderer

SDF renderer to use.

property ratio

Ratio of the initial high-res to final stored low-res glyph

property slop

Extra space along each glyph edge due to SDF borders