eZPublishCommunityProject(LegacyStack)  2013.9
eZImageFont Class Reference

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

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. More...
 
 $FontFile
 The path to the font file one was found. More...
 
 $FontPath
 The path or path array to the fonts. More...
 
 $PointSize
 The size of the font in points. More...
 
 $XAdjustment
 Adjustment in the x direction. More...
 
 $YAdjustment
 Adjustment in the y direction. More...
 

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.

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.

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.

eZImageFont::family ( )
Returns
the font family, eg. arial, times
eZImageFont::file ( )
Returns
the font file if it has been initialized.
See Also
realFile, fontFile, initialize.
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.

Referenced by exists(), and initialize().

eZImageFont::initialize ( )
private

Initializes the font file attribute by searching for the font.

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

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

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

eZImageFont::setAdjustment (   $xAdjustment,
  $yAdjustment 
)

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

See Also
setXAdjustment, setYAdjustment
eZImageFont::setFamily (   $family)

Sets the font family to $family.

Note
Changing the font family will reinitialize the font.
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.
eZImageFont::setPointSize (   $size)

Sets the point size of the font to $size.

eZImageFont::setXAdjustment (   $adjustment)

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

See Also
setYAdjustment
eZImageFont::setYAdjustment (   $adjustment)

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

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

Member Data Documentation

eZImageFont::$FontFamily

The current font family.

Referenced by family().

eZImageFont::$FontFile

The path to the font file one was found.

Referenced by file(), and realFile().

eZImageFont::$FontPath

The path or path array to the fonts.

Referenced by path().

eZImageFont::$PointSize

The size of the font in points.

Referenced by pointSize().

eZImageFont::$XAdjustment

Adjustment in the x direction.

Referenced by xAdjustment().

eZImageFont::$YAdjustment

Adjustment in the y direction.

Referenced by yAdjustment().


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