function text($string) { global $font; $t = new SWFText(); $t->setFont($font); $t->setColor(255, 255, 255); $t->setHeight(20); $t->addString($string); return $t; }
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; }
$im->movePenTo($dx, $gyb + $dy); $im->drawLineTo($dx, $gyb + $dy); $im->drawLineTo($dx, $dy); /* generate the graph's title */ /* first get the font */ $fontsize = 18; /* set the distance, from the left, where the title will begin */ $dist_x = $dx + 30; /* set the distance, from the top, where the title will begin */ $dist_y = 15; /* create the font object and text object */ //$fnt=new SWFFont("Courier_New.fdb"); $fnt = new SWFFont("Arial.fdb"); $txt = new SWFText(); /* build the title */ $txt->setFont($fnt); $txt->setHeight($fontsize); $txt->setColor(0, 0, 0); $txt->moveTo($dist_x, $dist_y); $txt->addString("Wind"); $txt->setColor(255, 0, 0); $txt->moveTo($dist_x + 50, $dist_y); $txt->addString("Direction"); $txt->setColor(0, 0, 0); $txt->moveTo($dist_x + 130, $dist_y); $txt->addString("and"); $txt->setColor(0, 0, 255); $txt->moveTo($dist_x + 170, $dist_y); $txt->addString("Speed (mph)"); $txt->setColor(0, 0, 0); $txt->moveTo($dist_x + 285, $dist_y);
/** * Writes text * * Parameter array: * 'x' : int X-point of text * 'y' : int Y-point of text * 'text' : string The text to add * 'color' : mixed [optional] The color of the text * * @param array $params Parameter array * * @todo Vertical alignment * @return void */ function addText($params) { $x0 = $this->_getX($params['x']); $y0 = $this->_getY($params['y']); $text = str_replace("\r", '', $params['text']); $color = isset($params['color']) ? $params['color'] : false; $textHeight = $this->textHeight($text); $alignment = isset($params['alignment']) ? $params['alignment'] : false; if (!is_array($alignment)) { $alignment = array('vertical' => 'top', 'horizontal' => 'left'); } if (!isset($alignment['vertical'])) { $alignment['vertical'] = 'top'; } if (!isset($alignment['horizontal'])) { $alignment['horizontal'] = 'left'; } if ($color === false && isset($this->_font['color'])) { $color = $this->_font['color']; } if ($color == 'transparent') { return; } if (strpos($this->_font['file'], '.') === false) { $this->_font['file'] = IMAGE_CANVAS_SYSTEM_FONT_PATH . $this->_font['file'] . '.fdb'; } $textColor = $this->_color($color); $textOpacity = $this->_opacity($color); $lines = explode("\n", $text); foreach ($lines as $line) { $x = $x0; $y = $y0; $y0 += $textHeight + 2; $width = $this->textWidth($line); $height = $this->textHeight($line); if ($alignment['horizontal'] == 'right') { $x -= $width; } else { if ($alignment['horizontal'] == 'center') { $x -= $width / 2; } } $font = new SWFFont($this->_font['file']); $text = new SWFText(); $text->setFont($font); $text->moveTo($x, $y + $this->_font['size']); $text->setColor($textColor[0], $textColor[1], $textColor[2], $textOpacity); $text->setHeight($this->_font['size']); $text->addString($line); $this->_canvas->add($text); } parent::addText($params); }
$f = new SWFFont("../../../fonts/Techno.fdb"); $hit = new SWFShape(); $hit->setRightFill($hit->addFill(0, 0, 0)); $hit->movePenTo(-($width / 2), -30); $hit->drawLine($width, 0); $hit->drawLine(0, 60); $hit->drawLine(-$width, 0); $hit->drawLine(0, -60); $x = 0; // build the buttons foreach ($allItems as $Item) { $title = $Item['title']; $link = $Item['link']; // get the text $t = new SWFText(); $t->setFont($f); $t->setHeight(50); $t->setColor(0, 0, 0); $t->moveTo(-$f->getWidth($title) / 2, 25); $t->addString($title); // make a button $b[$x] = new SWFButton(); $b[$x]->addShape($hit, SWFBUTTON_HIT); $b[$x]->addShape($t, SWFBUTTON_OVER | SWFBUTTON_UP | SWFBUTTON_DOWN); $b[$x++]->addAction(new SWFAction("getURL('{$link}','_new');"), SWFBUTTON_MOUSEUP); } // display them for ($x = 0; $x < $itemCount; $x++) { $i = $m->add($b[$x]); $i->moveTo($width / 2, 30); for ($j = 0; $j <= 30; ++$j) {
#!/usr/bin/php -c. <?php $srcdir = $argv[1]; $mediadir = $srcdir . "/../Media"; $m = new SWFMovie(); ming_setscale(1.0); /* SWF_DEFINEFONT2 */ $f2 = new SWFFont($mediadir . "/test.ttf"); /* init font 2 code table*/ /* SWF_DEFINETEXT */ $character1 = new SWFText(1); $character1->setFont($f2); $character1->setHeight(400); $character1->setColor(0x0, 0x0, 0x0); $character1->moveTo(30234, 0); $character1->addString("|"); /* SWF_PLACEOBJECT2 */ $i1 = $m->add($character1); $i1->setDepth(1); /* PlaceFlagHasMatrix */ /* SWF_SHOWFRAME */ $m->nextFrame(); /* end of frame 1 */ /* SWF_END */ $m->save("test03.swf");
$sp = new SWFTextField(); $sp->setBounds(100, 30); $sp->setName("pScore"); $sp->setFont($f); $sp->setColor(255, 255, 255); $sp->addString("Player : 0"); // Writes the score for computer $sc = new SWFTextField(); $sc->setBounds(100, 30); $sc->setName("cScore"); $sc->setFont($f); $sc->setColor(255, 255, 255); $sc->addString("Computer : 0"); // Write the "signature" $signature = new SWFText(); $signature->setFont($f); $signature->setColor(150, 150, 255); $signature->setHeight(9); $signature->addString("(c) Armel GRIGNON, october 2001 - See this script at mingshop.arpane.net"); // Now adds the objects to the movie // Creates the movie and the main sprite $m = new SWFMovie(); $m->setRate(96); $m->setBackground(207, 96, 0); $m->setDimension(640, 480); // Adds the two rackets (within sprites) $srp = new SWFSprite(); $srp_shape = $srp->add($rm); $srp->nextFrame(); $racket_player = $m->add($srp); $racket_player->moveTo(10, 215);
#!/usr/bin/php -c. <?php $srcdir = $argv[1]; $mediadir = $srcdir . "/../Media"; $m = new SWFMovie(); $f2 = new SWFFont($mediadir . "/font01.fdb"); $f3 = new SWFFont($mediadir . "/test.ttf"); $t = new SWFText(2); $t->setFont($f2); $t->setHeight(20); $t->setColor(0x0, 0x0, 0x0, 0xff); $t->moveTo(10, 20); $t->addString("abc"); $t->moveTo(0, 40); $t->addString("bca"); $t->moveTo(60, 0); $t->addString("cab"); $m->add($t); $m->nextFrame(); $m->save("test03.swf");
/** * Draws a text string on the image in a specified location, with * the specified style information. * * @param string $text The text to draw. * @param integer $x The left x coordinate of the start of the text string. * @param integer $y The top y coordinate of the start of the text string. * @param string $font The font identifier you want to use for the text. * @param string $color The color that you want the text displayed in. * @param integer $direction An integer that specifies the orientation of the text. */ function text($string, $x, $y, $font = 'monospace', $color = 'black', $direction = 0) { $color = $this->allocateColor($color); if (!strncasecmp(PHP_OS, 'WIN', 3)) { $text = new SWFTextField(SWFTEXTFIELD_NOEDIT); } else { $text = new SWFText(); } $text->setColor($color['red'], $color['green'], $color['blue'], $color['alpha']); $text->addString($string); $text->setFont(new SWFFont($this->getFont($font))); $t = $this->_movie->add($text); $t->moveTo($x, $y); $t->rotate($direction); return $t; }