Zend Framework  1.12
Public Member Functions | Protected Attributes | List of all members
Zend_Pdf_Resource_Font Class Reference

Public Member Functions

 __construct ()
 Object constructor.
 
 __toString ()
 Returns the full name of the font in the encoding method of the current locale.
 
 getFontType ()
 Returns the type of font.
 
 getFontName ($nameType, $language, $characterSet=null)
 Returns the specified descriptive name for the font.
 
 getFontNames ()
 Returns whole set of font names.
 
 isBold ()
 Returns true if font is bold.
 
 isItalic ()
 Returns true if font is italic.
 
 isMonospace ()
 Returns true if font is monospace.
 
 getUnderlinePosition ()
 Returns the suggested position below the text baseline of the underline in glyph units.
 
 getUnderlineThickness ()
 Returns the suggested line thickness of the underline in glyph units.
 
 getStrikePosition ()
 Returns the suggested position above the text baseline of the strikethrough in glyph units.
 
 getStrikeThickness ()
 Returns the suggested line thickness of the strikethrough in glyph units.
 
 getUnitsPerEm ()
 Returns the number of glyph units per em.
 
 getAscent ()
 Returns the typographic ascent in font glyph units.
 
 getDescent ()
 Returns the typographic descent in font glyph units.
 
 getLineGap ()
 Returns the typographic line gap in font glyph units.
 
 getLineHeight ()
 Returns the suggested line height (or leading) in font glyph units.
 
 glyphNumbersForCharacters ($characterCodes)
 Returns an array of glyph numbers corresponding to the Unicode characters.
 
 glyphNumberForCharacter ($characterCode)
 Returns the glyph number corresponding to the Unicode character.
 
 getCoveredPercentage ($string, $charEncoding= '')
 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.
 
 widthsForGlyphs ($glyphNumbers)
 Returns the widths of the glyphs.
 
 widthForGlyph ($glyphNumber)
 Returns the width of the glyph.
 
 encodeString ($string, $charEncoding)
 Convert string to the font encoding.
 
 decodeString ($string, $charEncoding)
 Convert string from the font encoding.
 
 toEmSpace ($value)
 If the font's glyph space is not 1000 units per em, converts the value.
 
- Public Member Functions inherited from Zend_Pdf_Resource
 __construct ($resource)
 Object constructor.
 
 __clone ()
 Clone page, extract it and dependent objects from the current document, so it can be used within other docs.
 
 cloneResource ($factory, &$processed)
 Clone resource, extract it and dependent objects from the current document, so it can be used within other docs.
 
 getResource ()
 Get resource.
 
 getFactory ()
 Get factory.
 

Protected Attributes

 $_fontType = Zend_Pdf_Font::TYPE_UNKNOWN
 
 $_fontNames = array()
 
 $_isBold = false
 
 $_isItalic = false
 
 $_isMonospace = false
 
 $_underlinePosition = 0
 
 $_underlineThickness = 0
 
 $_strikePosition = 0
 
 $_strikeThickness = 0
 
 $_unitsPerEm = 0
 
 $_ascent = 0
 
 $_descent = 0
 
 $_lineGap = 0
 
- Protected Attributes inherited from Zend_Pdf_Resource
 $_objectFactory
 
 $_resource
 

Constructor & Destructor Documentation

__construct ( )

Object constructor.

Member Function Documentation

__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
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$charEncodingCharacter encoding of resulting text.
Returns
string
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$charEncodingCharacter 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
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
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$nameTypeType of name requested.
mixed$languagePreferred 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
getFontNames ( )

Returns whole set of font names.

Returns
array
getFontType ( )

Returns the type of font.

Returns
integer One of the TYPE_ constants defined in Zend_Pdf_Font.
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
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
getStrikePosition ( )

Returns the suggested position above the text baseline of the strikethrough in glyph units.

Returns
integer
getStrikeThickness ( )

Returns the suggested line thickness of the strikethrough in glyph units.

Returns
integer
getUnderlinePosition ( )

Returns the suggested position below the text baseline of the underline in glyph units.

This value is usually negative.

Returns
integer
getUnderlineThickness ( )

Returns the suggested line thickness of the underline in glyph units.

Returns
integer
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
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$characterCodeUnicode character code (code point).
Returns
integer Glyph number.
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$characterCodesArray of Unicode character codes (code points).
Returns
array Array of glyph numbers.
isBold ( )

Returns true if font is bold.

Returns
boolean
isItalic ( )

Returns true if font is italic.

Returns
boolean
isMonospace ( )

Returns true if font is monospace.

Returns
boolean
toEmSpace (   $value)

If the font's glyph space is not 1000 units per em, converts the value.

widthForGlyph (   $glyphNumber)
abstract

Returns the width of the glyph.

Like widthsForGlyphs() but used for one glyph at a time.

Parameters
integer$glyphNumber
Returns
integer
Exceptions
Zend_Pdf_Exception
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$glyphNumbersArray of glyph numbers.
Returns
array Array of glyph widths (integers).
Exceptions
Zend_Pdf_Exception

Member Data Documentation

$_ascent = 0
protected
$_descent = 0
protected
$_fontNames = array()
protected
$_fontType = Zend_Pdf_Font::TYPE_UNKNOWN
protected
$_isBold = false
protected
$_isItalic = false
protected
$_isMonospace = false
protected
$_lineGap = 0
protected
$_strikePosition = 0
protected
$_strikeThickness = 0
protected
$_underlinePosition = 0
protected
$_underlineThickness = 0
protected
$_unitsPerEm = 0
protected