Skip to content

text

text(
text_string,
size,
origin=(0, 0),
rotation=0,
x_reflection=False,
typeface=0,
)

Create polygonal text.

The typefaces are designed such that the minimal edge size in the resulting polygons is size * 0.025 and the all rotation angles between adjacent edges are less than 90 degrees (with tolerance of 1%). Additionally, glyphs in typeface 0 contain no holes.

Args

  • text_string (str): String to convert into polygons.
  • size (float): Font scaling. This is the maximal vertical dimension if each glyph.
  • origin (Sequence[float] | complex): Lower left anchor for the first line of text.
  • rotation (float): Text rotation (in degrees).
  • x_reflection (bool): Reflection across the horizontal axis.
  • typeface (Literal[0, 1]): Typeface to use. Two types are available. Type 0 does not include any holes in polygon; type 1 does.

Returns

list[Polygon]: List of polygons.

Note

Only printable ASCII characters can be rendered. The full list can be obtained in the string module: string.printable.