text_mode()#

Sets the way text draws to the screen, either as texture maps or as vector geometry.

Examples#

1def setup():
2    py5.size(500, 500, py5.PDF, "TypeDemo.pdf")
3    py5.text_mode(py5.SHAPE)
4    py5.text_size(180)
5
6
7def draw():
8    py5.text("ABC", 75, 350)
9    py5.exit_sketch()  # quit the program

Description#

Sets the way text draws to the screen, either as texture maps or as vector geometry. The default text_mode(MODEL), uses textures to render the fonts. The text_mode(SHAPE) mode draws text using the glyph outlines of individual characters rather than as textures. This mode is only supported with the PDF and P3D renderer settings. With the PDF renderer, you must call text_mode(SHAPE) before any other drawing occurs. If the outlines are not available, then text_mode(SHAPE) will be ignored and text_mode(MODEL) will be used instead.

The text_mode(SHAPE) option in P3D can be combined with begin_raw() to write vector-accurate text to 2D and 3D output files, for instance DXF or PDF. The SHAPE mode is not currently optimized for P3D, so if recording shape data, use text_mode(MODEL) until you’re ready to capture the geometry with begin_raw().

Underlying Processing method: textMode

Syntax#

text_mode(mode: int, /) -> None

Parameters#

  • mode: int - either MODEL or SHAPE

Updated on November 12, 2021 11:30:58am UTC