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

Class SvgFont

Represents a scalar vector graphics font element defined through an XML schema.

Inheritance
object
SvgNode
SvgFont
Inherited Members
SvgNode.Parent
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: OpenSvg.SvgNodes
Assembly: OpenSvg.dll
Syntax
public sealed class SvgFont : SvgNode

Constructors

| Edit this page View Source

SvgFont(SKTypeface)

Initializes a new instance of the SvgFont class by boxing an existing SKTypeface object.

Declaration
public SvgFont(SKTypeface font)
Parameters
Type Name Description
SKTypeface font

An existing SKTypeface font-family descriptor instance.

Properties

| Edit this page View Source

DefaultFont

Gets the default font to use in cases where no font is specified.

Declaration
public static SvgFont DefaultFont { get; }
Property Value
Type Description
SvgFont
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

Font

Gets the actual value of the SKTypeface font instance that is used for rendering.

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

FontName

Gets the name of the font-family for an SVG font element property.

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

FontSlant

Gets the style slant of a font-family SVG descriptor or CSS property.

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

FontWeight

Gets a numerical representation of the font-weight for a font-family SVG property or a CSS property.

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

FontWidth

Gets the width of the font.

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

XText

Gets the declared object that represents the value of the SVG 'font-face' rule : an XML element.

Declaration
public string XText { get; }
Property Value
Type Description
string

Methods

| Edit this page View Source

GetSystemFont(string)

Creates an instance of SvgFont based on the specified font name.

Declaration
public static SvgFont GetSystemFont(string fontName)
Parameters
Type Name Description
string fontName

The name of the font.

Returns
Type Description
SvgFont

An instance of SvgFont.

Remarks

This method tries to load a system font based on the specified font name. It should be used with care as the font may not be available on all systems. Consider using embedded fonts in SVG instead, which are supported by the OpenSvg library. EmbedFont(SvgFont)

| Edit this page View Source

LoadFromFile(string)

Loads a new SvgFont from a file.

Declaration
public static SvgFont LoadFromFile(string fontFilePath)
Parameters
Type Name Description
string fontFilePath

The file path of the SvgFont file to load.

Returns
Type Description
SvgFont

The SvgFont instance that was loaded from the file.

| Edit this page View Source

SaveFontToFile(string)

Saves the SVG font to a file (e.g. .TTF, .OTF).

Declaration
public void SaveFontToFile(string fontFilePath)
Parameters
Type Name Description
string fontFilePath

The path and name of the file to save.