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
    %s requires a valid license key for further deployment. Get Trial Below.
    ironsuite
    Blue key in circleGet Started for Free
    30 days full access • 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.
    Grey check in circleTrial key delivered
    Your key has been issued and sent to your email.
    Calendar in circleBook Free Live Demo
    No cards • no pitches • no commitments Pick a time for a quick, personalized demo
    Get the most out of your 30-day trial with:

    Live product and key features walk-through

    Project-specific recommendations

    All your questions answered

    Grey key in circleBook Free Live Demo
    Your booking has been completed Check your e-mail for confirmation

    Want to deploy Iron Suite
    to a live project for FREE?

    What’s included?

    • Test in production without watermarks
    • 30 days fully functional product
    • 24/5 technical support during trial
    ironpdf Logo
    ironword Logo
    ironxl Logo
    ironppt Logo
    ironocr Logo
    ironbarcode Logo
    ironqr Logo
    ironprint Logo
    ironzip Logo
    ironwebscraper Logo
    Iron Software sales team
    Online 24/5
    Have Enterprise licensing requirements?
    Request Iron Suite Enterprise trial
    Key in blue circle

    Get your free 30-day Trial Key instantly

    Your trial license will be sent to your email address

    No limitations. 100% unlocked. No credit card.

    bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
    Or
    Key in blue circle

    Complete Your Trial Key Signup

    Tell us a little more about yourself.

    Key in blue circleNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
    Key in blue circle

    Your license key has been delivered to your inbox

    Can't find it? Check your spam folder.

    What’s next?
    Install with NuGet
    Add IronDrawing to your project
    Quickstart Guide
    Helpful resources to get started

    Need help getting started?

    Book a Free Live Demo

    See IronDrawing in action and get your licensing questions answered, or

    Key in blue circle

    Your demo request is in.

    You'll receive an invite via email shortly.

    What’s next?
    Explore Documentation
    Review Licensing Options
    badge_greencheck_in_yellowcircle
    Thank you
    Your trial key should be in the email.
    If it is not, please contact support@ironsoftware.com
    • Logo Aetna
    • Logo NASA
    • Logo GE
    • Logo Porsche
    • Logo USDA
    • Logo Qatar
    Join Millions of Engineers who’ve tried IronDrawing
    Your trial key should be in the email.
    If it is not, please contact support@ironsoftware.com