🧪 Version 0.3.1 is our alpha release candidate. Please send us bug reports and suggestions!

Sketchingpy

Creative coding and interactive science everywhere for everyone: web, desktop, mobile, Jupyter, and more. Open source!

Reference for set_text_font

Set the type and size of text to draw. This is part of the reference section.

Purpose

Set the size and font to use for drawing text.

Snippet

Draw "Hello World" in 12 point IBM Plex Mono at x coordinate 50 and y coordinate 100.
sketch.set_text_font('./IBMPlexMono-Regular.ttf', 12)
sketch.draw_text(50, 100, 'Hello World')

Parameters

  • font: Path to the TTF or OTF font file. For web renderer, name of web font can be used.
  • size: Size of the font (px).

Examples

Availability

Available for all platforms. On static and app renderers, will interpret path as a local file path using the operating system's conventions. For web, it will interpret path as a URL. Filenames like "example.ttf" will assume the same directory.

See also