OpenFresco.Svg (open_fresco v0.1.0)

Copy Markdown View Source

Scene → SVG generator. The shared intermediate representation: the editor preview and (later) the PNG rasterizer both consume this output, so what you edit is what renders.

Pure and deterministic — render/3 is a function of (scene, values). All user-authored strings are XML-escaped, and canvas dimensions are clamped as an OOM guard.

Text word-wraps to its box width using a character-count estimate (~0.55em, matching og), honors explicit \n breaks, and vertically aligns via valign. This estimate is a Phase-2 stepping stone; measurement-accurate wrap (same wrap points as the rasterizer paints) lands with the font stack in a later phase. Anchor reflow and button auto-width are likewise later — this generator lays out by explicit boxes.

Summary

Functions

Render a scene to an SVG binary, resolving values.

Functions

render(scene, values \\ %{}, opts \\ [])

@spec render(OpenFresco.Scene.t(), map(), keyword()) :: binary()

Render a scene to an SVG binary, resolving values.

Options:

  • :globals — a map of [[global]] values (site host, page URL, locale…) merged with values before substitution. Slot values win on a key collision.
  • :max_dimension — clamp canvas width/height (default 10_000).