Opait PDF Library
Public Member Functions | Static Public Member Functions | Public Attributes | Properties | List of all members
Opait.Pdf.PdfFont Class Reference

Factory class for the standard 14 fonts as defined in the PDF spec. More...

Inheritance diagram for Opait.Pdf.PdfFont:

Public Member Functions

 PdfFont (string family, FontStyle style=FontStyle.Regular, bool embed=true)
 Initializes an instance from a system TrueType font. More...
 
int GetCharWidth (char charcode)
 Gets the width of a character in 1/1000ths of a point size for the specified character. More...
 
int GetTextWidth (string text)
 Get sum of character widths for the given text. More...
 
bool Equals (PdfFont other)
 Indicates whether the current object is equal to another object of the same type. More...
 

Static Public Member Functions

static PdfFont CreateFont (PdfOptions options)
 Creates a font for display of text based on the specified options. More...
 

Public Attributes

readonly FontStyle FontStyle
 Gets the font style.
 
readonly bool IsEmbedded
 Whether the font is embedded in the PDF document.
 
readonly bool IsCID
 Whether the font is a CID font with 2-byte character codes.
 
readonly bool IsBase14
 Whether this is a standard base 14 built-in font.
 
readonly bool IsGlyphLess
 Whether this is a glyph-less CID font used by Tesseract OCR.
 

Properties

static PdfFont Courier [get]
 Built-in fixed pitch PDF font.
 
static PdfFont CourierBold [get]
 Build-in fixed pitch bold PDF font.
 
static PdfFont CourierItalic [get]
 Build-in fixed pitch italic PDF font.
 
static PdfFont CourierBoldItalic [get]
 Build-in fixed pitch bold and italic PDF font.
 
static PdfFont Helvetica [get]
 Built-in sans-serif PDF font similar to Arial.
 
static PdfFont HelveticaBold [get]
 Built-in sans-serif bold PDF font similar to Arial.
 
static PdfFont HelveticaItalic [get]
 Built-in sans-serif italic PDF font similar to Arial.
 
static PdfFont HelveticaBoldItalic [get]
 Built-in sans-serif bold and italic PDF font similar to Arial.
 
static PdfFont Times [get]
 Built-in serif Times-Roman PDF font.
 
static PdfFont TimesBold [get]
 Built-in serif and bold Times-Roman PDF font.
 
static PdfFont TimesItalic [get]
 Built-in serif and italic Times-Roman PDF font.
 
static PdfFont TimesBoldItalic [get]
 Built-in serif, bold and italic Times-Roman PDF font.
 
static PdfFont Symbol [get]
 Built-in symbol PDF font.
 
static PdfFont ZapfDingbats [get]
 Built-in ZapfDingbats PDF font similar to Windings.
 
static PdfFont GlyphLess [get]
 The glyph-less font used by Tesseract.
 
string FamilyName [get, set]
 Gets the font family name.
 

Detailed Description

Factory class for the standard 14 fonts as defined in the PDF spec.

Represents one of the 14 standard built in type 1 fonts. These fonts, or their font metrics and suitable substitution fonts, must be available to the consumer application.

Factory class for the single glyph-less font used in Tesseract-OCR.

Constructor & Destructor Documentation

◆ PdfFont()

Opait.Pdf.PdfFont.PdfFont ( string  family,
FontStyle  style = FontStyle.Regular,
bool  embed = true 
)

Initializes an instance from a system TrueType font.

Parameters
familyThe font family name.
styleThe font style bits.
embedEmbed a subset of the font in the PDF file.

Member Function Documentation

◆ CreateFont()

static PdfFont Opait.Pdf.PdfFont.CreateFont ( PdfOptions  options)
static

Creates a font for display of text based on the specified options.

Parameters
optionsThe PDF options used in creating the font.

◆ Equals()

bool Opait.Pdf.PdfFont.Equals ( PdfFont  other)

Indicates whether the current object is equal to another object of the same type.

Parameters
otherThe font to compare for equality.
Returns
'true' if this font is equal to the specified font; otherwise, 'false'.

◆ GetCharWidth()

int Opait.Pdf.PdfFont.GetCharWidth ( char  charcode)

Gets the width of a character in 1/1000ths of a point size for the specified character.

Parameters
charcodeThe code of the character to process.
Returns
The width of the character.

◆ GetTextWidth()

int Opait.Pdf.PdfFont.GetTextWidth ( string  text)

Get sum of character widths for the given text.

Parameters
textThe text to measure.
Returns
The width of the text.