TextBuilder

Builder for SVG text (<text>) element. This class provides methods to set attributes specific to the <text> element, such as position, font properties, and content.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
fun attr(name: String, value: Number)

Sets an attribute on the SVG element with a numeric value.

fun attr(name: String, value: String)

Sets an attribute on the SVG element with a string value.

Link copied to clipboard
fun className(value: String)

Sets the class attribute of the SVG element.

Link copied to clipboard
fun clipPath(value: String)

Sets the clip-path attribute of the SVG element.

Link copied to clipboard
fun content(text: String)

Sets the content of the text element.

Link copied to clipboard
fun dx(value: Number)

Sets the dx attribute of the text, which defines a horizontal shift from the current text position.

Link copied to clipboard
fun dy(value: Number)

Sets the dy attribute of the text, which defines a vertical shift from the current text position.

Link copied to clipboard
fun fill(color: Color)

Sets the fill attribute of the SVG element with a Color object.

fun fill(color: String)

Sets the fill attribute of the SVG element with a color string.

Link copied to clipboard
fun fillOpacity(value: Number)

Sets the fill-opacity attribute of the SVG element.

Link copied to clipboard
fun fillRule(value: String)

Sets the fill-rule attribute of the SVG element.

Link copied to clipboard
fun filter(value: String)

Sets the filter attribute of the SVG element.

Link copied to clipboard
fun fontFamily(value: String)

Sets the font-family attribute of the text, which defines the font family used to render the text.

Link copied to clipboard
fun fontSize(value: Number)

Sets the font-size attribute of the text, which defines the size of the font used to render the text.

Link copied to clipboard
fun fontStyle(value: String)

Sets the font-style attribute of the text, which defines the style of the font (e.g., "normal", "italic").

Link copied to clipboard
fun fontWeight(value: String)

Sets the font-weight attribute of the text, which defines the weight (thickness) of the font.

Link copied to clipboard
fun id(value: String)

Sets the id attribute of the SVG element.

Link copied to clipboard
fun mask(value: String)

Sets the mask attribute of the SVG element.

Link copied to clipboard
fun opacity(value: Number)

Sets the opacity attribute of the SVG element.

Link copied to clipboard
fun stroke(color: Color)

Sets the stroke attribute of the SVG element with a Color object.

fun stroke(color: String)

Sets the stroke attribute of the SVG element with a color string.

Link copied to clipboard

Sets the stroke-dasharray attribute of the SVG element.

Link copied to clipboard

Sets the stroke-dashoffset attribute of the SVG element.

Link copied to clipboard
fun strokeLinecap(value: String)

Sets the stroke-linecap attribute of the SVG element.

Link copied to clipboard

Sets the stroke-linejoin attribute of the SVG element.

Link copied to clipboard
fun strokeOpacity(value: Number)

Sets the stroke-opacity attribute of the SVG element.

Link copied to clipboard
fun strokeWidth(value: Number)

Sets the stroke-width attribute of the SVG element.

Link copied to clipboard
fun style(value: String)

Sets the style attribute of the SVG element.

Link copied to clipboard
fun textAnchor(value: String)

Sets the text-anchor attribute of the text, which defines the alignment of the text relative to its starting point.

Link copied to clipboard

Sets the text-decoration attribute of the text, which defines the decoration applied to the text (e.g., "underline", "line-through").

Link copied to clipboard
fun transform(value: String)

Sets the transform attribute of the SVG element.

Link copied to clipboard
fun tspan(block: TSpanBuilder.() -> Unit)

Adds a <tspan> child element to the text element.

Link copied to clipboard
operator fun String.unaryPlus()

Sets the content of the text element using the unary plus operator.

Link copied to clipboard
fun x(value: Number)

Sets the x attribute of the text, which defines the x-coordinate of the text's starting point.

Link copied to clipboard
fun y(value: Number)

Sets the y attribute of the text, which defines the y-coordinate of the text's starting point.