Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezimagefont.php
Go to the documentation of this file.
1 <?php
29 class eZImageFont
30 {
40 public function __construct( $family, $size, $path, $xAdjustment = 0, $yAdjustment = 0 )
41 {
42 $this->FontFamily = $family;
43 $this->FontPath = $path;
44 $this->PointSize = $size;
45
46 $this->XAdjustment = $xAdjustment;
47 $this->YAdjustment = $yAdjustment;
48
49 $this->initialize();
50 }
51
55 function family()
56 {
57 return $this->FontFamily;
58 }
59
63 function path()
64 {
65 return $this->FontPath;
66 }
67
72 function file()
73 {
74 return $this->FontFile;
75 }
76
81 function realFile()
82 {
83 return realpath( "." ) . "/" . $this->FontFile;
84 }
85
89 function pointSize()
90 {
91 return $this->PointSize;
92 }
93
98 function xAdjustment()
99 {
100 return $this->XAdjustment;
101 }
102
107 function yAdjustment()
108 {
109 return $this->YAdjustment;
110 }
111
116 function setFamily( $family )
117 {
118 $this->FontFamily = $family;
119 $this->initialize();
120 }
121
127 function setPath( $path )
128 {
129 $this->FontPath = $path;
130 $this->initialize();
131 }
132
136 function setPointSize( $size )
137 {
138 $this->PointSize = $size;
139 }
140
145 function setXAdjustment( $adjustment )
146 {
147 $this->XAdjustment = $adjustment;
148 }
149
154 function setYAdjustment( $adjustment )
155 {
156 $this->YAdjustment = $adjustment;
157 }
158
163 function setAdjustment( $xAdjustment, $yAdjustment )
164 {
165 $this->XAdjustment = $xAdjustment;
166 $this->YAdjustment = $yAdjustment;
167 }
168
174 static function exists( $fontFamily, $fontPath )
175 {
176 return eZImageFont::fontFile( $fontFamily, $fontPath ) != false;
177 }
178
183 function initialize()
184 {
185 $this->FontFile = eZImageFont::fontFile( $this->FontFamily, $this->FontPath );
186 }
187
195 static function fontFile( $fontFamily, $fontPath )
196 {
197 if ( preg_match( '/\.ttf$/i', $fontFamily ) )
198 $family_file = $fontFamily;
199 else
200 $family_file = $fontFamily . '.ttf';
201 if ( $fontPath != null )
202 {
203 if ( !is_array( $fontPath ) )
204 $fontPath = array( $fontPath );
205 foreach ( $fontPath as $singleFontPath )
206 {
207 $font = $singleFontPath . "/$family_file";
208 if ( !file_exists( $font ) )
209 $font = false;
210 else
211 return $font;
212 }
213 }
214 else
215 $font = $fontFamily;
216 return $font;
217 }
218
221 public $FontFamily;
223 public $FontPath;
225 public $FontFile;
227 public $PointSize;
229 public $XAdjustment;
231 public $YAdjustment;
232 }
233
234 ?>
eZImageFont
Specifies a font used for drawing text.
Definition: ezimagefont.php:30
eZImageFont\__construct
__construct( $family, $size, $path, $xAdjustment=0, $yAdjustment=0)
Definition: ezimagefont.php:40
eZImageFont\setYAdjustment
setYAdjustment( $adjustment)
Definition: ezimagefont.php:154
eZImageFont\setAdjustment
setAdjustment( $xAdjustment, $yAdjustment)
Definition: ezimagefont.php:163
eZImageFont\fontFile
static fontFile( $fontFamily, $fontPath)
Definition: ezimagefont.php:195
eZImageFont\setFamily
setFamily( $family)
Definition: ezimagefont.php:116
eZImageFont\$YAdjustment
$YAdjustment
Adjustment in the y direction.
Definition: ezimagefont.php:231
eZImageFont\realFile
realFile()
Definition: ezimagefont.php:81
eZImageFont\setPointSize
setPointSize( $size)
Definition: ezimagefont.php:136
eZImageFont\initialize
initialize()
Definition: ezimagefont.php:183
eZImageFont\setPath
setPath( $path)
Definition: ezimagefont.php:127
eZImageFont\file
file()
Definition: ezimagefont.php:72
eZImageFont\yAdjustment
yAdjustment()
Definition: ezimagefont.php:107
eZImageFont\family
family()
Definition: ezimagefont.php:55
eZImageFont\xAdjustment
xAdjustment()
Definition: ezimagefont.php:98
eZImageFont\$PointSize
$PointSize
The size of the font in points.
Definition: ezimagefont.php:227
eZImageFont\pointSize
pointSize()
Definition: ezimagefont.php:89
eZImageFont\path
path()
Definition: ezimagefont.php:63
eZImageFont\exists
static exists( $fontFamily, $fontPath)
Definition: ezimagefont.php:174
eZImageFont\$XAdjustment
$XAdjustment
Adjustment in the x direction.
Definition: ezimagefont.php:229
eZImageFont\$FontFile
$FontFile
The path to the font file one was found.
Definition: ezimagefont.php:225
eZImageFont\$FontPath
$FontPath
The path or path array to the fonts.
Definition: ezimagefont.php:223
eZImageFont\setXAdjustment
setXAdjustment( $adjustment)
Definition: ezimagefont.php:145
eZImageFont\$FontFamily
$FontFamily
Definition: ezimagefont.php:221
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.