eZ Publish  [4.2]
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 52 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 193 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 58 of file ezimagefont.php.

eZImageFont::family ( )
Returns:
the font family, eg. arial, times

Definition at line 74 of file ezimagefont.php.

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

Definition at line 91 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 214 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 202 of file ezimagefont.php.

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

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

Definition at line 82 of file ezimagefont.php.

eZImageFont::pointSize ( )
Returns:
the point size of the font.

Definition at line 108 of file ezimagefont.php.

eZImageFont::realFile ( )

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

Definition at line 100 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 182 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 135 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 146 of file ezimagefont.php.

eZImageFont::setPointSize ( size)

Sets the point size of the font to $size.

Definition at line 155 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 164 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 173 of file ezimagefont.php.

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

Definition at line 117 of file ezimagefont.php.

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

Definition at line 126 of file ezimagefont.php.


Member Data Documentation

eZImageFont::$FontFamily

The current font family.

Definition at line 240 of file ezimagefont.php.

eZImageFont::$FontFile

The path to the font file one was found.

Definition at line 244 of file ezimagefont.php.

eZImageFont::$FontPath

The path or path array to the fonts.

Definition at line 242 of file ezimagefont.php.

eZImageFont::$PointSize

The size of the font in points.

Definition at line 246 of file ezimagefont.php.

eZImageFont::$XAdjustment

Adjustment in the x direction.

Definition at line 248 of file ezimagefont.php.

eZImageFont::$YAdjustment

Adjustment in the y direction.

Definition at line 250 of file ezimagefont.php.


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