Exemplo n.º 1
0
 private function getGDTextHeight(awText $text)
 {
     $font = $text->getFont();
     if ($font->getExtension() === NULL) {
         $font->setExtension('ttf');
     }
     $filePath = $font->getName() . '.' . $font->getExtension();
     $box = imagettfbbox($font->getSize(), $text->getAngle(), $filePath, $text->getText());
     if ($box === FALSE) {
         awImage::drawError("Class FileFontDriver: Unable to get font height (GD).");
     }
     list(, , , $y2, , , , $y1) = $box;
     return abs($y2 - $y1);
 }
Exemplo n.º 2
0
 private function getMingTextWidth(awText $text)
 {
     $font = $text->getFont();
     if ($font->getExtension() === NULL) {
         $font->setExtension('fdb');
     }
     $flashFont = new SWFFont(ARTICHOW_FONT . '/' . $font->name . '.' . $font->getExtension());
     $flashText = new SWFText();
     $flashText->setFont($flashFont);
     return $flashText->getWidth($text->getText());
 }
Exemplo n.º 3
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);
 }