Back to top OpenSVG (c) Veridict AB, www.veridict.com
Edit this page

Class SvgText

Represents a SVG 'text' element

Inheritance
object
SvgElement
SvgVisual
SvgText
Implements
IXmlSerializable
IEquatable<SvgElement>
IHasElementContent
Inherited Members
SvgVisual.fillColor
SvgVisual.strokeColor
SvgVisual.strokeWidth
SvgVisual.transform
SvgVisual.FillColor
SvgVisual.StrokeColor
SvgVisual.StrokeWidth
SvgVisual.Transform
SvgVisual.DrawConfig
SvgVisual.ConvexHull
SvgVisual.BoundingBox
SvgVisual.AlignRelativeTo(SvgVisual, HorizontalAlignment?, VerticalAlignment?)
SvgElement.id
SvgElement.ID
SvgElement.RootDocument
SvgElement.Root
SvgElement.Parent
SvgElement.ViewPort
SvgElement.ViewPortWidth
SvgElement.ViewPortHeight
SvgElement.GetSchema()
SvgElement.WriteXml(XmlWriter)
SvgElement.ReadXml(XmlReader)
SvgElement.ToSvgGroup()
SvgElement.ToSvgDocument()
SvgElement.Attributes()
SvgElement.Equals(object)
SvgElement.Equals(SvgElement)
SvgElement.InformedEquals(SvgElement)
SvgElement.GetHashCode()
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OpenSvg.SvgNodes
Assembly: OpenSvg.dll
Syntax
public class SvgText : SvgVisual, IXmlSerializable, IEquatable<SvgElement>, IHasElementContent

Constructors

| Edit this page View Source

SvgText()

Constructs a new empty instance of a SvgText

Declaration
public SvgText()
| Edit this page View Source

SvgText(TextConfig)

Constructs a new instance of the SvgText using the provided TextConfig

Declaration
public SvgText(TextConfig textConfig)
Parameters
Type Name Description
TextConfig textConfig

A TextConfig object providing properties for the text.

Remarks

The SvgFont provided in the TextConfig will be embedded in the provided SVG document if it does not already exist.

Fields

| Edit this page View Source

fontName

Declaration
protected readonly StringAttr fontName
Field Value
Type Description
StringAttr
| Edit this page View Source

fontSize

Declaration
protected readonly FloatAttr fontSize
Field Value
Type Description
FloatAttr
| Edit this page View Source

x

Declaration
protected readonly FloatAttr x
Field Value
Type Description
FloatAttr
| Edit this page View Source

y

Declaration
protected readonly FloatAttr y
Field Value
Type Description
FloatAttr

Properties

| Edit this page View Source

Content

Gets or sets the content of the element.

Declaration
public string Content { get; set; }
Property Value
Type Description
string
| Edit this page View Source

FontName

Gets or sets the font name for this SvgVisual element.

Declaration
public string FontName { get; set; }
Property Value
Type Description
string
Remarks

The default font is not defined according to the SVG 1.1 specification. The default font is instead set in in accordance to the major browsers (Chrome, Firefox and Edge) to Times New Roman

See Also
SVG 1.1 Font selection properties
| Edit this page View Source

FontSize

Gets or sets the font size for this SvgVisual element.

Declaration
public float FontSize { get; set; }
Property Value
Type Description
float
Remarks

The default font size is not defined according to the SVG 1.1 specification. Instead a de facto standard based on browser implementation and CSS specifications is adopted. The CSS2 specification suggests a "medium" font size that equates to 16px in many desktop browsers, which is adopted here.

See Also
SVG 1.1 Font size
| Edit this page View Source

Point

Gets or sets the position of the SvgText element.

Declaration
public Vector2 Point { get; set; }
Property Value
Type Description
Vector2
| Edit this page View Source

SvgName

Gets or sets the name of the SVG element.

Declaration
public override string SvgName { get; }
Property Value
Type Description
string
Overrides
SvgElement.SvgName
| Edit this page View Source

TextConfig

Setting or getting the text configuration for this SvgText element.

Declaration
public TextConfig TextConfig { get; set; }
Property Value
Type Description
TextConfig
| Edit this page View Source

X

Attribute for getting or setting X position of this element

Declaration
public float X { get; set; }
Property Value
Type Description
float
| Edit this page View Source

Y

Attribute for getting or setting Y position of this element

Declaration
public float Y { get; set; }
Property Value
Type Description
float

Methods

| Edit this page View Source

ComputeConvexHull()

Protected method to compute the non-transformed convex hull of this SvgVisual element.

Declaration
protected override ConvexHull ComputeConvexHull()
Returns
Type Description
ConvexHull
Overrides
SvgVisual.ComputeConvexHull()

Implements

IXmlSerializable
IEquatable<T>
IHasElementContent