Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 final class LinearStringDrawer extends TextDrawer
00016 {
00020 public function draw($string)
00021 {
00022 $maxHeight = $this->getMaxCharacterHeight();
00023 $y = round($this->getTuringImage()->getHeight() / 2 + $maxHeight / 2);
00024
00025 $textWidth = $this->getTextWidth($string);
00026
00027 if ($this->getTuringImage()->getWidth() <= $textWidth)
00028 return $this->showError();
00029
00030 $x = round(($this->getTuringImage()->getWidth() - $textWidth) / 2);
00031 $angle = 0;
00032
00033 for ($i = 0, $length = strlen($string); $i < $length; ++$i) {
00034 $character = $string[$i];
00035 $this->drawCraracter($angle, $x, $y, $character);
00036 $x += $this->getStringWidth($character) + $this->getSpace();
00037 }
00038
00039 return $this;
00040 }
00041 }
00042 ?>