Class Font
Defines a particular format for text, including font face, size, and style attributes.
Inheritance
Namespace: IronSoftware.Drawing
Assembly: IronSoftware.Drawing.Common.dll
Syntax
public class Font : Object
Constructors
Font(String)
Initializes a new Font that uses the specified existing FamilyName.
Further Documentation:
Code Example
Declaration
public Font(string familyName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | familyName | The FontFamily of the new Font. |
Font(String, FontStyle)
Initializes a new Font that uses the specified existing FamilyName and FontStyle enumeration.
Further Documentation:
Code Example
Declaration
public Font(string familyName, FontStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | familyName | The FontFamily of the new Font. |
| FontStyle | style | The FontStyle to apply to the new Font. Multiple values of the FontStyle enumeration can be combined with the OR operator. |
Font(String, FontStyle, Single)
Initializes a new Font that uses the specified existing FamilyName, FontStyle enumeration, FontWeight, Bold, Italic and Size.
Further Documentation:
Code Example
Declaration
public Font(string familyName, FontStyle style, float size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | familyName | The FontFamily of the new Font. |
| FontStyle | style | The FontStyle to apply to the new Font. Multiple values of the FontStyle enumeration can be combined with the OR operator. |
| System.Single | size | The em-size of the new font in the units specified by the unit parameter. |
Font(String, Single)
Initializes a new Font that uses the specified existing FamilyName, FontWeight, Bold, Italic and Size.
Further Documentation:
Code Example
Declaration
public Font(string familyName, float size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | familyName | The FontFamily of the new Font. |
| System.Single | size | The em-size of the new font in the units specified by the unit parameter. |
Properties
Bold
Gets a value that indicates whether this Font is bold.
Declaration
public bool Bold { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
FamilyName
Gets the family name for the typeface.
Declaration
public string FamilyName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Italic
Gets a value that indicates whether this font has the italic style applied.
Declaration
public bool Italic { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Size
Gets the "em-size of this Font measured in the units specified by the Unit property.
Declaration
public float Size { get; }
Property Value
| Type | Description |
|---|---|
| System.Single |
Strikeout
Gets a value that indicates whether this Font specifies a horizontal line through the font.
Declaration
public bool Strikeout { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Style
Gets the font style for the typeface.
Declaration
public FontStyle Style { get; }
Property Value
| Type | Description |
|---|---|
| FontStyle |
Underline
Gets a value that indicates whether this Font is underlined.
Declaration
public bool Underline { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Operators
Implicit(Font to FontTypes)
Implicitly casts to IronPdf.Font.FontTypes objects from Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator FontTypes(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | Font is explicitly cast to a IronPdf.Font.FontTypes |
Returns
| Type | Description |
|---|---|
| FontTypes |
Implicit(Font to Font)
Implicitly casts to Microsoft.Maui.Graphics.Font objects from Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | Font is explicitly cast to a Microsoft.Maui.Graphics.Font |
Returns
| Type | Description |
|---|---|
| Microsoft.Maui.Graphics.Font |
Implicit(Font to Font)
Implicitly casts to SixLabors.Fonts.Font objects from Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | Font is explicitly cast to a SixLabors.Fonts.Font |
Returns
| Type | Description |
|---|---|
| SixLabors.Fonts.Font |
Implicit(Font to SKFont)
Implicitly casts to System.Drawing.Font objects from Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator SKFont(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | Font is explicitly cast to a SkiaSharp.SKFont |
Returns
| Type | Description |
|---|---|
| SkiaSharp.SKFont |
Implicit(Font to Font)
Implicitly casts to System.Drawing.Font objects from Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Font | font | Font is explicitly cast to a System.Drawing.Font |
Returns
| Type | Description |
|---|---|
| System.Drawing.Font |
Implicit(FontTypes to Font)
Implicitly casts IronPdf.Font.FontTypes objects to Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(FontTypes fontTypes)
Parameters
| Type | Name | Description |
|---|---|---|
| FontTypes | fontTypes | IronPdf.Font.FontTypes will automatically be casted to Font |
Returns
| Type | Description |
|---|---|
| Font |
Implicit(Font to Font)
Implicitly casts Microsoft.Maui.Graphics.Font objects to Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| Microsoft.Maui.Graphics.Font | font | Microsoft.Maui.Graphics.Font will automatically be casted to Font |
Returns
| Type | Description |
|---|---|
| Font |
Implicit(Font to Font)
Implicitly casts SixLabors.Fonts.Font objects to Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| SixLabors.Fonts.Font | font | SixLabors.Fonts.Font will automatically be casted to Font |
Returns
| Type | Description |
|---|---|
| Font |
Implicit(SKFont to Font)
Implicitly casts SkiaSharp.SKFont objects to Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(SKFont font)
Parameters
| Type | Name | Description |
|---|---|---|
| SkiaSharp.SKFont | font | SkiaSharp.SKFont will automatically be casted to Font |
Returns
| Type | Description |
|---|---|
| Font |
Implicit(Font to Font)
Implicitly casts System.Drawing.Font objects to Font.
When your .NET Class methods use Font as parameters or return types, you now automatically support Font as well.
Declaration
public static implicit operator Font(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Font | font | System.Drawing.Font will automatically be casted to Font |
Returns
| Type | Description |
|---|---|
| Font |