text_path()

Produces the SVG "text" element with a "textPath" sub-element.

Syntax

text_path(
   x STRING,
   y STRING,
   content STRING,
   path STRING
   class STRING )
  RETURNS om.DomNode
  1. x and y define the position of the text.
  2. content is the actual text.
  3. path is the xlink:href reference (without #).
  4. class defines a reference to a CSS style.

Usage

This function creates a "text" SVG DOM element from the parameters, including a "textPath" sub-element that references a "path" element defined in a "defs" element.

The path parameter is used to build an "xlink:href=#path" reference.

The actual path can be created with the path() function, and included in a "defs" element created with the defs() function.

To specify the text font attributes, define a CSS style in a defs() element with the styleList() function, and reference the text style in the class parameter of this function.

Example

DEFINE root_svg, defs, p, n om.DomNode
...
LET defs = fglsvgcanvas.defs( NULL )
CALL root_svg.appendChild( defs )
...
CALL defs.appendChild( p:=fglsvgcanvas.path("M150,400 C175,380 225,320 450,450") )
CALL p.setAttribute("id", "path_1")
LET n = fglsvgcanvas.text_path( NULL,NULL,
           "This text follows a path...","path_1","style_4")
...