text

photonforge.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.

Parameters:
  • 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 of polygons.

Return type:

list[Polygon]

Note

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