function getFlashDimensions($font, $title, $size) { $f = new SWFFont($font); $t = new SWFText(); $t->setFont($f); $t->setHeight($size); $dx = $t->getWidth($title) + 10; $dy = $size + 10; return array($dx, $dy); }
function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string) { global $f, $m; $t = new SWFText(); $t->setFont($f); $t->setColor($r, $g, $b, $a); $t->setHeight(96); $t->moveTo(-$t->getWidth($string) / 2, 32); $t->addString($string); $i = $m->add($t); $i->rotateTo($rot); $i->moveTo($x, $y); $i->scale($scale, $scale); return $i; }
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()); }
/** * Returns boundings of text depending on the available font extension * * @param float $size Textsize * @param ezcGraphFontOptions $font Font * @param string $text Text * @return ezcGraphBoundings Boundings of text */ protected function getTextBoundings($size, ezcGraphFontOptions $font, $text) { $t = new SWFText(); $t->setFont(new SWFFont($font->path)); $t->setHeight($size); $boundings = new ezcGraphBoundings(0, 0, $t->getWidth($text), $size); return $boundings; }
$g = 0x33; } if (!isset($context['flash_font_b']) || !($b = intval($context['flash_font_b']))) { $b = 0x33; } if (!isset($context['flash_font_height']) || !($height = intval($context['flash_font_height']))) { $height = 40; } for ($i = 0; $i < $count; ++$i) { $t = new SWFText(); $t->setFont($f); $t->setColor($r, $g, $b); $my_height = $height; while (true) { $t->setHeight($my_height); if ($t->getWidth($titles[$i]) < 0.9 * $width) { break; } $my_height = 0.9 * $my_height; } $x[$i] = 5; $y[$i] = ($height - $font_height) / 2; $t->moveTo($x[$i], $y[$i]); $t->addUTF8String($titles[$i]); $buttons[$i] = new SWFButton(); $buttons[$i]->addShape($hit, SWFBUTTON_HIT); $buttons[$i]->addShape($t, SWFBUTTON_OVER | SWFBUTTON_UP | SWFBUTTON_DOWN); $buttons[$i]->addAction(new SWFAction("getURL('" . $links[$i] . "', '');"), SWFBUTTON_MOUSEUP); } for ($n = 0; $n < 4; ++$n) { for ($i = 0; $i < $count; ++$i) {