use Prima qw(Application CurvedText); $::application-> begin_paint; $::application-> curved_text_out( 'Hello, world!', $::application-> render_spline( [qw(100 100 150 150 200 100)]));
The text begins to plot by drawing the first glyphs at the first path point, unless specified otherwise with the "offset" option. The glyph is plotted with the angle perpendicular to the path segment; therefore the path may contain floating point numbers if futher plotting angle accuracy is desired.
When text cannot be fit along a single segment, it is plotted along the next segment in the path. Depending on the "bevel" boolean option, the next glyph is either simply drawn on the next segment with the angle corresponding to the tangent of that segment (value 0), or is drawn with the normal text concatenation offset, with the angle averaged between tangents of the two segments it is plotted between (value 1). The default value of "bevel" option is 1.
The glyph positioning rules differ depending on "collisions" integer option. If 0 (default), the next glyph position always corresponds with the glyph width as projected to the path. That means, that glyphs will overlap when plotted inside segments forming an acute angle. Also, when plotting along a reflex angle, the glyphs will be visually more distant from each other that when plotted along the straight line.
Simple collision detection can be turned on with setting "collisions" to 1 so that no two neighbour glyphs may overlap. Also, the glyphs will be moved together to the minimal distance, when possible. With this option set the function will behave slower. If detection of not only neighbouring glyphs is required, "collisions" value can be set to 2, in which case a glyph is guaranteedly will never overlap any other glyph. This option may be needed when, for example, text is plotted inside an acute angle and upper parts of glyphs plotted along one segment will overlap with lower parts of glyphs plotted along the other one. Setting "collisions" to 2 will slow the function even more.
The function internally creates an array of tuples where each contains text, plotting angle, and horisontal and vertical coordinates for the text to be plotted. In the array context the function returns this array. In the scalar context the function returns the success flag that is the result of last call to "text_out".