SWFFont


$f = new SWFFont(name);
f = SWFFont(name)
SWFFont *f = new SWFFont(name);
SWFFont f = loadSWFFontFromFile(filename);
SWFFont f = newSWFBrowserFont(name);

If name 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:

$f = newSWFFont("_sans");
will give you the standard sans-serif font, probably the same as what you'd get with <font face="sans"> in html.

Returns a reference to the font definition, for use in the SWFText setFont method and the SWFTextField setFont method.



$width = $f->getWidth($string);
width = f.getWidth(string)
width = f->getWidth(string);
width = SWFFont_getStringWidth(f, string);
Returns the width of the given string at the font's default scaling. You'll probably want to use the SWFText version of this method which uses the text object's scale.


Text example

back to index


All content Copyright (C) 2000-2002 Opaque Industries except where noted otherwise.