How to fit and wrap text inside SVG polygon

I simply want to know how to generate an SVG path that centers, fits, and curves inside of a SVG polygon. I assume the method of doing this would be through Javascript. Reference below.

enter image description here

2 thoughts on “How to fit and wrap text inside SVG polygon”

  1. As described by Noah Veltman in this post, the basic process is:

    1. Turn the shape into a polygon of evenly-spaced points.
    2. Generate a Voronoi diagram of those points.
    3. Clip the edges.
    4. Turn the edges into a graph.
    5. Find the "longest shortest path" between any pair of perimeter nodes.
    6. Smooth/simplify that path a bit.
    7. Place text along the smoothed centerline with a .

    See also this source.


Leave a Comment