Exemple #1
0
 private function getGDTextHeight(awText $text)
 {
     $font = $text->getFont();
     if ($font->getExtension() === NULL) {
         $font->setExtension('ttf');
     }
     $box = imagettfbbox($font->size, $text->getAngle(), $font->name . '.' . $font->getExtension(), $text->getText());
     if ($box === FALSE) {
         awImage::drawError("Class FileFontDriver: Unable to get font height (GD).");
     }
     list(, , , $y2, , , , $y1) = $box;
     return abs($y2 - $y1);
 }
Exemple #2
0
 /**
  * Get the height of a string
  *
  * @param awText $text A string
  */
 public function getTextHeight(awText $text)
 {
     $box = imagettfbbox($this->size, $text->getAngle(), $this->font, $text->getText());
     if ($box === FALSE) {
         trigger_error("Unable to get font size", E_USER_ERROR);
         return;
     }
     list(, , $x2, $y2, , , $x1, $y1) = $box;
     return abs($y2 - $y1);
 }