Search Results for

    Show / Hide Table of Contents

    Class Font

    Defines a particular format for text, including font face, size, and style attributes.

    Inheritance
    System.Object
    Font
    Namespace: IronSoftware.Drawing
    Assembly: IronSoftware.Drawing.Common.dll
    Syntax
    public class Font : Object

    Text rendering across IronSoftware libraries flows through Font, the central record that bundles a typeface name, a point size, and a combination of style flags into a single, reusable object. Any IronSoftware component that draws or measures text accepts a Font, and the class's implicit conversion operators mean it travels freely between the IronDrawing type system, SkiaSharp's SKFont, and the FontTypes enumeration without explicit casting.

    Four constructors cover the common setup patterns. The minimal form new Font(string familyName) picks up system defaults for size and style. Adding a float size argument sets the point size explicitly, while the FontStyle overload selects bold, italic, or combined styles. The full four-parameter constructor new Font(string familyName, FontStyle style, float size) fixes every attribute in one call. After construction, FamilyName, Size, and Style expose those choices as read-only properties. The convenience booleans Bold, Italic, Underline, and Strikeout let calling code branch on individual style flags without decomposing the FontStyle value manually.

    The implicit operators are a practical time-saver. Assigning a Font to a variable typed as SKFont converts it automatically, so Skia-based rendering pipelines accept IronDrawing fonts without adapter code. The reverse direction works too: an SKFont assigned to a Font variable converts back. The same bidirectional pattern applies to FontTypes, making it straightforward to move between the enumeration-based API and the richer Font object.

    using IronSoftware.Drawing;
    
    // Construct with family, style, and size
    Font heading = new Font("Arial", FontStyle.Bold, 18f);
    Font caption = new Font("Georgia", FontStyle.Italic | FontStyle.Underline, 10f);
    
    Console.WriteLine(heading.FamilyName); // Arial
    Console.WriteLine(heading.Bold);       // True
    Console.WriteLine(caption.Underline);  // True
    
    // Implicit conversion to SKFont for Skia rendering pipelines
    SkiaSharp.SKFont skFont = heading;

    Explore the IronDrawing get-started guide for environment setup, the font usage how-to for practical text-rendering patterns, the FontStyle examples for combining style flags, and the IronDrawing docs hub for the full API surface.

    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
    ☀
    ☾
    Downloads
    • Download with Nuget
    In This Article
    Back to top
    Install with Nuget
    IronDrawing_for_dotnet_log2o
    Blue key in circleGet started for FREE
    No credit card required
    Test in a live environment

    Test in production without watermarks.
    Works wherever you need it to.

    Fully-functional product

    Get 30 days of fully functional product.
    Have it up and running in minutes.

    24/5 technical support

    Full access to our support engineering team during your product trial

    Grey key in circleGet started for FREE
    The trial form was submitted successfully.
    Calendar in circleBook Free Live Demo
    No contact, no card details, no commitments Book a 30-minute, personal demo.
    Here's what to expect:

    A live demo of our product and its key features

    Get project specific feature recommendations

    All your questions are answered to make sure you have all the information you need. (No commitment whatsoever.)

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation
    Support Team Member 6 related to The C# PDF Library Support Team Member 14 related to The C# PDF Library Support Team Member 4 related to The C# PDF Library Support Team Member 2 related to The C# PDF Library
    Online 24/5
    Need help? Our sales team would be glad to help you.
    Try the Enterprise Trial
    ironpdf_for_dotnet_log2o
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    bullet_checkedNo credit card or account creation required
    Key in blue circle
    Get your free 30-day Trial Key instantly.
    Blue key in circleNo credit card or account creation required
    Green Check in orange circle
    The trial form was submitted successfully.
    badge_greencheck_in_yellowcircle
    Thank you for starting a trial

    Please check your email for the trial license key.

    If you don’t receive an email, please start a live chat or email support@ironsoftware.com

    Install with NuGet
    View Licensing
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronDrawing