Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
eZImageFont Class Reference
Image object and layer handling

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

## Public Member Functions
| __construct ( $family, $size, $path, $xAdjustment=0, $yAdjustment=0)
| family ()
| path ()
| file ()
| realFile ()
| pointSize ()
| xAdjustment ()
| yAdjustment ()
| setFamily ( $family)
| setPath ( $path)
| setPointSize ( $size)
| setXAdjustment ( $adjustment)
| setYAdjustment ( $adjustment)
| setAdjustment ( $xAdjustment, $yAdjustment)

## Static Public Member Functions
static | exists ( $fontFamily, $fontPath)
static | fontFile ( $fontFamily, $fontPath)

## Public Attributes
| $FontFamily
| $FontPath
| The path or path array to the fonts. More...
| $FontFile
| The path to the font file one was found. 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' );
eZImageFont
Specifies a font used for drawing text.
Definition: ezimagefont.php:30
eZImageFont\exists
static exists( $fontFamily, $fontPath)
Definition: ezimagefont.php:174

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

Definition at line 29 of file ezimagefont.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZImageFont::__construct | ( |  | $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.

Parameters

  string | $family |
  int | $size |
  string | $path |
  int | $xAdjustment |
  int | $yAdjustment |

Definition at line 40 of file ezimagefont.php.

References initialize().

## Member Function Documentation

## ◆ exists()

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 174 of file ezimagefont.php.

References fontFile().

Referenced by eZTemplateImageOperator\modify().

## ◆ family()

eZImageFont::family | ( |  | ) |

Returns
  the font family, eg. arial, times

Definition at line 55 of file ezimagefont.php.

References $FontFamily.

## ◆ file()

eZImageFont::file | ( |  | ) |

Returns
  the font file if it has been initialized.

See also
  realFile, fontFile, initialize.

Definition at line 72 of file ezimagefont.php.

References $FontFile.

## ◆ fontFile()

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

  fontPath | The path to the fonts or an array of paths.

Definition at line 195 of file ezimagefont.php.

Referenced by exists(), and initialize().

## ◆ initialize()

eZImageFont::initialize | ( |  | ) |
| private

Initializes the font file attribute by searching for the font.

Definition at line 183 of file ezimagefont.php.

References fontFile().

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

## ◆ path()

eZImageFont::path | ( |  | ) |

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

Definition at line 63 of file ezimagefont.php.

References $FontPath.

## ◆ pointSize()

eZImageFont::pointSize | ( |  | ) |

Returns
  the point size of the font.

Definition at line 89 of file ezimagefont.php.

References $PointSize.

## ◆ realFile()

eZImageFont::realFile | ( |  | ) |

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

Definition at line 81 of file ezimagefont.php.

References $FontFile.

## ◆ setAdjustment()

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 163 of file ezimagefont.php.

## ◆ setFamily()

eZImageFont::setFamily | ( |  | $family | ) |

Sets the font family to $family.

Note
  Changing the font family will reinitialize the font.

Definition at line 116 of file ezimagefont.php.

References initialize().

## ◆ setPath()

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 127 of file ezimagefont.php.

References initialize().

## ◆ setPointSize()

eZImageFont::setPointSize | ( |  | $size | ) |

Sets the point size of the font to $size.

Definition at line 136 of file ezimagefont.php.

## ◆ setXAdjustment()

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 145 of file ezimagefont.php.

## ◆ setYAdjustment()

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 154 of file ezimagefont.php.

## ◆ xAdjustment()

eZImageFont::xAdjustment | ( |  | ) |

Returns
  the number of pixels in the x direction to adjust the font output.

See also
  yAdjustment

Definition at line 98 of file ezimagefont.php.

References $XAdjustment.

## ◆ yAdjustment()

eZImageFont::yAdjustment | ( |  | ) |

Returns
  the number of pixels in the y direction to adjust the font output.

See also
  xAdjustment

Definition at line 107 of file ezimagefont.php.

References $YAdjustment.

## Member Data Documentation

## ◆ $FontFamily

eZImageFont::$FontFamily

The current font family

Definition at line 221 of file ezimagefont.php.

Referenced by family().

## ◆ $FontFile

eZImageFont::$FontFile

The path to the font file one was found.

Definition at line 225 of file ezimagefont.php.

Referenced by file(), and realFile().

## ◆ $FontPath

eZImageFont::$FontPath

The path or path array to the fonts.

Definition at line 223 of file ezimagefont.php.

Referenced by path().

## ◆ $PointSize

eZImageFont::$PointSize

The size of the font in points.

Definition at line 227 of file ezimagefont.php.

Referenced by pointSize().

## ◆ $XAdjustment

eZImageFont::$XAdjustment

Adjustment in the x direction.

Definition at line 229 of file ezimagefont.php.

Referenced by xAdjustment().

## ◆ $YAdjustment

eZImageFont::$YAdjustment

Adjustment in the y direction.

Definition at line 231 of file ezimagefont.php.

Referenced by yAdjustment().

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

- ezimagefont.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.