DeviceFonts

From Gnash Project Wiki

Jump to: navigation, search

Device fonts are fonts to be found in the target host playing a movie. They can be references by static tags (DefineFont*) and script (TextFormat.text).

Contents

Gnash

Gnash currently uses fontconfig to find fonts by name and freetype2 to convert glyphs outline of truetype fonts into shape definitions (and bitmaps, but to be deprecated) used by the renderers.

Differences with proprietary player implementation

From Colin Moock last book on ActionScript 3.0 we get that the proprietary player delegates device font rendering to the operating system, and this introduces a few limitations on what can be done with them.

In particular, the PP (proprietary player) will *NOT RENDER* rotated or skewed textfields with device fonts, and it will always display them as opaque (indipendently of the _alpha setting of it and any container). Also, it has been reported that the *linux* version of the PP behaves differently then the *windows* version when it comes to coloring textfields with device fonts. For Windows, it renders with user-specified colors, for Linux it always renders them in black over solid white (and eventually black border).

Tested versions:


Version Rotation/skew scale alpha tint
LNX 9.0.31.0  ?  ? ignored ignored
LNX 9,0,48,0  ?  ? ignored ignored
WIN 8,0,22,0 text field disappears NOTE1 ignored OK
WIN 9,0,28,0 text field disappears NOTE1 ignored OK

NOTE1: X scaling just scales the box and does not affect the glyphs inside (except word wrapping). Y scaling proportionally scales the glyphs, i.e. just changing _yscale equals changing the font size.

Gnash instead is able to respect scale/rotation and colors. This is possible because Gnash handles device fonts by converting them to the same format swf-defined fonts use. This is also helpful to reduce effort required to make them supported by any gui/renderer combination (except we have some problems with OpenGL not dealing with what seem to be topoligical errors in freetype vectors).

Known bugs in Gnash handling of device fonts

  • Freetype font filename finding doesn't work for win32 (code for this is in gameswf, if anyone wants to contribute a patch)

References