eZ Publish  [trunk]
eZImageFont Class Reference

Specifies a font used for drawing text. More...

List of all members.

Public Member Functions

 eZImageFont ($family, $size, $path, $xAdjustment=0, $yAdjustment=0)
 family ()
 file ()
 path ()
 pointSize ()
 realFile ()
 setAdjustment ($xAdjustment, $yAdjustment)
 setFamily ($family)
 setPath ($path)
 setPointSize ($size)
 setXAdjustment ($adjustment)
 setYAdjustment ($adjustment)
 xAdjustment ()
 yAdjustment ()

Static Public Member Functions

static exists ($fontFamily, $fontPath)
static fontFile ($fontFamily, $fontPath)

Public Attributes

 $FontFamily
 The current font family.
 $FontFile
 The path to the font file one was found.
 $FontPath
 The path or path array to the fonts.
 $PointSize
 The size of the font in points.
 $XAdjustment
 Adjustment in the x direction.
 $YAdjustment
 Adjustment in the y direction.

Private Member Functions

 initialize ()

Detailed Description

Specifies a font used for drawing text.

Font attributes are encapsulated for use with the eZImageInterface::drawText function. The class stores the family, pointsize and path. Alternatively an x and y adjustment may be specified incase the font rendering is wrong.

Typical usage:

  if ( eZImageFont::exists( 'arial', 'design/standard/fonts' ) )
    $font = new eZImageFont( 'arial', 30, 'design/standard/fonts' );

All attributes can be modified later on with setFamily, setPath, setPointSize, setXAdjustment and setYAdjustment.

Definition at line 29 of file ezimagefont.php.


Member Function Documentation

static eZImageFont::exists ( fontFamily,
fontPath 
) [static]
Returns:
true if the font family $fontFamily exists in the path $fontPath. The path can be specified as a string or an array of strings.

Definition at line 170 of file ezimagefont.php.

Referenced by eZTemplateImageOperator\modify().

eZImageFont::eZImageFont ( family,
size,
path,
xAdjustment = 0,
yAdjustment = 0 
)

Initializes the object with a family, point size and path. X and y adjustment may also be specified.

Definition at line 35 of file ezimagefont.php.

Returns:
the font family, eg. arial, times

Definition at line 51 of file ezimagefont.php.

Returns:
the font file if it has been initialized.
See also:
realFile, fontFile, initialize.

Definition at line 68 of file ezimagefont.php.

static eZImageFont::fontFile ( fontFamily,
fontPath 
) [static]
Returns:
the file path for the font if it is found or false if no font could be used. The font must be named equal to the $fontFamily parameter with the .ttf suffix, eg. arial.ttf.
Parameters:
fontPathThe path to the fonts or an array of paths.

Definition at line 191 of file ezimagefont.php.

Referenced by exists(), and initialize().

eZImageFont::initialize ( ) [private]

Initializes the font file attribute by searching for the font.

Definition at line 179 of file ezimagefont.php.

Referenced by eZImageFont(), setFamily(), and setPath().

Returns:
the path to font files, it may be a string or an array of strings.

Definition at line 59 of file ezimagefont.php.

Returns:
the point size of the font.

Definition at line 85 of file ezimagefont.php.

Similar to file but returns the absolute path to the font file. This is required for GD font handling.

Definition at line 77 of file ezimagefont.php.

eZImageFont::setAdjustment ( xAdjustment,
yAdjustment 
)

Sets the number of pixels to adjust the font output to $xAdjustment and $yAdjustment.

See also:
setXAdjustment, setYAdjustment

Definition at line 159 of file ezimagefont.php.

eZImageFont::setFamily ( family)

Sets the font family to $family.

Note:
Changing the font family will reinitialize the font.

Definition at line 112 of file ezimagefont.php.

eZImageFont::setPath ( path)

Sets the font path which is used when searching for fonts, the path can either be a string or an array of strings.

Note:
Changing the font path will reinitialize the font.

Definition at line 123 of file ezimagefont.php.

Sets the point size of the font to $size.

Definition at line 132 of file ezimagefont.php.

eZImageFont::setXAdjustment ( adjustment)

Sets the number of pixels in the x direction to adjust the font output to $adjustment.

See also:
setYAdjustment

Definition at line 141 of file ezimagefont.php.

eZImageFont::setYAdjustment ( adjustment)

Sets the number of pixels in the y direction to adjust the font output to $adjustment.

See also:
setXAdjustment

Definition at line 150 of file ezimagefont.php.

Returns:
the number of pixels in the x direction to adjust the font output.
See also:
yAdjustment

Definition at line 94 of file ezimagefont.php.

Returns:
the number of pixels in the y direction to adjust the font output.
See also:
xAdjustment

Definition at line 103 of file ezimagefont.php.


Member Data Documentation

eZImageFont::$FontFamily

The current font family.

Definition at line 217 of file ezimagefont.php.

eZImageFont::$FontFile

The path to the font file one was found.

Definition at line 221 of file ezimagefont.php.

eZImageFont::$FontPath

The path or path array to the fonts.

Definition at line 219 of file ezimagefont.php.

eZImageFont::$PointSize

The size of the font in points.

Definition at line 223 of file ezimagefont.php.

eZImageFont::$XAdjustment

Adjustment in the x direction.

Definition at line 225 of file ezimagefont.php.

eZImageFont::$YAdjustment

Adjustment in the y direction.

Definition at line 227 of file ezimagefont.php.


The documentation for this class was generated from the following file: