Class FontAttributes
Inheritance
System.Object
FontAttributes
Assembly: IronOcr.dll
Syntax
public class FontAttributes : Object
Captured alongside each recognized word during OCR, FontAttributes bundles the typographic metadata that Tesseract detects: the underlying FontInfo descriptor, whether the text is underlined or set in small caps, and the rendered point size. When fine-grained layout analysis matters, such as reconstructing a document's visual hierarchy or flagging headings versus body copy, this record gives the detail needed without a separate parsing pass.
Construction requires a FontInfo value plus the three decoration flags: isUnderlined, isSmallCaps, and pointSize. Once built, all four properties are read-only. FontInfo exposes the font family and style data that Tesseract identified. IsUnderlined and IsSmallCaps are straightforward boolean flags. PointSize carries the size in typographic points as Tesseract estimated it from the image geometry, so its accuracy depends on image resolution and scan quality.
A typical use is filtering OCR results to locate large-point or small-caps text that signals section titles:
using IronOcr;
var ocr = new IronTesseract();
using var input = new OcrInput();
input.LoadPdf("report.pdf");
var result = ocr.Read(input);
foreach (var word in result.Words)
{
var attr = word.FontAttributes;
if (attr is { PointSize: >= 14 } || attr.IsSmallCaps)
Console.WriteLine($"Heading candidate: {word.Text}");
}
For background on reading document structure with IronOCR, see the IronOCR documentation and the read PDF how-to.
Constructors
FontAttributes(FontInfo, Boolean, Boolean, Int32)
Declaration
public FontAttributes(FontInfo fontInfo, bool isUnderlined, bool isSmallCaps, int pointSize)
Parameters
| Type |
Name |
Description |
| FontInfo |
fontInfo |
|
| System.Boolean |
isUnderlined |
|
| System.Boolean |
isSmallCaps |
|
| System.Int32 |
pointSize |
|
Properties
FontInfo
Declaration
public FontInfo FontInfo { get; }
Property Value
IsSmallCaps
Declaration
public bool IsSmallCaps { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsUnderlined
Declaration
public bool IsUnderlined { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
PointSize
Declaration
public int PointSize { get; }
Property Value
| Type |
Description |
| System.Int32 |
|