Search Results for

    Show / Hide Table of Contents

    TUIFont Class

    Represents a font used for drawing in a pdf/gdi+/wpf/winrt canvas. This class might hold resources which need disposing.

    Syntax

    Namespace: FlexCel.Core

    public abstract class TUIFont: IDisposable

    Methods

    Name Description
    Create Overloaded
    Create(String, Double)
    Create(String, Double, TUIFontStyle)
    CreateFromMemory Creates a font from the font data. IMPORTANT NOTE: When using GDI+ (default in Windows), this method will create a FontCollection that can never be disposed until the application exits.
    When using GDI+, try not to use this method, or make sure that it is called only a couple of times since the memory for the loaded font won't be released. On the other hand, calling this method multiple times with the same font is ok, FlexCel will cache the font and not create multiple instances.
    CreateFromFile Creates a font from a font file. IMPORTANT NOTE: When using GDI+ (default in Windows), this method will create a FontCollection that can never be disposed until the application exits.
    When using GDI+, try not to use this method, or make sure that it is called only a couple of times since the memory for the loaded font won't be released. On the other hand, calling this method multiple times with the same font is ok, FlexCel will cache the font and not create multiple instances.
    CreateSimilarFont Creates a font which is the most similar to the one you specify. Some fonts don't have specific styles like italics or bold, if this is the case, this method will return the same font with a different style.
    GetHeight Height of the font for a given resolution.
    GetWidth Returns the width of a string in device-independent pixels at dpi resolution when written in the current font.
    FontLinespacing Returns the linespacing for the font.
    FontDescent Returns the font descent.
    SupportsTTFTables Returns true if the platform supports returning a TTF table, and you can then use GetTTFTable
    GetTTFTable Returns a True Type table for the font, if the platform gives the functionality. Currently supported in OSX only.
    To see if the platform supports returning tables, see SupportsTTFTables
    ToString Returns the font as a string
    Dispose Overloaded
    Dispose
    Dispose(Boolean)
    OnFontCreating Replace this event when creating a custom descendant of TUIFont.
    OnFontCreated Replace this event when creating a custom descendant of TUIFont.

    Properties

    Name Description
    Name Name of the font.
    OriginalFontName Returns the name of the font as stored in the xls/x file, and not the font name after it was replaced by one of the fonts installed in the machine where we are running.
    SizeInPoints Size in points of the font.
    Style Style of the font (bold, italics, etc).
    Italic Returns true if the font is italic.
    Bold Returns true if the font is bold.

    Events

    Name Description
    FontCreating Fires before a font is created. You can customize the font properties and create a different font instead.
    Note that this event is static and it applies to the whole app.
    FontCreated Fires after a font has been created. You can use this event to handle fonts that don't exist in your system and are replaced by a different font by the OS.
    Note that this event is static and it applies to the whole app.

    Remark: As this event fires after the font has been created, it means that if you modify it the font is created twice.
    It is not going to have a big impact in performance, but if possible use the FontCreating event instead, as it won't cause the font to be created twice. This event has to be used only for cases where you want to override the default operating system font substitution algorithm.
    In This Article
    Back to top FlexCel Studio for the .NET Framework v7.24.0.0
    © 2002 - 2025 tmssoftware.com