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
    %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 IronOCR to your project
    Quickstart Guide
    Helpful resources to get started

    Need help getting started?

    Book a Free Live Demo

    See IronOCR 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 IronOCR
    Your trial key should be in the email.
    If it is not, please contact support@ironsoftware.com