Cheetah
AbstractFont.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Intervention\Image;
4 
5 abstract class AbstractFont
6 {
12  public $text;
13 
19  public $size = 12;
20 
26  public $color = '000000';
27 
33  public $angle = 0;
34 
40  public $align;
41 
47  public $valign;
48 
54  public $file;
55 
64  abstract public function applyToImage(Image $image, $posx = 0, $posy = 0);
65 
71  public function __construct($text = null)
72  {
73  $this->text = $text;
74  }
75 
82  public function text($text)
83  {
84  $this->text = $text;
85  }
86 
92  public function getText()
93  {
94  return $this->text;
95  }
96 
103  public function size($size)
104  {
105  $this->size = $size;
106  }
107 
113  public function getSize()
114  {
115  return $this->size;
116  }
117 
124  public function color($color)
125  {
126  $this->color = $color;
127  }
128 
134  public function getColor()
135  {
136  return $this->color;
137  }
138 
145  public function angle($angle)
146  {
147  $this->angle = $angle;
148  }
149 
155  public function getAngle()
156  {
157  return $this->angle;
158  }
159 
166  public function align($align)
167  {
168  $this->align = $align;
169  }
170 
176  public function getAlign()
177  {
178  return $this->align;
179  }
180 
187  public function valign($valign)
188  {
189  $this->valign = $valign;
190  }
191 
197  public function getValign()
198  {
199  return $this->valign;
200  }
201 
208  public function file($file)
209  {
210  $this->file = $file;
211  }
212 
218  public function getFile()
219  {
220  return $this->file;
221  }
222 
228  protected function hasApplicableFontFile()
229  {
230  if (is_string($this->file)) {
231  return file_exists($this->file);
232  }
233 
234  return false;
235  }
236 
242  public function countLines()
243  {
244  return count(explode(PHP_EOL, $this->text));
245  }
246 }
Intervention\Image\AbstractFont\$size
$size
Definition: AbstractFont.php:19
Intervention\Image\AbstractFont\countLines
countLines()
Definition: AbstractFont.php:242
Intervention\Image\AbstractFont\$file
$file
Definition: AbstractFont.php:54
Intervention\Image\AbstractFont\$angle
$angle
Definition: AbstractFont.php:33
php
Intervention\Image\AbstractFont\align
align($align)
Definition: AbstractFont.php:166
Intervention\Image\AbstractFont\color
color($color)
Definition: AbstractFont.php:124
Intervention\Image\AbstractFont\getSize
getSize()
Definition: AbstractFont.php:113
Intervention\Image\AbstractFont\file
file($file)
Definition: AbstractFont.php:208
Intervention\Image\AbstractFont\getAngle
getAngle()
Definition: AbstractFont.php:155
Intervention\Image\AbstractFont\getColor
getColor()
Definition: AbstractFont.php:134
Intervention\Image\Image
Definition: Image.php:50
Intervention\Image\AbstractFont\$valign
$valign
Definition: AbstractFont.php:47
Intervention\Image\AbstractFont\text
text($text)
Definition: AbstractFont.php:82
Intervention\Image\AbstractFont\$text
$text
Definition: AbstractFont.php:12
Intervention\Image\AbstractFont\getText
getText()
Definition: AbstractFont.php:92
Intervention\Image\AbstractFont\$align
$align
Definition: AbstractFont.php:40
Intervention\Image\AbstractFont\valign
valign($valign)
Definition: AbstractFont.php:187
Intervention\Image\AbstractFont\applyToImage
applyToImage(Image $image, $posx=0, $posy=0)
Intervention\Image\AbstractFont
Definition: AbstractFont.php:6
Intervention\Image\AbstractFont\__construct
__construct($text=null)
Definition: AbstractFont.php:71
Intervention\Image\AbstractFont\getValign
getValign()
Definition: AbstractFont.php:197
Intervention\Image\AbstractFont\$color
$color
Definition: AbstractFont.php:26
Intervention\Image\AbstractFont\size
size($size)
Definition: AbstractFont.php:103
Intervention\Image\AbstractFont\getAlign
getAlign()
Definition: AbstractFont.php:176
Intervention\Image\AbstractFont\hasApplicableFontFile
hasApplicableFontFile()
Definition: AbstractFont.php:228
Intervention\Image\AbstractFont\getFile
getFile()
Definition: AbstractFont.php:218
Intervention\Image\AbstractFont\angle
angle($angle)
Definition: AbstractFont.php:145
Intervention\Image
Definition: AbstractColor.php:3