PdfFont Object

Overview

PdfFont represents a font to be used with text-drawing methods. An instance of PdfFont is obtainable via the PdfFonts collection's Item property or LoadFromFile method.

Member List

Properties


int CapHeight (Read-only)

Returns the distance between the baseline and the approximate height of uppercase letters measured in font units for this font.

To convert this value to user coordinates, multiply this value by font size and divide by UnitsPerEm.


int Embedding (Read-only)

Returns font embedding licensing rights for the font. Most common values are:

  • 0 - Installable embedding allowed.
  • 2 - Restricted license embedding. No embedding allowed.
  • 6 - Print & Preview embedding allowed. The font may be embedded in a document but installed temporarily on a remote system. Documents can only be opened read-only.
  • 10 - Editable embedding only, the font may be embedded but must only be installed temporarily on a remote system.

When using an external font in PDF documents you generate with AspPDF, you must always check the Embedding property of this font. The value of 2 prohibits font embedding and such a font should be avoided, unless instructed otherwise by the font vendor.

For more information, see Section 6.2.3 - Copyright Issues.


string Face (Read-only)
Returns this font's face or .TTF filename, such as "Courier-Bold" or "Arial".

string Family (Read-only)
Returns this font's family name. For example, the four fonts "Courier New", "Courier New Bold", "Courier New Italic" and "Courier New Bold Italic" will return the family name of "Courier New".

bool SymbolFont (Read-only)
Returns True if this is a symbol font. Symbol fonts do not contain a Unicode encoding table and their character ranges are usually between &HF020 and &HF0FF. The freeware chess font MERIFONT.TTF used in Chapter 7 of the manual is an example of a symbol font.

int UnitsPerEm (Read-only)
Returns the number of logical units in this font's glyph coordinate system. This property returns 1000 for the 14 standard PDF fonts, and 2048 for most TrueType fonts.

Methods


float GetParagraphHeight(string Text, object Param)

Returns the height (in default user units) of Text if displayed on a page as a multi-line paragraph. This method should be used to determine the vertical extent of a text paragraph at run-time for page layout purposes.

Param is a PdfParam object or parameter string. The only required parameter is Width which specifies the desired width of the paragraph for which the height is to be calculated. Other acceptable parameters are the same as for the PdfCell.AddText method.

This method was introduced by Version 1.5 of AspPDF.


PdfRect GetTextExtent(string Text, float Size)
Returns the horizontal and vertical dimensions of the specified text string when drawn horizontally using this font and the specified font size. The dimensions are returned in the form of a PdfRect object. PdfRect's Left and Bottom properties are set to 0, and Right and Top properties contain the text string's length and height in user units.