Definition at line 39 of file Font.php.
◆ _extractTrueTypeFont()
static _extractTrueTypeFont |
( |
|
$dataSource, |
|
|
|
$embeddingOptions |
|
) |
| |
|
staticprotected |
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.
- Parameters
-
- Returns
- Zend_Pdf_Resource_Font_OpenType_TrueType May also return null if the data source does not appear to contain a TrueType font.
- Exceptions
-
Definition at line 695 of file Font.php.
698 #require_once 'Zend/Pdf/FileParser/Font/OpenType/TrueType.php'; 701 $fontParser->parse();
702 if ($fontParser->isAdobeLatinSubset) {
703 #require_once 'Zend/Pdf/Resource/Font/Simple/Parsed/TrueType.php'; 706 #require_once 'Zend/Pdf/Resource/Font/CidFont/TrueType.php'; 707 #require_once 'Zend/Pdf/Resource/Font/Type0.php'; 719 #require_once 'Zend/Pdf/Exception.php'; 720 switch ($e->getCode()) {
◆ fontWithName()
static fontWithName |
( |
|
$name, |
|
|
|
$embeddingOptions = 0 |
|
) |
| |
|
static |
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.
- Parameters
-
string | $name | Full PostScript name of font. |
integer | $embeddingOptions | (optional) Options for font embedding. |
- Returns
- Zend_Pdf_Resource_Font
- Exceptions
-
- Todo:
- It would be cool to be able to have a mapping of font names to file paths in a configuration file for frequently used custom fonts. This would allow a user to use custom fonts without having to hard-code file paths all over the place. Table this idea until Zend_Config is ready.
Definition at line 463 of file Font.php.
467 if (isset(Zend_Pdf_Font::$_fontNames[
$name])) {
468 return Zend_Pdf_Font::$_fontNames[
$name];
484 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Courier.php'; 489 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierBold.php'; 494 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierOblique.php'; 499 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/CourierBoldOblique.php'; 504 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Helvetica.php'; 509 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBold.php'; 514 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaOblique.php'; 519 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/HelveticaBoldOblique.php'; 524 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/Symbol.php'; 529 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesRoman.php'; 534 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesBold.php'; 539 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesItalic.php'; 544 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/TimesBoldItalic.php'; 549 #require_once 'Zend/Pdf/Resource/Font/Simple/Standard/ZapfDingbats.php'; 554 #require_once 'Zend/Pdf/Exception.php'; 561 Zend_Pdf_Font::$_fontNames[
$name] = $font;
const FONT_COURIER_BOLD_OBLIQUE
const FONT_HELVETICA_OBLIQUE
const FONT_HELVETICA_BOLD_OBLIQUE
const FONT_COURIER_OBLIQUE
const FONT_TIMES_BOLD_ITALIC
const FONT_HELVETICA_BOLD
if(!isset($_GET['name'])) $name
◆ fontWithPath()
static fontWithPath |
( |
|
$filePath, |
|
|
|
$embeddingOptions = 0 |
|
) |
| |
|
static |
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.
- Parameters
-
string | $filePath | Full path to the font file. |
integer | $embeddingOptions | (optional) Options for font embedding. |
- Returns
- Zend_Pdf_Resource_Font
- Exceptions
-
Definition at line 590 of file Font.php.
594 $filePathKey = md5($filePath);
595 if (isset(Zend_Pdf_Font::$_fontFilePaths[$filePathKey])) {
596 return Zend_Pdf_Font::$_fontFilePaths[$filePathKey];
602 #require_once 'Zend/Pdf/FileParserDataSource/File.php'; 608 $fileExtension = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
613 switch ($fileExtension) {
627 if ($font ===
null) {
637 if (($font ===
null) && ($fileExtension !=
'ttf')) {
653 if ($font !==
null) {
658 Zend_Pdf_Font::$_fontNames[$fontName] = $font;
659 $filePathKey = md5($filePath);
660 Zend_Pdf_Font::$_fontFilePaths[$filePathKey] = $font;
666 #require_once 'Zend/Pdf/Exception.php'; static _extractTrueTypeFont($dataSource, $embeddingOptions)
const CANT_DETERMINE_FONT_TYPE
◆ EMBED_DONT_COMPRESS
const EMBED_DONT_COMPRESS = 0x04 |
Embed, but do not compress the font in the PDF document.
Definition at line 402 of file Font.php.
◆ EMBED_DONT_EMBED
const EMBED_DONT_EMBED = 0x01 |
Do not embed the font in the PDF document.
Definition at line 392 of file Font.php.
◆ EMBED_DONT_SUBSET
const EMBED_DONT_SUBSET = 0x02 |
Embed, but do not subset the font in the PDF document.
Definition at line 397 of file Font.php.
◆ EMBED_SUPPRESS_EMBED_EXCEPTION
const EMBED_SUPPRESS_EMBED_EXCEPTION = 0x08 |
Suppress the exception normally thrown if the font cannot be embedded due to its copyright bits being set.
Definition at line 408 of file Font.php.
◆ FONT_COURIER
const FONT_COURIER = 'Courier' |
Name of the standard PDF font Courier.
Definition at line 89 of file Font.php.
◆ FONT_COURIER_BOLD
const FONT_COURIER_BOLD = 'Courier-Bold' |
Name of the bold style of the standard PDF font Courier.
Definition at line 94 of file Font.php.
◆ FONT_COURIER_BOLD_ITALIC
const FONT_COURIER_BOLD_ITALIC = 'Courier-BoldOblique' |
◆ FONT_COURIER_BOLD_OBLIQUE
const FONT_COURIER_BOLD_OBLIQUE = 'Courier-BoldOblique' |
Name of the bold and italic style of the standard PDF font Courier.
Definition at line 110 of file Font.php.
◆ FONT_COURIER_ITALIC
const FONT_COURIER_ITALIC = 'Courier-Oblique' |
◆ FONT_COURIER_OBLIQUE
const FONT_COURIER_OBLIQUE = 'Courier-Oblique' |
Name of the italic style of the standard PDF font Courier.
Definition at line 99 of file Font.php.
◆ FONT_HELVETICA
const FONT_HELVETICA = 'Helvetica' |
Name of the standard PDF font Helvetica.
Definition at line 121 of file Font.php.
◆ FONT_HELVETICA_BOLD
const FONT_HELVETICA_BOLD = 'Helvetica-Bold' |
Name of the bold style of the standard PDF font Helvetica.
Definition at line 126 of file Font.php.
◆ FONT_HELVETICA_BOLD_ITALIC
const FONT_HELVETICA_BOLD_ITALIC = 'Helvetica-BoldOblique' |
◆ FONT_HELVETICA_BOLD_OBLIQUE
const FONT_HELVETICA_BOLD_OBLIQUE = 'Helvetica-BoldOblique' |
Name of the bold and italic style of the standard PDF font Helvetica.
Definition at line 142 of file Font.php.
◆ FONT_HELVETICA_ITALIC
const FONT_HELVETICA_ITALIC = 'Helvetica-Oblique' |
◆ FONT_HELVETICA_OBLIQUE
const FONT_HELVETICA_OBLIQUE = 'Helvetica-Oblique' |
Name of the italic style of the standard PDF font Helvetica.
Definition at line 131 of file Font.php.
◆ FONT_SYMBOL
const FONT_SYMBOL = 'Symbol' |
Name of the standard PDF font Symbol.
Definition at line 153 of file Font.php.
◆ FONT_TIMES
const FONT_TIMES = 'Times-Roman' |
◆ FONT_TIMES_BOLD
const FONT_TIMES_BOLD = 'Times-Bold' |
Name of the bold style of the standard PDF font Times.
Definition at line 169 of file Font.php.
◆ FONT_TIMES_BOLD_ITALIC
const FONT_TIMES_BOLD_ITALIC = 'Times-BoldItalic' |
Name of the bold and italic style of the standard PDF font Times.
Definition at line 179 of file Font.php.
◆ FONT_TIMES_ITALIC
const FONT_TIMES_ITALIC = 'Times-Italic' |
Name of the italic style of the standard PDF font Times.
Definition at line 174 of file Font.php.
◆ FONT_TIMES_ROMAN
const FONT_TIMES_ROMAN = 'Times-Roman' |
Name of the standard PDF font Times.
Definition at line 158 of file Font.php.
◆ FONT_ZAPFDINGBATS
const FONT_ZAPFDINGBATS = 'ZapfDingbats' |
Name of the standard PDF font Zapf Dingbats.
Definition at line 184 of file Font.php.
◆ NAME_CID_NAME
PostScript CID findfont name.
Definition at line 288 of file Font.php.
◆ NAME_COPYRIGHT
Full copyright notice for the font.
Definition at line 192 of file Font.php.
◆ NAME_DESCRIPTION
const NAME_DESCRIPTION = 10 |
Description of the font. May contain revision information, usage recommendations, features, etc.
Definition at line 245 of file Font.php.
◆ NAME_DESIGNER
Name of the designer of the font.
Definition at line 239 of file Font.php.
◆ NAME_DESIGNER_URL
const NAME_DESIGNER_URL = 12 |
◆ NAME_FAMILY
Font family name. Used to group similar styles of fonts together.
Definition at line 197 of file Font.php.
◆ NAME_FULL
◆ NAME_ID
Unique font identifier.
Definition at line 207 of file Font.php.
◆ NAME_LICENSE
Plain language licensing terms for the font.
Definition at line 261 of file Font.php.
◆ NAME_LICENSE_URL
const NAME_LICENSE_URL = 14 |
URL of more detailed licensing information for the font.
Definition at line 266 of file Font.php.
◆ NAME_MANUFACTURER
const NAME_MANUFACTURER = 8 |
Name of the font manufacturer.
Definition at line 234 of file Font.php.
◆ NAME_POSTSCRIPT
const NAME_POSTSCRIPT = 6 |
PostScript name for the font. This is the name used to identify fonts internally and within the PDF file.
Definition at line 224 of file Font.php.
◆ NAME_PREFERRED_FAMILY
const NAME_PREFERRED_FAMILY = 16 |
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.
Definition at line 273 of file Font.php.
◆ NAME_PREFERRED_STYLE
const NAME_PREFERRED_STYLE = 17 |
Preferred font style. A more descriptive string than NAME_STYLE.
Definition at line 278 of file Font.php.
◆ NAME_SAMPLE_TEXT
const NAME_SAMPLE_TEXT = 19 |
Suggested text to use as a representative sample of the font.
Definition at line 283 of file Font.php.
◆ NAME_STYLE
Font style within the font family. Examples: Regular, Italic, Bold, etc.
Definition at line 202 of file Font.php.
◆ NAME_TRADEMARK
◆ NAME_VENDOR_URL
const NAME_VENDOR_URL = 11 |
URL of the font vendor. Some fonts may contain a unique serial number embedded in this URL, which is used for licensing.
Definition at line 251 of file Font.php.
◆ NAME_VERSION
Version number of the font.
Definition at line 218 of file Font.php.
◆ TYPE_CIDFONT_TYPE_0
const TYPE_CIDFONT_TYPE_0 = 5 |
CID font containing a PostScript Type 1 font. These fonts are used only to construct Type 0 composite fonts and can't be used directly
Definition at line 75 of file Font.php.
◆ TYPE_CIDFONT_TYPE_2
const TYPE_CIDFONT_TYPE_2 = 6 |
CID font containing a TrueType font or an OpenType font containing TrueType outlines. These fonts are used only to construct Type 0 composite fonts and can't be used directly
Definition at line 81 of file Font.php.
◆ TYPE_STANDARD
One of the standard 14 PDF fonts.
Definition at line 54 of file Font.php.
◆ TYPE_TRUETYPE
A TrueType font or an OpenType font containing TrueType outlines.
Definition at line 64 of file Font.php.
◆ TYPE_TYPE_0
Type 0 composite font.
Definition at line 69 of file Font.php.
◆ TYPE_TYPE_1
A PostScript Type 1 font.
Definition at line 59 of file Font.php.
◆ TYPE_UNKNOWN
Unknown font type.
Definition at line 49 of file Font.php.
◆ WEIGHT_BLACK
Black (Heavy) font weight.
Definition at line 336 of file Font.php.
◆ WEIGHT_BOLD
Bold font weight.
Definition at line 326 of file Font.php.
◆ WEIGHT_EXTRA_BOLD
const WEIGHT_EXTRA_BOLD = 800 |
Extra-bold (Ultra-bold) font weight.
Definition at line 331 of file Font.php.
◆ WEIGHT_EXTRA_LIGHT
const WEIGHT_EXTRA_LIGHT = 200 |
Extra-light (Ultra-light) font weight.
Definition at line 301 of file Font.php.
◆ WEIGHT_LIGHT
Light font weight.
Definition at line 306 of file Font.php.
◆ WEIGHT_MEDIUM
const WEIGHT_MEDIUM = 500 |
Medium font weight.
Definition at line 316 of file Font.php.
◆ WEIGHT_NORMAL
const WEIGHT_NORMAL = 400 |
Normal (Regular) font weight.
Definition at line 311 of file Font.php.
◆ WEIGHT_SEMI_BOLD
const WEIGHT_SEMI_BOLD = 600 |
Semi-bold (Demi-bold) font weight.
Definition at line 321 of file Font.php.
◆ WEIGHT_THIN
Thin font weight.
Definition at line 296 of file Font.php.
◆ WIDTH_CONDENSED
const WIDTH_CONDENSED = 3 |
Condensed font width. Typically 75% of normal.
Definition at line 354 of file Font.php.
◆ WIDTH_EXPANDED
Expanded font width. Typically 125% of normal.
Definition at line 374 of file Font.php.
◆ WIDTH_EXTRA_CONDENSED
const WIDTH_EXTRA_CONDENSED = 2 |
Extra-condensed font width. Typically 62.5% of normal.
Definition at line 349 of file Font.php.
◆ WIDTH_EXTRA_EXPANDED
const WIDTH_EXTRA_EXPANDED = 8 |
Extra-expanded font width. Typically 150% of normal.
Definition at line 379 of file Font.php.
◆ WIDTH_NORMAL
Normal (Medium) font width.
Definition at line 364 of file Font.php.
◆ WIDTH_SEMI_CONDENSED
const WIDTH_SEMI_CONDENSED = 4 |
Semi-condensed font width. Typically 87.5% of normal.
Definition at line 359 of file Font.php.
◆ WIDTH_SEMI_EXPANDED
const WIDTH_SEMI_EXPANDED = 6 |
Semi-expanded font width. Typically 112.5% of normal.
Definition at line 369 of file Font.php.
◆ WIDTH_ULTRA_CONDENSED
const WIDTH_ULTRA_CONDENSED = 1 |
Ultra-condensed font width. Typically 50% of normal.
Definition at line 344 of file Font.php.
◆ WIDTH_ULTRA_EXPANDED
const WIDTH_ULTRA_EXPANDED = 9 |
Ultra-expanded font width. Typically 200% of normal.
Definition at line 384 of file Font.php.
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Pdf/Font.php