SVGBuilderExtensions.AddText

AddText<TBuilder>(this TBuilder, string, OneOf<double, (double, LengthType)>, OneOf<double, (double, LengthType)>, OneOf<double, (double, LengthType)>, FontStyle?, string, FontWeight?, OneOf<Color, Paint, string>, OneOf<Color, Paint, string>, string, Action<SVGTextElementBuilder>)

Adds a ’text’ element with specified content and attributes to the SVG builder.

public static TBuilder AddText<TBuilder>(this TBuilder builder, string content, 
    OneOf<double, (double, LengthType)> x = null, OneOf<double, (double, LengthType)> y = null, 
    OneOf<double, (double, LengthType)> fontSize = null, FontStyle? fontStyle = default, 
    string fontFamily = null, FontWeight? fontWeight = default, 
    OneOf<Color, Paint, string> fill = null, OneOf<Color, Paint, string> stroke = null, 
    string id = null, Action<SVGTextElementBuilder> extend = null)
    where TBuilder : ISVGElementBuilder, ICompositeElementBuilder
ParameterDescription
TBuilderThe type of the SVG element builder, allowing for chaining.
builderThe builder instance to which the ’text’ element will be added.
contentThe text content to be displayed within the ’text’ element.
xThe x-coordinate for the text element. Can be a double value or a tuple of double and LengthType.
yThe y-coordinate for the text element. Can be a double value or a tuple of double and LengthType.
fontSizeThe font size for the text. Can be a double value or a tuple of double and LengthType.
fontStyleThe font style for the text (e.g., normal, italic, oblique).
fontFamilyThe font family for the text (e.g., Arial, Verdana).
fontWeightThe weight (thickness) of the font (e.g., normal, bold).
fillThe fill color or paint style for the text. Can be a Color or a Paint enum value or paint server ID.
strokeThe stroke color or paint style for the text. Can be a Color or a Paint enum value or paint server ID.
idThe unique identifier for the text element.
extendAn optional action to further configure the text element builder.

Return Value

The builder instance for chaining further additions or configurations.

See Also


AddText<TBuilder>(this TBuilder, Action<SVGTextElementBuilder>)

Adds a ’text’ element configuration to the builder.

public static TBuilder AddText<TBuilder>(this TBuilder builder, 
    Action<SVGTextElementBuilder> configure)
    where TBuilder : ISVGElementBuilder, ICompositeElementBuilder
ParameterDescription
TBuilderThe type of the SVG element builder.
builderThe builder instance.
configureThe configuration action for the ’text’ element.

Return Value

The builder instance for chaining.

See Also