SWFFont->__construct()
(PHP 5)
SWFFont->__construct() — Loads a font definition
Описание
Эта функция является ЭКСПЕРИМЕНТАЛЬНОЙ. Поведение этой функции, ее имя и относящаяся к ней документация могут измениться в последующих версиях 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");
?>
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Генерация нетекстовых MIME форматов
- Ming (flash)
- Функция SWFFont::__construct() - Loads a font definition
- Функция SWFFont::getAscent() - Returns the ascent of the font, or 0 if not available
- Функция SWFFont::getDescent() - Returns the descent of the font, or 0 if not available
- Функция SWFFont::getLeading() - Returns the leading of the font, or 0 if not available
- Функция SWFFont::getShape() - Returns the glyph shape of a char as a text string
- Функция SWFFont::getUTF8Width() - Calculates the width of the given string in this font at full height
- Функция SWFFont::getWidth() - Returns the string's width
Коментарии
Correcttion to the given example: (add a space after new)
<?php
$f = new SWFFont("_sans");
?>
I've tested this example on PHP5.3.5 and it failed measurably. The library is great but it's not up-to-date.
It keeps sending a Fatal error: Loading font failed! Please use new SWFBrowserFont(string:fontname) for player/browser fonts
I've tried using SWFBrowserFont
$font = new SWFBrowserFont('_sans');
$text = new SWFText();
$text->setFont($font);
Again it failed to set the font (Fatal error: SWFText::setFont() [swftext.setfont]: Called object is not an SWFFont).
The only work around is to use a textfield instead as shown below
$font = new SWFBrowserFont('_sans');
$text = new SWFTextField();
$text->setFont($font);
or handle the text using Action Script.