Abstract factory class which vends {@link Zend_Pdf_Resource_Font} objects.

Font objects themselves are normally instantiated through the factory methods \fontWithName() or \fontWithPath().

This class is also the home for font-related constants because the name of the true base class (Zend_Pdf_Resource_Font) is not intuitive for the end user.

package Zend_Pdf Fonts Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) New BSD License

## Returns a {@link Zend_Pdf_Resource_Font} object by full name.

`fontWithName(string \$name, integer \$embeddingOptions` = 0`) : \Zend_Pdf_Resource_Font`
Static

This is the preferred method to obtain one of the standard 14 PDF fonts.

The result of this method is cached, preventing unnecessary duplication of font objects. Repetitive calls for a font with the same name will return the same object.

The \$embeddingOptions parameter allows you to set certain flags related to font embedding. You may combine options by OR-ing them together. See the EMBED_ constants defined in Zend_Pdf_Font for the list of available options and their descriptions. Note that this value is only used when creating a font for the first time. If a font with the same name already exists, you will get that object and the options you specify here will be ignored. This is because fonts are only embedded within the PDF file once.

If the font name supplied does not match the name of a previously instantiated object and it is not one of the 14 standard PDF fonts, an exception will be thrown.

### Parameters

#### \$name

`string`

Full PostScript name of font.

#### \$embeddingOptions

`integer`

(optional) Options for font embedding.

### Returns

`\Zend_Pdf_Resource_Font`

## Returns a {@link Zend_Pdf_Resource_Font} object by file path.

`fontWithPath(string \$filePath, integer \$embeddingOptions` = 0`) : \Zend_Pdf_Resource_Font`
Static

The result of this method is cached, preventing unnecessary duplication of font objects. Repetitive calls for the font with the same path will return the same object.

The \$embeddingOptions parameter allows you to set certain flags related to font embedding. You may combine options by OR-ing them together. See the EMBED_ constants defined in Zend_Pdf_Font for the list of available options and their descriptions. Note that this value is only used when creating a font for the first time. If a font with the same name already exists, you will get that object and the options you specify here will be ignored. This is because fonts are only embedded within the PDF file once.

If the file path supplied does not match the path of a previously instantiated object or the font type cannot be determined, an exception will be thrown.

### Parameters

#### \$filePath

`string`

Full path to the font file.

#### \$embeddingOptions

`integer`

(optional) Options for font embedding.

### Returns

`\Zend_Pdf_Resource_Font`

## Attempts to extract a TrueType font from the data source.

`_extractTrueTypeFont(\Zend_Pdf_FileParserDataSource \$dataSource, integer \$embeddingOptions) : \Zend_Pdf_Resource_Font_OpenType_TrueType`
Static

If the font parser throws an exception that suggests the data source simply doesn't contain a TrueType font, catches it and returns null. If an exception is thrown that suggests the TrueType font is corrupt or otherwise unusable, throws that exception. If successful, returns the font object.

### Parameters

#### \$dataSource

`\Zend_Pdf_FileParserDataSource`

#### \$embeddingOptions

`integer`

Options for font embedding.

### Returns

`\Zend_Pdf_Resource_Font_OpenType_TrueType`May also return null if the data source does not appear to contain a TrueType font.

## Array whose keys are the md5 hash of the full paths on disk for parsed fonts. The values are the font objects themselves.

`\$_fontFilePaths : array`

### Default

`array()`
Static

## Array whose keys are the unique PostScript names of instantiated fonts.

`\$_fontNames : array`

### Default

`array()`
Static

The values are the font objects themselves.

## Embed, but do not compress the font in the PDF document.

`EMBED_DONT_COMPRESS = 4 `

## Do not embed the font in the PDF document.

`EMBED_DONT_EMBED = 1 `

## Embed, but do not subset the font in the PDF document.

`EMBED_DONT_SUBSET = 2 `

## Suppress the exception normally thrown if the font cannot be embedded due to its copyright bits being set.

`EMBED_SUPPRESS_EMBED_EXCEPTION = 8 `

## Name of the standard PDF font Courier.

`FONT_COURIER = 'Courier' `

## Name of the bold style of the standard PDF font Courier.

`FONT_COURIER_BOLD = 'Courier-Bold' `

## Convenience constant for a common misspelling of {@link FONT_COURIER_BOLD_OBLIQUE}.

`FONT_COURIER_BOLD_ITALIC = 'Courier-BoldOblique' `

## Name of the bold and italic style of the standard PDF font Courier.

`FONT_COURIER_BOLD_OBLIQUE = 'Courier-BoldOblique' `

## Convenience constant for a common misspelling of {@link FONT_COURIER_OBLIQUE}.

`FONT_COURIER_ITALIC = 'Courier-Oblique' `

## Name of the italic style of the standard PDF font Courier.

`FONT_COURIER_OBLIQUE = 'Courier-Oblique' `

## Name of the standard PDF font Helvetica.

`FONT_HELVETICA = 'Helvetica' `

## Name of the bold style of the standard PDF font Helvetica.

`FONT_HELVETICA_BOLD = 'Helvetica-Bold' `

## Convenience constant for a common misspelling of {@link FONT_HELVETICA_BOLD_OBLIQUE}.

`FONT_HELVETICA_BOLD_ITALIC = 'Helvetica-BoldOblique' `

## Name of the bold and italic style of the standard PDF font Helvetica.

`FONT_HELVETICA_BOLD_OBLIQUE = 'Helvetica-BoldOblique' `

## Convenience constant for a common misspelling of {@link FONT_HELVETICA_OBLIQUE}.

`FONT_HELVETICA_ITALIC = 'Helvetica-Oblique' `

## Name of the italic style of the standard PDF font Helvetica.

`FONT_HELVETICA_OBLIQUE = 'Helvetica-Oblique' `

## Name of the standard PDF font Symbol.

`FONT_SYMBOL = 'Symbol' `

## Convenience constant for a common misspelling of {@link FONT_TIMES_ROMAN}.

`FONT_TIMES = 'Times-Roman' `

## Name of the bold style of the standard PDF font Times.

`FONT_TIMES_BOLD = 'Times-Bold' `

## Name of the bold and italic style of the standard PDF font Times.

`FONT_TIMES_BOLD_ITALIC = 'Times-BoldItalic' `

## Name of the italic style of the standard PDF font Times.

`FONT_TIMES_ITALIC = 'Times-Italic' `

## Name of the standard PDF font Times.

`FONT_TIMES_ROMAN = 'Times-Roman' `

## Name of the standard PDF font Zapf Dingbats.

`FONT_ZAPFDINGBATS = 'ZapfDingbats' `

## PostScript CID findfont name.

`NAME_CID_NAME = 20 `

## Description of the font. May contain revision information, usage recommendations, features, etc.

`NAME_DESCRIPTION = 10 `

## Name of the designer of the font.

`NAME_DESIGNER = 9 `

## URL of the font designer ({@link NAME_DESIGNER}).

`NAME_DESIGNER_URL = 12 `

## Font family name. Used to group similar styles of fonts together.

`NAME_FAMILY = 1 `

## Full font name. Usually a combination of the {@link NAME_FAMILY} and {@link NAME_STYLE} strings.

`NAME_FULL = 4 `

## Unique font identifier.

`NAME_ID = 3 `

## Plain language licensing terms for the font.

`NAME_LICENSE = 13 `

## URL of more detailed licensing information for the font.

`NAME_LICENSE_URL = 14 `

## Name of the font manufacturer.

`NAME_MANUFACTURER = 8 `

## PostScript name for the font. This is the name used to identify fonts internally and within the PDF file.

`NAME_POSTSCRIPT = 6 `

## Preferred font family. Used by some fonts to work around a Microsoft Windows limitation where only four fonts styles can share the same {@link NAME_FAMILY} value.

`NAME_PREFERRED_FAMILY = 16 `

## Preferred font style. A more descriptive string than {@link NAME_STYLE}.

`NAME_PREFERRED_STYLE = 17 `

## Suggested text to use as a representative sample of the font.

`NAME_SAMPLE_TEXT = 19 `

## Font style within the font family. Examples: Regular, Italic, Bold, etc.

`NAME_STYLE = 2 `

## Font trademark notice. This is distinct from the {@link NAME_COPYRIGHT}.

`NAME_TRADEMARK = 7 `

## URL of the font vendor. Some fonts may contain a unique serial number embedded in this URL, which is used for licensing.

`NAME_VENDOR_URL = 11 `

## Version number of the font.

`NAME_VERSION = 5 `

## CID font containing a PostScript Type 1 font.

`TYPE_CIDFONT_TYPE_0 = 5 `

These fonts are used only to construct Type 0 composite fonts and can't be used directly

## CID font containing a TrueType font or an OpenType font containing TrueType outlines.

`TYPE_CIDFONT_TYPE_2 = 6 `

These fonts are used only to construct Type 0 composite fonts and can't be used directly

## One of the standard 14 PDF fonts.

`TYPE_STANDARD = 1 `

## A TrueType font or an OpenType font containing TrueType outlines.

`TYPE_TRUETYPE = 3 `

## Type 0 composite font.

`TYPE_TYPE_0 = 4 `

## A PostScript Type 1 font.

`TYPE_TYPE_1 = 2 `

## Unknown font type.

`TYPE_UNKNOWN = 0 `

## Black (Heavy) font weight.

`WEIGHT_BLACK = 900 `

## Bold font weight.

`WEIGHT_BOLD = 700 `

## Extra-bold (Ultra-bold) font weight.

`WEIGHT_EXTRA_BOLD = 800 `

## Extra-light (Ultra-light) font weight.

`WEIGHT_EXTRA_LIGHT = 200 `

## Light font weight.

`WEIGHT_LIGHT = 300 `

## Medium font weight.

`WEIGHT_MEDIUM = 500 `

## Normal (Regular) font weight.

`WEIGHT_NORMAL = 400 `

## Semi-bold (Demi-bold) font weight.

`WEIGHT_SEMI_BOLD = 600 `

## Thin font weight.

`WEIGHT_THIN = 100 `

## Condensed font width. Typically 75% of normal.

`WIDTH_CONDENSED = 3 `

## Expanded font width. Typically 125% of normal.

`WIDTH_EXPANDED = 7 `

## Extra-condensed font width. Typically 62.5% of normal.

`WIDTH_EXTRA_CONDENSED = 2 `

## Extra-expanded font width. Typically 150% of normal.

`WIDTH_EXTRA_EXPANDED = 8 `

## Normal (Medium) font width.

`WIDTH_NORMAL = 5 `

## Semi-condensed font width. Typically 87.5% of normal.

`WIDTH_SEMI_CONDENSED = 4 `

## Semi-expanded font width. Typically 112.5% of normal.

`WIDTH_SEMI_EXPANDED = 6 `

## Ultra-condensed font width. Typically 50% of normal.

`WIDTH_ULTRA_CONDENSED = 1 `

## Ultra-expanded font width. Typically 200% of normal.

`WIDTH_ULTRA_EXPANDED = 9 `