Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/general/libchart/classes/view/text/Text.php
Show All 29 Lines | |||||
public $HORIZONTAL_RIGHT_ALIGN = 4; | public $HORIZONTAL_RIGHT_ALIGN = 4; | ||||
public $VERTICAL_TOP_ALIGN = 8; | public $VERTICAL_TOP_ALIGN = 8; | ||||
public $VERTICAL_CENTER_ALIGN = 16; | public $VERTICAL_CENTER_ALIGN = 16; | ||||
public $VERTICAL_BOTTOM_ALIGN = 32; | public $VERTICAL_BOTTOM_ALIGN = 32; | ||||
/** | /** | ||||
* Creates a new text drawing helper. | * Creates a new text drawing helper. | ||||
*/ | */ | ||||
public function LibchartText() { | public function __construct() { | ||||
$baseDir = dirname(__FILE__) . "/../../../"; | $baseDir = dirname(__FILE__) . "/../../../"; | ||||
// Free low-res fonts based on Bitstream Vera <http://dejavu.sourceforge.net/wiki/> | // Free low-res fonts based on Bitstream Vera <http://dejavu.sourceforge.net/wiki/> | ||||
$this->fontCondensed = $baseDir . "fonts/DejaVuSansCondensed.ttf"; | $this->fontCondensed = $baseDir . "fonts/DejaVuSansCondensed.ttf"; | ||||
$this->fontCondensedBold = $baseDir . "fonts/DejaVuSansCondensed-Bold.ttf"; | $this->fontCondensedBold = $baseDir . "fonts/DejaVuSansCondensed-Bold.ttf"; | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | |||||
list ($lx, $ly, $rx, $ry) = imageftbbox($fontSize, 0, $fontFileName, $text, array("linespacing" => $lineSpacing)); | list ($lx, $ly, $rx, $ry) = imageftbbox($fontSize, 0, $fontFileName, $text, array("linespacing" => $lineSpacing)); | ||||
$textWidth = $rx - $lx; | $textWidth = $rx - $lx; | ||||
$angle = -45; | $angle = -45; | ||||
imagettftext($img, $fontSize, $angle, $px, $py, $color->getColor($img), $fontFileName, $text); | imagettftext($img, $fontSize, $angle, $px, $py, $color->getColor($img), $fontFileName, $text); | ||||
} | } | ||||
} | } | ||||
No newline at end of file |