SWFFont

(PHP 4 >= 4.0.5)

SWFFont -- Loads a font definition

Description

SWFFont swffont ( string filename )

Внимание

Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ. Поведение этой функции, ее имя и относящаяся к ней документация могут измениться в последующих версиях PHP без уведомления. Используйте эту функцию на свой страх и риск.

If filename is the name of an FDB file (i.e., it ends in ".fdb"), load the font definition found in said file. Otherwise, create a browser-defined font reference.

FDB ("font definition block") is a very simple wrapper for the SWF DefineFont2 block which contains a full description of a font. One may create FDB files from SWT Generator template files with the included makefdb utility- look in the util directory off the main ming distribution directory.

Browser-defined fonts don't contain any information about the font other than its name. It is assumed that the font definition will be provided by the movie player. The fonts _serif, _sans, and _typewriter should always be available. For example:
<?php
$f
= newSWFFont("_sans");
?>
will give you the standard sans-serif font, probably the same as what you'd get with <font name="sans-serif"> in HTML.

swffont() returns a reference to the font definition, for use in the swftext->setfont() and the swftextfield->setfont() methods.

SWFFont has the following methods : swffont->getwidth().



SWFFont
phee, via isthisthingon dot org
07-Sep-2003 03:26
You may want to take note that if you try to open a font file that isn't readable or doesn't exist, you will NOT get any kind of error back. You will in fact get an SWFFont object back that looks perfectly okay even though it isn't. Do something like this instead:

if (@is_readable($fontfile)) {
  $font=new SWFFont($fontfile);
} else {
  echo "ERROR: Font \"$fontfile\" couldn't be loaded!\n";
}

Hopefully this will get fixed eventually, but for now... that's all you can do.
savc at blastcenter dot com
12-Feb-2002 03:32
Here is a simple text example

<?
  Ming_setScale
(1.0);
 
$f = new SWFFont("font.fdb");
 
$t = new SWFText();
 
$t->setFont($f);
 
$t->moveTo(200, 240);
 
$t->setColor(0xff, 0xff, 0);
 
$t->setHeight(120);
 
$t->addString("TEXT");
 
$m = new SWFMovie();
 
$m->setDimension(540, 360);
 
$m->add($t);
 
header('Content-type: application/x-shockwave-flash');
 
$m->output();
?>

You can download some fonts from
http://www.blastcenter.com/clients/php/fonts/

<swffont->getwidthSWFGradient->addEntry>
 Last updated: Tue, 15 Nov 2005