Show / Hide Table of Contents

# Class Font

A font that is used to draw text on a page. It corresponds to a Font Resource in a PDF file. More than one page may reference the same Font object. A Font has a number of attributes, including an array of widths, the character encoding, and the font's resource name.

PDF document can contain several different types of fonts and Font class represents a single, flat interface around all PDF font types.

There are two main classes of fonts in PDF: simple and composite fonts.

Simple fonts are Type1, TrueType, and Type3 fonts. All simple fonts have the following properties:

- Glyphs in the font are selected by single-byte character codes obtained from a string that is shown by the text-showing operators. Logically, these codes index into a table of 256 glyphs; the mapping from codes to glyphs is called the font's encoding. Each font program has a built-in encoding. Under some circumstances, the encoding can be altered by means described in Section 5.5.5 "Character Encoding" in PDF Reference Manual.
- Each glyph has a single set of metrics. Therefore simple fonts support only horizontal writing mode.

A composite font is one whose glyphs are obtained from a font like object called a CIDFont (e.g. CIDType0Font and CIDType0Font). A composite font is represented by a font dictionary whose Subtype value is Type0. The Type 0 font is known as the root font, while its associated CIDFont is called its descendant. CID-keyed fonts provide a convenient and efficient method for defining multiple-byte character encodings and fonts with a large number of glyphs. These capabilities provide great flexibility for representing text in writing systems for languages with large character sets, such as Chinese, Japanese, and Korean (CJK).

##### Inheritance

object
Font

##### Implements

IDisposable

##### Inherited Members

object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.MemberwiseClone()

###### Namespace: pdftron.PDF

###### Assembly: PDFNet.dll

##### Syntax

    public class Font : IDisposable

### Constructors

#### Font(Obj)

Instantiates a new font.

##### Declaration

    public Font(Obj fnt_dict)

##### Parameters

Type | Name | Description
--- | --- | ---
Obj | fnt_dict | the font_dict

### Methods

#### Create(PDFDoc, string, string)

Create a new Unicode font based on the description of an existing PDF font.

##### Declaration

    public static Font Create(PDFDoc doc, string name, string char_set)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | PDF document
string | name | name of existing PDF font
string | char_set | the character set

##### Returns

Type | Description
--- | ---
Font | the created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(PDFDoc, Font, string)

Create a new Unicode font based on the description of an existing PDF font.

##### Declaration

    public static Font Create(PDFDoc doc, Font from, string char_set)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | PDF document
Font | from | existing PDF font
string | char_set | the character set

##### Returns

Type | Description
--- | ---
Font | the created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(PDFDoc, StandardType1Font)

Create a PDF::Font object for the given standard (also known as base 14 font).

##### Declaration

    public static Font Create(PDFDoc doc, Font.StandardType1Font type)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | PDF document
Font.StandardType1Font | type | font type

##### Returns

Type | Description
--- | ---
Font | newly created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(PDFDoc, StandardType1Font, bool)

Create a PDF::Font object for the given standard (also known as base 14 font).

##### Declaration

    public static Font Create(PDFDoc doc, Font.StandardType1Font type, bool embed)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | PDF document
Font.StandardType1Font | type | font type
bool | embed | if it is embeded font

##### Returns

Type | Description
--- | ---
Font | the created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(Obj)

Create a PDF::Font object

##### Declaration

    public static Font Create(Obj font_dict)

##### Parameters

Type | Name | Description
--- | --- | ---
Obj | font_dict | font dictionary object

##### Returns

Type | Description
--- | ---
Font | newly created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(SDFDoc, string, string)

Create a new Unicode font based on the description of an existing PDF font.

##### Declaration

    public static Font Create(SDFDoc doc, string name, string char_set)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | PDF document
string | name | name of existing PDF font
string | char_set | the character set

##### Returns

Type | Description
--- | ---
Font | the created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(SDFDoc, Font, string)

Create a new Unicode font based on the description of an existing PDF font.

##### Declaration

    public static Font Create(SDFDoc doc, Font from, string char_set)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | PDF document
Font | from | existing PDF font
string | char_set | the character set

##### Returns

Type | Description
--- | ---
Font | the created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(SDFDoc, StandardType1Font)

Create a PDF::Font object for the given standard (also known as base 14 font).

##### Declaration

    public static Font Create(SDFDoc doc, Font.StandardType1Font type)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | PDF document
Font.StandardType1Font | type | font type

##### Returns

Type | Description
--- | ---
Font | newly created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Create(SDFDoc, StandardType1Font, bool)

Create a PDF::Font object for the given standard (also known as base 14 font).

##### Declaration

    public static Font Create(SDFDoc doc, Font.StandardType1Font type, bool embed)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | PDF document
Font.StandardType1Font | type | font type
bool | embed | if it is embeded font

##### Returns

Type | Description
--- | ---
Font | the created font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(PDFDoc, string)

Embed an external TrueType font in the document as a CID font. By default the function selects "Identity-H" encoding that maps 2-byte character codes ranging from 0 to 65,535 to the same Unicode value. Other predefined encodings are listed in Table 5.15 'Predefined CMap names' in PDF Reference Manual.

##### Declaration

    public static Font CreateCIDTrueTypeFont(PDFDoc doc, string font_path)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | document in which the external font should be embedded.
string | font_path | path to the external font file.

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(PDFDoc, string, bool, bool)

Creates the cid true type font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(PDFDoc doc, string font_path, bool embed, bool subset)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed
bool | subset | the subset

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(PDFDoc, string, bool, bool, Encoding)

Creates the cid true type font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(PDFDoc doc, string font_path, bool embed, bool subset, Font.Encoding encoding)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed
bool | subset | the subset
Font.Encoding | encoding | the encoding

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(PDFDoc, string, bool, bool, Encoding, int)

Creates the cid true type font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(PDFDoc doc, string font_path, bool embed, bool subset, Font.Encoding encoding, int ttc_font_index)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed
bool | subset | the subset
Font.Encoding | encoding | the encoding
int | ttc_font_index | for TTC fonts the index of the actual font to use

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(SDFDoc, Font, bool, bool)

Creates the cid true type font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(SDFDoc doc, Font font_path, bool embed, bool subset)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | the doc
Font | font_path | the font_path
bool | embed | the embed
bool | subset | the subset

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(SDFDoc, Font, bool, bool, Encoding)

Creates a Type0 CID font backed by a CIDTruetype descendant font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(SDFDoc doc, Font system_font, bool embed, bool subset, Font.Encoding encoding)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | the base document
Font | system_font | the system font to use as the font source
bool | embed | Should we embed the font data in the PDF (recommended for portability)
bool | subset | should this font be subset when saved
Font.Encoding | encoding | the CID encoding scheme.

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(SDFDoc, string)

Embed an external TrueType font in the document as a CID font. By default the function selects "Identity-H" encoding that maps 2-byte character codes ranging from 0 to 65,535 to the same Unicode value. Other predefined encodings are listed in Table 5.15 'Predefined CMap names' in PDF Reference Manual.

##### Declaration

    public static Font CreateCIDTrueTypeFont(SDFDoc doc, string font_path)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | document in which the external font should be embedded.
string | font_path | path to the external font file.

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(SDFDoc, string, bool, bool)

Creates the cid true type font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(SDFDoc doc, string font_path, bool embed, bool subset)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed
bool | subset | the subset

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(SDFDoc, string, bool, bool, Encoding)

Creates the cid true type font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(SDFDoc doc, string font_path, bool embed, bool subset, Font.Encoding encoding)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed
bool | subset | the subset
Font.Encoding | encoding | the encoding

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateCIDTrueTypeFont(SDFDoc, string, bool, bool, Encoding, int)

Creates the cid true type font.

##### Declaration

    public static Font CreateCIDTrueTypeFont(SDFDoc doc, string font_path, bool embed, bool subset, Font.Encoding encoding, int ttc_font_index)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed
bool | subset | the subset
Font.Encoding | encoding | the encoding
int | ttc_font_index | for TTC fonts the index of the actual font to use

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateTrueTypeFont(PDFDoc, string)

Embed an external TrueType font in the document as a Simple font.

##### Declaration

    public static Font CreateTrueTypeFont(PDFDoc doc, string font_path)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | Document in which the external font should be embedded.
string | font_path | Path to the external font file.

##### Returns

Type | Description
--- | ---
Font | the font

##### Remarks

glyphs in the Simple font are selected by single-byte character codes. If you want to work with multi-byte character codes (e.g. UTF16) you need to create a CID font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateTrueTypeFont(PDFDoc, string, bool, bool)

Creates the true type font.

##### Declaration

    public static Font CreateTrueTypeFont(PDFDoc doc, string font_path, bool embed, bool subset)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | PDF Document
string | font_path | Path to the external font file.
bool | embed | if font is embeded
bool | subset | if font is subset

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateTrueTypeFont(SDFDoc, Font, bool, bool)

Creates the true type font.

##### Declaration

    public static Font CreateTrueTypeFont(SDFDoc doc, Font font_path, bool embed, bool subset)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | PDF Document
Font | font_path | Path to the external font file.
bool | embed | if font is embeded
bool | subset | if font is subset

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateTrueTypeFont(SDFDoc, string)

Embed an external TrueType font in the document as a Simple font.

##### Declaration

    public static Font CreateTrueTypeFont(SDFDoc doc, string font_path)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | Document in which the external font should be embedded.
string | font_path | Path to the external font file.

##### Returns

Type | Description
--- | ---
Font | the font

##### Remarks

glyphs in the Simple font are selected by single-byte character codes. If you want to work with multi-byte character codes (e.g. UTF16) you need to create a CID font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateTrueTypeFont(SDFDoc, string, bool, bool)

Creates the true type font.

##### Declaration

    public static Font CreateTrueTypeFont(SDFDoc doc, string font_path, bool embed, bool subset)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | PDF Document
string | font_path | Path to the external font file.
bool | embed | if font is embeded
bool | subset | if font is subset

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateType1Font(PDFDoc, string)

Embed an external TrueType font in the document as a CID font. By default the function selects "Identity-H" encoding that maps 2-byte character codes ranging from 0 to 65,535 to the same Unicode value. Other predefined encodings are listed in Table 5.15 'Predefined CMap names' in PDF Reference Manual.

##### Declaration

    public static Font CreateType1Font(PDFDoc doc, string font_path)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | document in which the external font should be embedded.
string | font_path | path to the external font file.

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateType1Font(PDFDoc, string, bool)

Creates the type1 font.

##### Declaration

    public static Font CreateType1Font(PDFDoc doc, string font_path, bool embed)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateType1Font(SDFDoc, string)

Embed an external TrueType font in the document as a CID font. By default the function selects "Identity-H" encoding that maps 2-byte character codes ranging from 0 to 65,535 to the same Unicode value. Other predefined encodings are listed in Table 5.15 'Predefined CMap names' in PDF Reference Manual.

##### Declaration

    public static Font CreateType1Font(SDFDoc doc, string font_path)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | document in which the external font should be embedded.
string | font_path | path to the external font file.

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### CreateType1Font(SDFDoc, string, bool)

Creates the type1 font.

##### Declaration

    public static Font CreateType1Font(SDFDoc doc, string font_path, bool embed)

##### Parameters

Type | Name | Description
--- | --- | ---
SDFDoc | doc | the doc
string | font_path | the font_path
bool | embed | the embed

##### Returns

Type | Description
--- | ---
Font | the font

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### Dispose()

Releases all resources used by the Font

##### Declaration

    public override sealed void Dispose()

#### Dispose(bool)

##### Declaration

    [HandleProcessCorruptedStateExceptions]
    protected virtual void Dispose(bool A_0)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | A_0 |

#### ~Font()

Allows a Font to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

##### Declaration

    protected ~Font()

#### GetAscent()

The face's ascender is the vertical distance from the baseline to the topmost point of any glyph in the face. This field's value is a positive number, expressed in the glyph coordinate system. For all font types except Type 3, the units of glyph space are one-thousandth of a unit of text space. Some font designs use a value different from 'bbox.yMax'.

##### Declaration

    public double GetAscent()

##### Returns

Type | Description
--- | ---
double | the ascent

##### Remarks

Only relevant for scalable formats.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetBBox()

Gets the b box.

##### Declaration

    public Rect GetBBox()

##### Returns

Type | Description
--- | ---
Rect | A rectangle expressed in the glyph coordinate system, specifying the font bounding box. This is the smallest rectangle enclosing the shape that would result if all of the glyphs of the font were placed with their origins coincident and then filled.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetCharCodeIterator()

CharCodeGetIterator represents an iterator interface used to traverse a list of char codes for which there is a glyph outline in the embedded font.

##### Declaration

    public FontCharCodeIterator GetCharCodeIterator()

##### Returns

Type | Description
--- | ---
FontCharCodeIterator | the char code iterator

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetDescendant()

Gets the descendant.

##### Declaration

    public Font GetDescendant()

##### Returns

Type | Description
--- | ---
Font | descendant CIDFont.

##### Remarks

Relevant only for a Type0 font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetDescent()

The face's descender is the vertical distance from the baseline to the bottommost point of any glyph in the face. This field's value is a negative number expressed in the glyph coordinate system. For all font types except Type 3, the units of glyph space are one-thousandth of a unit of text space. Some font designs use a value different from 'bbox.yMin'.

##### Declaration

    public double GetDescent()

##### Returns

Type | Description
--- | ---
double | the descent

##### Remarks

Only relevant for scalable formats.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetDescriptor()

Gets the descriptor.

##### Declaration

    public Obj GetDescriptor()

##### Returns

Type | Description
--- | ---
Obj | a SDF/Cos object representing FontDescriptor or NULL is FontDescriptor is not present.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetEmbeddedFont()

Gets the embedded font.

##### Declaration

    public Obj GetEmbeddedFont()

##### Returns

Type | Description
--- | ---
Obj | the stream object of the embedded font or NULL if there if the font is not embedded.

##### Remarks

This function is not applicable to Type3 font and will throw an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetEmbeddedFontBufSize()

Gets the embedded font buf size.

##### Declaration

    public int GetEmbeddedFontBufSize()

##### Returns

Type | Description
--- | ---
int | the size of decoded buffer containing embedded font data or 0 if this information is not known in advance.

##### Remarks

The size of decoded buffer may not be known in advance for all fonts and may not be correct. This function is not applicable to Type3 font and will throw an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetEmbeddedFontName()

Gets the embedded font name.

##### Declaration

    public string GetEmbeddedFontName()

##### Returns

Type | Description
--- | ---
string | the PostScript font name for the embedded font. If the embedded font name is not available the function returns the empty string .

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetEncoding()

Gets the encoding.

##### Declaration

    public IntPtr GetEncoding()

##### Returns

Type | Description
--- | ---
IntPtr | the font's encoding array (the mapping of character codes to glyphs). The array contains 256 Strings. If a String is not NULL, it containing the name of the glyph for the code point corresponding to the index. If it is NULL, then the name of the glyph is unchanged from that specified by the font's builtin encoding. For a Type 3 font, all glyph names will be present in the encoding array, and NULL entries correspond to un-encoded code points.

##### Remarks

The Font object is the owner of the array. This function is not applicable to composite fonts (e_type0, e_CIDType0, and e_CIDType2) and will throw an exception.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetFamilyName()

Gets the family name.

##### Declaration

    public string GetFamilyName()

##### Returns

Type | Description
--- | ---
string | the face's family name. This is an ASCII string, usually in English, which describes the typeface's family (like 'Times New Roman', 'Bodoni', 'Garamond', etc). This is a least common denominator used to list fonts.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetGlyphPath(int, bool)

The function retrieves the glyph outline for a given character code.

##### Declaration

    public PathData GetGlyphPath(int char_code, bool conics2cubics)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code | character to query
bool | conics2cubics | if set to true converts all quadratic Bezier curves to cubic Beziers, otherwise no coversion is performed.

##### Returns

Type | Description
--- | ---
PathData | A PathData object containing the path information.

##### Remarks

the function can return only the following operators (Element::e_moveto, Element::e_lineto, Element::e_cubicto and optionaly Element::e_conicto if conics2cubics parameter is set to true.

This function is not applicable to Type3 font and will throw an exception. Use `GetType3GlyphStream` instead.

Check PathData.IsDefined to see if the char_code was mapped to 'undefined character code'.

#### GetGlyphPath(int, ref byte[], ref double[], bool)

The function retrieves the glyph outline for a given character code.

##### Declaration

    public bool GetGlyphPath(int char_code, ref byte[] out_oprs, ref double[] out_data, bool conics2cubics)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code | character to query
byte[] | out_oprs | a vector of operators. The array is filled in by the method.
double[] | out_data | a vector of data points that represent arguments for operators. The array is filled in by the method.
bool | conics2cubics | if set to true converts all quadratic Bezier curves to cubic Beziers, otherwise no coversion is performed.

##### Returns

Type | Description
--- | ---
bool | false if the char_code was mapped to 'undefined character code'. In some fonts 'undefined character code' corresponds to a space, in some fonts it is a box, and in others it may be a more complicated glyph.

##### Remarks

the function can return only the following operators (Element::e_moveto, Element::e_lineto, Element::e_cubicto and optionaly Element::e_conicto if conics2cubics parameter is set to true.

This function is not applicable to Type3 font and will throw an exception. Use `GetType3GlyphStream` instead.

#### GetMaxWidth()

Gets the max width.

##### Declaration

    public double GetMaxWidth()

##### Returns

Type | Description
--- | ---
double | the maximal advance width, in font units, for all glyphs in this face.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetMissingWidth()

Gets the missing width.

##### Declaration

    public double GetMissingWidth()

##### Returns

Type | Description
--- | ---
double | the default width to use for character codes whose widths are not specified in a font dictionary's Widths array.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetName()

Gets the name.

##### Declaration

    public string GetName()

##### Returns

Type | Description
--- | ---
string | the name of a font. The behavior depends on the font type; for a Type 3 font it gets the value of the Name key in a PDF Font resource. For other types it gets the value of the BaseFont key in a PDF font resource.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetSDFObj()

Gets the SDFObj.

##### Declaration

    public Obj GetSDFObj()

##### Returns

Type | Description
--- | ---
Obj | a SDF/Cos object of this Font.

#### GetShapedText(string)

Creates a set of positioned glyphs corresponding to the visual representation of the provided text string. The shaped text will take into account any advanced positioning and substitution features provided by an underylying embedded font file. For example, these features could include kerning, ligatures, and diacritic positioning. Typically the resulting shaped text would be fed into ElementBuilder.CreateShapedTextRun()

##### Declaration

    public ShapedText GetShapedText(string text_to_shape)

##### Parameters

Type | Name | Description
--- | --- | ---
string | text_to_shape | The string to be shaped.

##### Returns

Type | Description
--- | ---
ShapedText | A ShapedText object representing the result of the shaping operation.

##### Remarks

Shaping requires a Type0 font with an embedded font file which covers all the unicode codepoints in the source text. For best results, this font should use the e_Indices encoding scheme, as shaping features that combine multiple codepoints into one glyph (ligatures, for example) will not work well in non-index encoded fonts.

#### GetStandardType1FontType()

Gets the standard type1 font type.

##### Declaration

    public int GetStandardType1FontType()

##### Returns

Type | Description
--- | ---
int | Font::e_null if the font is not a standard Type1 font or some other StandardType1Font value for a standard Type1 font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetType()

Gets the type.

##### Declaration

    public Font.Type GetType()

##### Returns

Type | Description
--- | ---
Font.Type | Font Type

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetType(Obj)

Gets the type.

##### Declaration

    public static Font.Type GetType(Obj font_dict)

##### Parameters

Type | Name | Description
--- | --- | ---
Obj | font_dict | the font_dict

##### Returns

Type | Description
--- | ---
Font.Type | The type of a given SDF/Cos font dictionary

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetType3FontMatrix()

Gets the type3 font matrix.

##### Declaration

    public Matrix2D GetType3FontMatrix()

##### Returns

Type | Description
--- | ---
Matrix2D | Type3 font matrix, mapping glyph space to text space A common practice is to define glyphs in terms of a 1000-unit glyph coordinate system, in which case the font matrix is [0.001 0 0 0.001 0 0].

##### Remarks

Relevant only for a Type3 font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetType3GlyphStream(int)

Gets the type3 glyph stream.

##### Declaration

    public Obj GetType3GlyphStream(int char_code)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code | the char_code

##### Returns

Type | Description
--- | ---
Obj | a SDF/Cos glyph stream for the given char_code. If specified char_code is not found in CharPorcs dictionary the function returns NULL.

##### Remarks

Relevant only for a Type3 font.

#### GetUnitsPerEm()

Gets the units per em.

##### Declaration

    public short GetUnitsPerEm()

##### Returns

Type | Description
--- | ---
short | the number of font units per EM square for this face. This is typically 2048 for TrueType fonts, 1000 for Type1 fonts

##### Remarks

Only relevant for scalable formats (such as TrueType and Type1). This function is not applicable to Type3 font and will throw an exception. Use GetType3FontMatrix instead.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetVerticalAdvance(int, double, double)

Gets the vertical advance.

##### Declaration

    public double GetVerticalAdvance(int char_code, double pos_x, double pos_y)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code | character to query for vertical advance
double | pos_x | x coordinate
double | pos_y | y coordinate

##### Returns

Type | Description
--- | ---
double | an double array containing in the following order vertical advance. vertical advance is a displacement vector for vertical writing mode (i.e. writing mode 1); its horizontal component is always 0. horizontal component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin. vertical component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin.

##### Remarks

Use this method only for composite fonts with vertical writing mode (i.e. if Font.IsHorizontalMode() returns false). The method will return 0 as vertical advance for simple fonts or for composite fonts with only horizontal writing mode. Relevant only for a Type0 font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetVerticalAdvance(int, ref double, ref double)

Gets the vertical advance.

##### Declaration

    public double GetVerticalAdvance(int char_code, ref double out_pos_vect_x, ref double out_pos_vect_y)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code | character to query for vertical advance
double | out_pos_vect_x | initialized by the method. horizontal component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin.
double | out_pos_vect_y | initialized by the method. vertical component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin.

##### Returns

Type | Description
--- | ---
double | an double array containing in the following order vertical advance. vertical advance is a displacement vector for vertical writing mode (i.e. writing mode 1); its horizontal component is always 0. horizontal component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin. vertical component of the position vector defining the position of the vertical writing mode origin relative to horizontal writing mode origin.

##### Remarks

Use this method only for composite fonts with vertical writing mode (i.e. if Font.IsHorizontalMode() returns false). The method will return 0 as vertical advance for simple fonts or for composite fonts with only horizontal writing mode. Relevant only for a Type0 font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### GetWidth(int)

Gets the width.

##### Declaration

    public double GetWidth(int char_code)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code | the char_code

##### Returns

Type | Description
--- | ---
double | advance width, measured in character space units for the glyph matching given character code. The function gets the advance width of the font glyph. The advance width is the amount by which the current point advances when the glyph is drawn. The advance width may not correspond to the visible width of the glyph and for this reason, the advance width cannot be used to determine the glyphs' bounding boxes.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsAllCap()

Checks if is all cap.

##### Declaration

    public bool IsAllCap()

##### Returns

Type | Description
--- | ---
bool | true if font contains no lowercase letters

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsCFF()

Checks if is cFF.

##### Declaration

    public bool IsCFF()

##### Returns

Type | Description
--- | ---
bool | true if the embedded font is represented as CFF (Compact Font Format).

##### Remarks

Only Type1 and Type1C fonts can be represented in CFF format

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsEmbedded()

Tests whether or not the specified font is stored as a font file in a stream embedded in the PDF file.

##### Declaration

    public bool IsEmbedded()

##### Returns

Type | Description
--- | ---
bool | true if the font is embedded in the file, false otherwise.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsFixedWidth()

Checks if is fixed width.

##### Declaration

    public bool IsFixedWidth()

##### Returns

Type | Description
--- | ---
bool | true if all glyphs have the same width

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsForceBold()

Checks if is force bold.

##### Declaration

    public bool IsForceBold()

##### Returns

Type | Description
--- | ---
bool | true if bold glyphs should be painted with extra pixels at very small text sizes.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsHorizontalMode()

Checks if is horizontal mode.

##### Declaration

    public bool IsHorizontalMode()

##### Returns

Type | Description
--- | ---
bool | true if the font uses horizontal writing mode, false for vertical writing mode.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsItalic()

Checks if is italic.

##### Declaration

    public bool IsItalic()

##### Returns

Type | Description
--- | ---
bool | true if glyphs have dominant vertical strokes that are slanted.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsSerif()

Checks if is serif.

##### Declaration

    public bool IsSerif()

##### Returns

Type | Description
--- | ---
bool | true if glyphs have serifs

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsSimple()

Checks if is simple.

##### Declaration

    public bool IsSimple()

##### Returns

Type | Description
--- | ---
bool | true for non-CID based fonts such as Type1, TrueType, and Type3

##### Remarks

All simple fonts have the following properties:

- Glyphs in the font are selected by single-byte character codes obtained from a string that is shown by the text-showing operators. Logically, these codes index into a table of 256 glyphs; the mapping from codes to glyphs is called the font's encoding. Each font program has a built-in encoding. Under some circumstances, the encoding can be altered by means described in Section 5.5.5 "Character Encoding" in PDF Reference Manual.
- Each glyph has a single set of metrics. Therefore simple fonts support only horizontal writing mode.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### IsSymbolic()

Checks if is symbolic.

##### Declaration

    public bool IsSymbolic()

##### Returns

Type | Description
--- | ---
bool | true if font contains characters outside the Adobe standard Latin character set.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### MapToCID(int)

Map to CID.

##### Declaration

    public int MapToCID(int char_code)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code | the char_code

##### Returns

Type | Description
--- | ---
int | a CID matching specified charcode.

##### Remarks

Relevant only for a Type0 font.

##### Exceptions

Type | Condition
--- | ---
PDFNetException | PDFNetException the PDFNet exception

#### MapToUnicode(int, ref int[], int, ref int)

##### Declaration

    public bool MapToUnicode(int char_code, ref int[] out_unicode, int in_uni_sz, ref int out_chars)

##### Parameters

Type | Name | Description
--- | --- | ---
int | char_code |
int[] | out_unicode |
int | in_uni_sz |
int | out_chars |

##### Returns

Type | Description
--- | ---
bool |

### Implements

IDisposable