| 1: | <?php | 
| 2: |  | 
| 3: |  | 
| 4: |  | 
| 5: |  | 
| 6: |  | 
| 7: |  | 
| 8: |  | 
| 9: |  | 
| 10: |  | 
| 11: |  | 
| 12: |  | 
| 13: |  | 
| 14: |  | 
| 15: |  | 
| 16: |  | 
| 17: |  | 
| 18: |  | 
| 19: |  | 
| 20: |  | 
| 21: |  | 
| 22: |  | 
| 23: |  | 
| 24: | namespace WideImage\Font; | 
| 25: |  | 
| 26: |  | 
| 27: |  | 
| 28: |  | 
| 29: |  | 
| 30: |  | 
| 31: | class PS | 
| 32: | { | 
| 33: | public $size; | 
| 34: | public $color; | 
| 35: | public $handle; | 
| 36: |  | 
| 37: | public function __construct($file, $size, $color, $bgcolor = null) | 
| 38: | { | 
| 39: | $this->handle = imagepsloadfont($file); | 
| 40: | $this->size   = $size; | 
| 41: | $this->color  = $color; | 
| 42: |  | 
| 43: | if ($bgcolor === null) { | 
| 44: | $this->bgcolor = $color; | 
| 45: | } else { | 
| 46: | $this->color = $color; | 
| 47: | } | 
| 48: | } | 
| 49: |  | 
| 50: | public function writeText($image, $x, $y, $text, $angle = 0) | 
| 51: | { | 
| 52: | if ($image->isTrueColor()) { | 
| 53: | $image->alphaBlending(true); | 
| 54: | } | 
| 55: |  | 
| 56: | imagepstext($image->getHandle(), $text, $this->handle, $this->size, $this->color, $this->bgcolor, $x, $y, 0, 0, $angle, 4); | 
| 57: | } | 
| 58: |  | 
| 59: | public function __destruct() | 
| 60: | { | 
| 61: | imagepsfreefont($this->handle); | 
| 62: | $this->handle = null; | 
| 63: | } | 
| 64: | } | 
| 65: |  |