• Creates a pattern containing text.

    This is demonstrated in the following sample code:

      const textPattern = text({text: ["Read me"], textStyle: { font: "Arial, sans-serif", fill: "rgb(0, 0, 0)"}});

    const complexStrokedLineStyle = {
    decorations: [{
    location: 0.5,
    pattern: textPattern
    }],
    fallback: parallelLine()
    };

    Results in:

    PatternFactory.text illustration

    Note that the following TextStyle properties, affecting the position of the text, are ignored:

    To offset text vertically, use offset. To offset text horizontally, use append to insert a pattern before the text pattern.

    Parameters

    • options: TextPatternOptions

      An object literal describing the configuration of the pattern.

    Returns Pattern