Class SvgText
Represents a SVG 'text' element
Inherited Members
Namespace: OpenSvg.SvgNodes
Assembly: OpenSvg.dll
Syntax
public class SvgText : SvgVisual, IXmlSerializable, IEquatable<SvgElement>, IHasElementContent
Constructors
| Edit this page View SourceSvgText()
Constructs a new empty instance of a SvgText
Declaration
public SvgText()
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 SourcefontName
Declaration
protected readonly StringAttr fontName
Field Value
Type | Description |
---|---|
StringAttr |
fontSize
Declaration
protected readonly FloatAttr fontSize
Field Value
Type | Description |
---|---|
FloatAttr |
x
Declaration
protected readonly FloatAttr x
Field Value
Type | Description |
---|---|
FloatAttr |
y
Declaration
protected readonly FloatAttr y
Field Value
Type | Description |
---|---|
FloatAttr |
Properties
| Edit this page View SourceContent
Gets or sets the content of the element.
Declaration
public string Content { get; set; }
Property Value
Type | Description |
---|---|
string |
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
| Edit this page View SourceFontSize
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
| Edit this page View SourcePoint
Gets or sets the position of the SvgText element.
Declaration
public Vector2 Point { get; set; }
Property Value
Type | Description |
---|---|
Vector2 |
SvgName
Gets or sets the name of the SVG element.
Declaration
public override string SvgName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
| Edit this page View SourceTextConfig
Setting or getting the text configuration for this SvgText element.
Declaration
public TextConfig TextConfig { get; set; }
Property Value
Type | Description |
---|---|
TextConfig |
X
Attribute for getting or setting X position of this element
Declaration
public float X { get; set; }
Property Value
Type | Description |
---|---|
float |
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 SourceComputeConvexHull()
Protected method to compute the non-transformed convex hull of this SvgVisual element.
Declaration
protected override ConvexHull ComputeConvexHull()
Returns
Type | Description |
---|---|
ConvexHull |