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 |
---|---|
subpackage | Fonts |
copyright | Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) |
license | New BSD License |
fontWithName(string $name, integer $embeddingOptions = 0
) : \Zend_Pdf_Resource_Font
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.
string
Full PostScript name of font.
integer
(optional) Options for font embedding.
\Zend_Pdf_Exception |
---|
\Zend_Pdf_Resource_Font
fontWithPath(string $filePath, integer $embeddingOptions = 0
) : \Zend_Pdf_Resource_Font
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.
string
Full path to the font file.
integer
(optional) Options for font embedding.
\Zend_Pdf_Exception |
---|
\Zend_Pdf_Resource_Font
_extractTrueTypeFont(\Zend_Pdf_FileParserDataSource $dataSource, integer $embeddingOptions) : \Zend_Pdf_Resource_Font_OpenType_TrueType
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.
\Zend_Pdf_FileParserDataSource
integer
Options for font embedding.
\Zend_Pdf_Exception |
---|
\Zend_Pdf_Resource_Font_OpenType_TrueType
May also return null if
the data source does not appear to contain a TrueType font.$_fontFilePaths : array
array()
$_fontNames : array
array()
The values are the font objects themselves.
EMBED_DONT_COMPRESS = 4
EMBED_DONT_EMBED = 1
EMBED_DONT_SUBSET = 2
EMBED_SUPPRESS_EMBED_EXCEPTION = 8
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_CIDFONT_TYPE_0 = 5
These fonts are used only to construct Type 0 composite fonts and can't be used directly
TYPE_CIDFONT_TYPE_2 = 6
These fonts are used only to construct Type 0 composite fonts and can't be used directly
TYPE_STANDARD = 1
TYPE_TRUETYPE = 3
TYPE_TYPE_0 = 4
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