Definition at line 50 of file Font.php.
◆ __construct()
Object constructor.
Definition at line 144 of file Font.php.
◆ __toString()
Returns the full name of the font in the encoding method of the current locale. Transliterates any characters that cannot be naturally represented in that character set.
- Returns
- string
Definition at line 160 of file Font.php.
getFontName($nameType, $language, $characterSet=null)
◆ decodeString()
decodeString |
( |
|
$string, |
|
|
|
$charEncoding |
|
) |
| |
|
abstract |
Convert string from the font encoding.
The method is used to convert strings retrieved from existing content streams
- Parameters
-
string | $string | |
string | $charEncoding | Character encoding of resulting text. |
- Returns
- string
◆ encodeString()
encodeString |
( |
|
$string, |
|
|
|
$charEncoding |
|
) |
| |
|
abstract |
Convert string to the font encoding.
The method is used to prepare string for text drawing operators
- Parameters
-
string | $string | |
string | $charEncoding | Character encoding of source text. |
- Returns
- string
◆ getAscent()
Returns the typographic ascent in font glyph units.
The typographic ascent is the distance from the font's baseline to the top of the text frame. It is frequently used to locate the initial baseline for a paragraph of text inside a given rectangle.
- Returns
- integer
Definition at line 362 of file Font.php.
◆ getCoveredPercentage()
getCoveredPercentage |
( |
|
$string, |
|
|
|
$charEncoding = '' |
|
) |
| |
|
abstract |
Returns a number between 0 and 1 inclusive that indicates the percentage of characters in the string which are covered by glyphs in this font.
Since no one font will contain glyphs for the entire Unicode character range, this method can be used to help locate a suitable font when the actual contents of the string are not known.
Note that some fonts lie about the characters they support. Additionally, fonts don't usually contain glyphs for control characters such as tabs and line breaks, so it is rare that you will get back a full 1.0 score. The resulting value should be considered informational only.
- Parameters
-
string | $string | |
string | $charEncoding | (optional) Character encoding of source text. If omitted, uses 'current locale'. |
- Returns
- float
◆ getDescent()
Returns the typographic descent in font glyph units.
The typographic descent is the distance below the font's baseline to the bottom of the text frame. It is always negative.
- Returns
- integer
Definition at line 375 of file Font.php.
◆ getFontName()
getFontName |
( |
|
$nameType, |
|
|
|
$language, |
|
|
|
$characterSet = null |
|
) |
| |
Returns the specified descriptive name for the font.
The font name type is usually one of the following:
Note that not all names are available for all fonts. In addition, some fonts may contain additional names, whose indicies are in the range 256 to 32767 inclusive, which are used for certain font layout features.
If the preferred language translation is not available, uses the first available translation for the name, which is usually English.
If the requested name does not exist, returns null.
All names are stored internally as Unicode strings, using UTF-16BE encoding. You may optionally supply a different resulting character set.
- Parameters
-
integer | $nameType | Type of name requested. |
mixed | $language | Preferred language (string) or array of languages in preferred order. Use the ISO 639 standard 2-letter language codes. |
string | $characterSet | (optional) Desired resulting character set. You may use any character set supported by iconv(); |
- Returns
- string
Definition at line 224 of file Font.php.
226 if (! isset($this->_fontNames[$nameType])) {
230 if (is_array($language)) {
231 foreach ($language as
$code) {
232 if (isset($this->_fontNames[$nameType][
$code])) {
238 if (isset($this->_fontNames[$nameType][$language])) {
239 $name = $this->_fontNames[$nameType][$language];
244 if (
$name ===
null) {
245 $names = $this->_fontNames[$nameType];
246 $name = reset($names);
250 if (($characterSet !==
null) && ($characterSet !=
'UTF-16BE') && PHP_OS !=
'AIX') {
251 $name = iconv(
'UTF-16BE', $characterSet,
$name);
if(!isset($_GET['name'])) $name
◆ getFontNames()
Returns whole set of font names.
- Returns
- array
Definition at line 261 of file Font.php.
◆ getFontType()
Returns the type of font.
- Returns
- integer One of the TYPE_ constants defined in Zend_Pdf_Font.
Definition at line 174 of file Font.php.
◆ getLineGap()
Returns the typographic line gap in font glyph units.
The typographic line gap is the distance between the bottom of the text frame of one line to the top of the text frame of the next. It is typically combined with the typographical ascent and descent to determine the font's total line height (or leading).
- Returns
- integer
Definition at line 390 of file Font.php.
◆ getLineHeight()
Returns the suggested line height (or leading) in font glyph units.
This value is determined by adding together the values of the typographic ascent, descent, and line gap. This value yields the suggested line spacing as determined by the font developer.
It should be noted that this is only a guideline; layout engines will frequently modify this value to achieve special effects such as double- spacing.
- Returns
- integer
Definition at line 408 of file Font.php.
◆ getStrikePosition()
Returns the suggested position above the text baseline of the strikethrough in glyph units.
- Returns
- integer
Definition at line 325 of file Font.php.
◆ getStrikeThickness()
Returns the suggested line thickness of the strikethrough in glyph units.
- Returns
- integer
Definition at line 335 of file Font.php.
◆ getUnderlinePosition()
Returns the suggested position below the text baseline of the underline in glyph units.
This value is usually negative.
- Returns
- integer
Definition at line 304 of file Font.php.
◆ getUnderlineThickness()
getUnderlineThickness |
( |
| ) |
|
Returns the suggested line thickness of the underline in glyph units.
- Returns
- integer
Definition at line 314 of file Font.php.
◆ getUnitsPerEm()
Returns the number of glyph units per em.
Used to convert glyph space to user space. Frequently used in conjunction with widthsForGlyphs() to calculate the with of a run of text.
- Returns
- integer
Definition at line 348 of file Font.php.
◆ glyphNumberForCharacter()
glyphNumberForCharacter |
( |
|
$characterCode | ) |
|
|
abstract |
Returns the glyph number corresponding to the Unicode character.
If a particular character doesn't exist in this font, the special 'missing character glyph' will be substituted.
See also glyphNumbersForCharacters() which is optimized for bulk operations.
- Parameters
-
integer | $characterCode | Unicode character code (code point). |
- Returns
- integer Glyph number.
◆ glyphNumbersForCharacters()
glyphNumbersForCharacters |
( |
|
$characterCodes | ) |
|
|
abstract |
Returns an array of glyph numbers corresponding to the Unicode characters.
If a particular character doesn't exist in this font, the special 'missing character glyph' will be substituted.
See also glyphNumberForCharacter().
- Parameters
-
array | $characterCodes | Array of Unicode character codes (code points). |
- Returns
- array Array of glyph numbers.
◆ isBold()
Returns true if font is bold.
- Returns
- boolean
Definition at line 271 of file Font.php.
◆ isItalic()
Returns true if font is italic.
- Returns
- boolean
Definition at line 281 of file Font.php.
◆ isMonospace()
Returns true if font is monospace.
- Returns
- boolean
Definition at line 291 of file Font.php.
◆ toEmSpace()
If the font's glyph space is not 1000 units per em, converts the value.
Definition at line 522 of file Font.php.
524 if ($this->_unitsPerEm == 1000) {
527 return ceil((
$value / $this->_unitsPerEm) * 1000);
◆ widthForGlyph()
widthForGlyph |
( |
|
$glyphNumber | ) |
|
|
abstract |
Returns the width of the glyph.
Like widthsForGlyphs() but used for one glyph at a time.
- Parameters
-
- Returns
- integer
- Exceptions
-
◆ widthsForGlyphs()
widthsForGlyphs |
( |
|
$glyphNumbers | ) |
|
|
abstract |
Returns the widths of the glyphs.
The widths are expressed in the font's glyph space. You are responsible for converting to user space as necessary. See unitsPerEm().
See also widthForGlyph().
- Parameters
-
array | $glyphNumbers | Array of glyph numbers. |
- Returns
- array Array of glyph widths (integers).
- Exceptions
-
◆ $_ascent
◆ $_descent
◆ $_fontNames
◆ $_fontType
◆ $_isBold
◆ $_isItalic
◆ $_isMonospace
◆ $_lineGap
◆ $_strikePosition
◆ $_strikeThickness
◆ $_underlinePosition
◆ $_underlineThickness
◆ $_unitsPerEm
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Pdf/Resource/Font.php