Skip to content

fontlabapp.fontui.teaching_painter.polygon · declarations 001

Back to fontlabapp.fontui.teaching_painter.polygon

current_svg

current_svg(tips: int, outer: float, inner: float, rotation: float) -> str

Read and fence the current font UPM. Refuse a missing or changed font.

draw_current

draw_current(tips: int, outer: float, inner: float, rotation: float, *, disclosure: dict[str, Any] | None = None) -> None

Append one closed contour, fence context and check attached node geometry.

layer_geometry

layer_geometry(layer: Any, qt: Any) -> tuple

Snapshot each shape's transform basis, closure and raw/transformed nodes.

Plain values preserve shape boundaries and order without comparing wrappers or shape ids. Both raw and placed points catch compensating transform edits.

main

main() -> Any

Compatibility entrypoint for the retained standalone lesson.

panel_type

panel_type(qt: Any) -> type

Open the shared App panel. Keep native imports lazy until menu use.

polygon_points

polygon_points(upm: float, tips: int, outer: float, inner: float, rotation: float) -> list[tuple[float, float]]

Return Y-up points centred at the origin. Radii are em fractions.

Reject invalid values before computing floating-point coordinates. Preview uses these points. SVG formats six decimals; Draw rounds the translated points to whole units. Keep both radii inside the em square.

polygon_svg

polygon_svg(upm: float, tips: int, outer: float, inner: float, rotation: float) -> str

Return Y-down SVG in an em square for an external vector editor.

round_unit

round_unit(value: float) -> float

Round a finite coordinate half-up to whole units; ties go away from zero.

save_svg

save_svg(filename: str, text: str) -> None

Save generated SVG to a new absolute path; never replace a file or link.