Search Results for

    Show / Hide Table of Contents

    Class OcrResult.OcrFont

    Detailed font information returned when using Tesseract OEM engine modes.

    Inheritance
    System.Object
    OcrResult.OcrFont
    Namespace: IronOcr
    Assembly: IronOcr.dll
    Syntax
    public class OcrFont : Object

    OcrResult.OcrFont reports the typeface IronOCR believes a recognized character was set in, so you can preserve or analyze styling rather than capturing plain text alone. Reach for it when a downstream step needs to know whether a glyph was bold, italic, serif, or fixed-width, for example when rebuilding a styled document or filtering by emphasis.

    You do not construct this object. You read it from the Font property of an OcrResult.Character, which you reach by walking an OcrResult returned from IronTesseract.Read. Font detail is populated mainly under the Tesseract OEM engine modes, so it is most reliable when the engine is configured for the legacy Tesseract path rather than the LSTM-only modes; expect best-guess values, since the figures are estimated from the recognized shapes.

    The members fall into two groups. FontName gives the closest known typeface name and FontSize the estimated height in points. The remaining members are boolean style flags: IsBold, IsItalic, and IsUnderlined for the common emphases, IsSerif and IsFixedWidth for the family classification (serif like Times, monospaced like Courier), and IsSmallCaps and IsCaligraphic for the less common small-caps and Fraktur-style cases. Read the flags directly on the character's font to branch on styling, and treat each value as advisory rather than exact, since the engine infers them from the recognized glyph shapes. A practical pattern is to read FontName and FontSize to approximate a typeface, then use the flags to apply emphasis when you rebuild the text in a styled output, falling back to a plain rendering whenever the flags conflict or the font detail was not populated for that character.

    using IronOcr;
    
    var ocr = new IronTesseract();
    using var input = new OcrInput("scan.png");
    OcrResult result = ocr.Read(input);
    OcrResult.OcrFont font = result.Pages[0].Words[0].Characters[0].Font;
    Console.WriteLine($"{font.FontName} {font.FontSize}pt bold={font.IsBold}");

    The working with OCR results how-to covers reading character detail, the IronTesseract how-to explains the engine modes that populate font data, and the results objects example shows accessing per-character properties.

    Properties

    FontName

    Best guess at the closest known typeface name.

    Declaration
    public string FontName { get; }
    Property Value
    Type Description
    System.String

    FontSize

    Best guess at the font height in points.

    Declaration
    public double FontSize { get; }
    Property Value
    Type Description
    System.Double

    IsBold

    Is the text Bold.

    Declaration
    public bool IsBold { get; }
    Property Value
    Type Description
    System.Boolean

    IsCaligraphic

    Is the text in a calligraphic or "Fruktur" style.

    Declaration
    public bool IsCaligraphic { get; }
    Property Value
    Type Description
    System.Boolean

    IsFixedWidth

    Is the text FixedWidth (monospaced like Courier).

    Declaration
    public bool IsFixedWidth { get; }
    Property Value
    Type Description
    System.Boolean

    IsItalic

    Is the text Italic.

    Declaration
    public bool IsItalic { get; }
    Property Value
    Type Description
    System.Boolean

    IsSerif

    Is the text Serif (like Times-New Roman).

    Declaration
    public bool IsSerif { get; }
    Property Value
    Type Description
    System.Boolean

    IsSmallCaps

    Is the text in "Small Caps" (half height capital letters).

    Declaration
    public bool IsSmallCaps { get; }
    Property Value
    Type Description
    System.Boolean

    IsUnderlined

    Is the text Underlined.

    Declaration
    public bool IsUnderlined { get; }
    Property Value
    Type Description
    System.Boolean
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    IronOCR_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 IronOCR