## Zend_Pdf_Font

Description

Abstract factory class which vends 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.

- abstract:
- license: New BSD License
- copyright: Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/Pdf/Font.php (line 94)

Class Constant Summary
EMBED_DONT_COMPRESS = 0x04
EMBED_DONT_EMBED = 0x01
EMBED_DONT_SUBSET = 0x02
EMBED_SUPPRESS_EMBED_EXCEPTION = 0x08
FONT_COURIER = 'Courier'
FONT_COURIER_BOLD = 'Courier-Bold'
FONT_COURIER_BOLD_ITALIC = 'Courier-BoldOblique'
FONT_COURIER_BOLD_OBLIQUE = 'Courier-BoldOblique'
FONT_COURIER_ITALIC = 'Courier-Oblique'
FONT_COURIER_OBLIQUE = 'Courier-Oblique'
FONT_HELVETICA = 'Helvetica'
FONT_HELVETICA_BOLD = 'Helvetica-Bold'
FONT_HELVETICA_BOLD_ITALIC = 'Helvetica-BoldOblique'
FONT_HELVETICA_BOLD_OBLIQUE = 'Helvetica-BoldOblique'
FONT_HELVETICA_ITALIC = 'Helvetica-Oblique'
FONT_HELVETICA_OBLIQUE = 'Helvetica-Oblique'
FONT_SYMBOL = 'Symbol'
FONT_TIMES = 'Times-Roman'
FONT_TIMES_BOLD = 'Times-Bold'
FONT_TIMES_BOLD_ITALIC = 'Times-BoldItalic'
FONT_TIMES_ITALIC = 'Times-Italic'
FONT_TIMES_ROMAN = 'Times-Roman'
FONT_ZAPFDINGBATS = 'ZapfDingbats'
NAME_CID_NAME = 20
NAME_COPYRIGHT = 0
NAME_DESCRIPTION = 10
NAME_DESIGNER = 9
NAME_DESIGNER_URL = 12
NAME_FAMILY = 1
NAME_FULL = 4
NAME_ID = 3
NAME_LICENSE = 13
NAME_LICENSE_URL = 14
NAME_MANUFACTURER = 8
NAME_POSTSCRIPT = 6
NAME_PREFERRED_FAMILY = 16
NAME_PREFERRED_STYLE = 17
NAME_SAMPLE_TEXT = 19
NAME_STYLE = 2
NAME_TRADEMARK = 7
NAME_VENDOR_URL = 11
NAME_VERSION = 5
TYPE_STANDARD = 1
TYPE_TRUETYPE = 3
TYPE_TYPE_1 = 2
TYPE_UNKNOWN = 0
WEIGHT_BLACK = 900
WEIGHT_BOLD = 700
WEIGHT_EXTRA_BOLD = 800
WEIGHT_EXTRA_LIGHT = 200
WEIGHT_LIGHT = 300
WEIGHT_MEDIUM = 500
WEIGHT_NORMAL = 400
WEIGHT_SEMI_BOLD = 600
WEIGHT_THIN = 100
WIDTH_CONDENSED = 3
WIDTH_EXPANDED = 7
WIDTH_EXTRA_CONDENSED = 2
WIDTH_EXTRA_EXPANDED = 8
WIDTH_NORMAL = 5
WIDTH_SEMI_CONDENSED = 4
WIDTH_SEMI_EXPANDED = 6
WIDTH_ULTRA_CONDENSED = 1
WIDTH_ULTRA_EXPANDED = 9
Method Summary
static Zend_Pdf_Resource_Font fontWithName (string $name, [integer $embeddingOptions = 0])
static Zend_Pdf_Resource_Font fontWithPath (string $filePath, [integer $embeddingOptions = 0])
static Zend_Pdf_Resource_Font_OpenType_TrueType _extractTrueTypeFont (Zend_Pdf_FileParserDataSource $dataSource, integer $embeddingOptions)
Methods
static fontWithName (line 501)

Returns a Zend_Pdf_Resource_Font object by full name.

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.

- access: public
- throws: Zend_Pdf_Exception

Zend_Pdf_Resource_Font fontWithName (string $name, integer $embeddingOptions)

- string $name: Full PostScript name of font.
- integer $embeddingOptions: (optional) Options for font embedding.

static fontWithPath (line 613)

Returns a Zend_Pdf_Resource_Font object by file path.

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.

- access: public
- throws: Zend_Pdf_Exception

Zend_Pdf_Resource_Font fontWithPath (string $filePath, integer $embeddingOptions)

- string $filePath: Full path to the font file.
- integer $embeddingOptions: (optional) Options for font embedding.

static _extractTrueTypeFont (line 716)

Attempts to extract a TrueType font from the data source.

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.

- return: May also return null if the data source does not appear to contain a TrueType font.
- access: protected
- throws: Zend_Pdf_Exception

Zend_Pdf_Resource_Font_OpenType_TrueType _extractTrueTypeFont (Zend_Pdf_FileParserDataSource $dataSource, integer $embeddingOptions)

- Zend_Pdf_FileParserDataSource $dataSource
- integer $embeddingOptions: Options for font embedding.

Class Constants
EMBED_DONT_COMPRESS = 0x04 (line 440)

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

EMBED_DONT_EMBED = 0x01 (line 430)

Do not embed the font in the PDF document.

EMBED_DONT_SUBSET = 0x02 (line 435)

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

EMBED_SUPPRESS_EMBED_EXCEPTION = 0x08 (line 446)

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

FONT_COURIER = 'Courier' (line 127)

Name of the standard PDF font Courier.

FONT_COURIER_BOLD = 'Courier-Bold' (line 132)

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

FONT_COURIER_BOLD_ITALIC = 'Courier-BoldOblique' (line 154)

Convenience constant for a common misspelling of FONT_COURIER_BOLD_OBLIQUE.

FONT_COURIER_BOLD_OBLIQUE = 'Courier-BoldOblique' (line 148)

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

FONT_COURIER_ITALIC = 'Courier-Oblique' (line 143)

Convenience constant for a common misspelling of FONT_COURIER_OBLIQUE.

FONT_COURIER_OBLIQUE = 'Courier-Oblique' (line 137)

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

FONT_HELVETICA = 'Helvetica' (line 159)

Name of the standard PDF font Helvetica.

FONT_HELVETICA_BOLD = 'Helvetica-Bold' (line 164)

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

FONT_HELVETICA_BOLD_ITALIC = 'Helvetica-BoldOblique' (line 186)

Convenience constant for a common misspelling of FONT_HELVETICA_BOLD_OBLIQUE.

FONT_HELVETICA_BOLD_OBLIQUE = 'Helvetica-BoldOblique' (line 180)

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

FONT_HELVETICA_ITALIC = 'Helvetica-Oblique' (line 175)

Convenience constant for a common misspelling of FONT_HELVETICA_OBLIQUE.

FONT_HELVETICA_OBLIQUE = 'Helvetica-Oblique' (line 169)

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

FONT_SYMBOL = 'Symbol' (line 191)

Name of the standard PDF font Symbol.

FONT_TIMES = 'Times-Roman' (line 202)

Convenience constant for a common misspelling of FONT_TIMES_ROMAN.

FONT_TIMES_BOLD = 'Times-Bold' (line 207)

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

FONT_TIMES_BOLD_ITALIC = 'Times-BoldItalic' (line 217)

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

FONT_TIMES_ITALIC = 'Times-Italic' (line 212)

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

FONT_TIMES_ROMAN = 'Times-Roman' (line 196)

Name of the standard PDF font Times.

FONT_ZAPFDINGBATS = 'ZapfDingbats' (line 222)

Name of the standard PDF font Zapf Dingbats.

NAME_CID_NAME = 20 (line 326)

PostScript CID findfont name.

NAME_COPYRIGHT = 0 (line 230)

Full copyright notice for the font.

NAME_DESCRIPTION = 10 (line 283)

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

NAME_DESIGNER = 9 (line 277)

Name of the designer of the font.

NAME_DESIGNER_URL = 12 (line 294)

URL of the font designer (NAME_DESIGNER).

NAME_FAMILY = 1 (line 235)

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

NAME_FULL = 4 (line 251)

Full font name. Usually a combination of the NAME_FAMILY and NAME_STYLE strings.

NAME_ID = 3 (line 245)

Unique font identifier.

NAME_LICENSE = 13 (line 299)

Plain language licensing terms for the font.

NAME_LICENSE_URL = 14 (line 304)

URL of more detailed licensing information for the font.

NAME_MANUFACTURER = 8 (line 272)

Name of the font manufacturer.

NAME_POSTSCRIPT = 6 (line 262)

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

NAME_PREFERRED_FAMILY = 16 (line 311)

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

NAME_PREFERRED_STYLE = 17 (line 316)

Preferred font style. A more descriptive string than NAME_STYLE.

NAME_SAMPLE_TEXT = 19 (line 321)

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

NAME_STYLE = 2 (line 240)

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

NAME_TRADEMARK = 7 (line 267)

Font trademark notice. This is distinct from the NAME_COPYRIGHT.

NAME_VENDOR_URL = 11 (line 289)

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

NAME_VERSION = 5 (line 256)

Version number of the font.

TYPE_STANDARD = 1 (line 109)

One of the standard 14 PDF fonts.

TYPE_TRUETYPE = 3 (line 119)

A TrueType font or an OpenType font containing TrueType outlines.

TYPE_TYPE_1 = 2 (line 114)

A PostScript Type 1 font.

TYPE_UNKNOWN = 0 (line 104)

Unknown font type.

WEIGHT_BLACK = 900 (line 374)

Black (Heavy) font weight.

WEIGHT_BOLD = 700 (line 364)

Bold font weight.

WEIGHT_EXTRA_BOLD = 800 (line 369)

Extra-bold (Ultra-bold) font weight.

WEIGHT_EXTRA_LIGHT = 200 (line 339)

Extra-light (Ultra-light) font weight.

WEIGHT_LIGHT = 300 (line 344)

Light font weight.

WEIGHT_MEDIUM = 500 (line 354)

Medium font weight.

WEIGHT_NORMAL = 400 (line 349)

Normal (Regular) font weight.

WEIGHT_SEMI_BOLD = 600 (line 359)

Semi-bold (Demi-bold) font weight.

WEIGHT_THIN = 100 (line 334)

Thin font weight.

WIDTH_CONDENSED = 3 (line 392)

Condensed font width. Typically 75% of normal.

WIDTH_EXPANDED = 7 (line 412)

Expanded font width. Typically 125% of normal.

WIDTH_EXTRA_CONDENSED = 2 (line 387)

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

WIDTH_EXTRA_EXPANDED = 8 (line 417)

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

WIDTH_NORMAL = 5 (line 402)

Normal (Medium) font width.

WIDTH_SEMI_CONDENSED = 4 (line 397)

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

WIDTH_SEMI_EXPANDED = 6 (line 407)

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

WIDTH_ULTRA_CONDENSED = 1 (line 382)

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

WIDTH_ULTRA_EXPANDED = 9 (line 422)

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

Documentation generated on Tue, 11 Jul 2006 12:17:20 -0500 by phpDocumentor 1.3.0RC6