WebFont Class

Uses a web font in the resulting SVG markup.

public class WebFont : Font
Namespace
PdfToSvg
Package
PdfToSvg.NET (since v0.3.0)
Inheritance
System.Object PdfToSvg.Font PdfToSvg.WebFont

Remarks

Objects of this type can be returned from a FontResolver to indicate how text will be rendered in the generated SVG.

Note
Standalone SVG’s must not reference external resources. If you intend to create standalone SVG files, ensure the font URLs are data URLs.

Text representation

PDF documents store text encoded as character codes, and provide mappings from character codes to font glyphs and Unicode characters. Some documents map multiple character codes to the same Unicode character, giving PdfToSvg.NET a choice. Exporting both character codes as the same Unicode character results in good text representation but potentially visually inaccurate SVG’s. Remapping one of the character codes to another Unicode character ensures visually accurate SVG’s at the cost of inaccurate text representation if text is exported from the SVG.

When exporting text using a WebFont, the library will remap duplicate character codes to characters in the Private Use Areas, making sure the exported SVG’s are visually accurate, but text might appear as a series of question marks, ������, in the SVG markup. If you intend to extract text from the SVG, consider exporting the SVG using local fonts instead.

Constructors

WebFontCreates an instance of a WebFont.

Properties

FallbackFontGets the fallback font that is used to render the text if the web font files cannot be downloaded.
FontFamilyGets the generated font name of the web font.
OpenTypeUrlGets an URL to an OpenType font file to be included as a @font-face.
TrueTypeUrlGets an URL to a TrueType font file to be included as a @font-face.
Woff2UrlGets an URL to a WOFF2 font file to be included as a @font-face.
WoffUrlGets an URL to a WOFF font file to be included as a @font-face.

Methods

EqualsDetermines whether the specified font is equal to the current one.
GetHashCodeGets a hash code for this font.
ToStringGets a string representation of this font.

See Also

PdfToSvg Namespace
FontResolver