Class LocalFont
Inheritance
System.Object
LocalFont
Assembly: IronPdf.dll
Syntax
public class LocalFont : Font
Specifying a system-installed typeface for SVG output during PDF conversion is the job LocalFont handles. When IronPDF renders a PDF page to SVG, text elements need a font reference; LocalFont lets you name a font that is already present on the host machine, avoiding any embedded-font extraction and giving you precise control over which typeface, weight, and style the SVG consumer will use.
LocalFont extends Font and is constructed directly: pass the font family name as a string, a FontWeight value such as FontWeight.Bold, and a FontStyle value such as FontStyle.Italic. The three properties FontFamily, FontWeight, and FontStyle then expose those choices back to the rendering pipeline and to any code that inspects the font object after construction. Because LocalFont overrides Equals and GetHashCode, instances can be compared by value and stored safely in dictionaries or hash sets, which matters when you are building a mapping of source PDF fonts to local substitutes. ToString returns a human-readable description useful for logging or diagnostics.
A typical use case is font substitution: a PDF references a proprietary typeface that the SVG viewer does not have, so you map it to a locally available alternative before conversion. The font object is consumed by the PDF-to-SVG conversion configuration rather than constructed in isolation.
using PdfToSvg;
// Substitute a PDF font with a locally installed typeface.
var localFont = new LocalFont("Arial", FontWeight.Bold, FontStyle.Normal);
Console.WriteLine(localFont.FontFamily); // Arial
Console.WriteLine(localFont.ToString());
Because LocalFont derives from Font, it fits anywhere the conversion API accepts a Font reference, keeping substitution logic consistent across different font source types. The FontWeight and FontStyle properties let downstream code branch on style without parsing the family name string, which simplifies conditional rendering logic.
For broader context on PDF-to-SVG conversion in IronPDF, see the IronPDF documentation hub, the PDF conversion how-to guides, and the getting-started guide. Font substitution examples are covered in the PDF rendering examples.
Constructors
LocalFont(String, FontWeight, FontStyle)
Declaration
public LocalFont(string fontFamily, FontWeight fontWeight, FontStyle fontStyle)
Parameters
Properties
FontFamily
Declaration
public override string FontFamily { get; }
Property Value
| Type |
Description |
| System.String |
|
Overrides
FontStyle
Declaration
public FontStyle FontStyle { get; }
Property Value
FontWeight
Declaration
public FontWeight FontWeight { get; }
Property Value
Methods
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
Overrides
ToString()
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides