Gnash  0.8.10
Public Member Functions | Static Public Member Functions
gnash::FreetypeGlyphsProvider Class Reference

Truetype font rasterizer/converter based on freetype library. More...

#include <FreetypeGlyphsProvider.h>

List of all members.

Public Member Functions

 ~FreetypeGlyphsProvider ()
 Destructor.
std::auto_ptr< SWF::ShapeRecordgetGlyph (boost::uint16_t code, float &advance)
 Return the given DisplayObject glyph as a shape DisplayObject definition in unitsPerEM() coordinates.
float ascent () const
 Return the font's ascender in terms of its EM own square.
float descent () const
 Return the font's descender in terms of its own EM square.
unsigned short unitsPerEM () const
 Return the number of units of glyphs EM.

Static Public Member Functions

static std::auto_ptr
< FreetypeGlyphsProvider
createFace (const std::string &name, bool bold, bool italic)
 Named constructor for a face-bound rasterizer.

Detailed Description

Truetype font rasterizer/converter based on freetype library.

Instances of this class provide rasterized or vectorial glyphs for a given truetype font face.

The rasterized glyphs have a max size of 96 (TODO: make parametrizable) but I think the actual size could change between glyphs (see the 'box' parameter of getRenderedGlyph() method).

Vectorial glyphs are instances of a SWF::ShapeRecord, same class resulting from parsing of embedded fonts.


Constructor & Destructor Documentation

gnash::FreetypeGlyphsProvider::~FreetypeGlyphsProvider ( )

Destructor.

Release face resources

References _.


Member Function Documentation

float gnash::FreetypeGlyphsProvider::ascent ( ) const

Return the font's ascender in terms of its EM own square.

References assert.

Referenced by gnash::Font::ascent().

std::auto_ptr< FreetypeGlyphsProvider > gnash::FreetypeGlyphsProvider::createFace ( const std::string &  name,
bool  bold,
bool  italic 
) [static]

Named constructor for a face-bound rasterizer.

Parameters:
nameName of the font to get glyphs info from
boldWhether to use a bold version of the font
italicWhether to use an italic version of the font
Returns:
a rasterizer bound to the given font name, or a NULL auto_ptr if the given truetype font could not be found.

References _.

Referenced by gnash::Font::ftProvider().

float gnash::FreetypeGlyphsProvider::descent ( ) const

Return the font's descender in terms of its own EM square.

References assert.

Referenced by gnash::Font::descent().

std::auto_ptr< SWF::ShapeRecord > gnash::FreetypeGlyphsProvider::getGlyph ( boost::uint16_t  code,
float &  advance 
)

Return the given DisplayObject glyph as a shape DisplayObject definition in unitsPerEM() coordinates.

TODO: allow using a custom EM square ?

Parameters:
codeCharacter code.
advanceOutput parameter... units to advance horizontally from this glyph to the next, in unitsPerEM() units.
Returns:
A DefineShapeTag in unitsPerEM() coordinates, or a NULL pointer if the given DisplayObject code doesn't exist in this font.
unsigned short gnash::FreetypeGlyphsProvider::unitsPerEM ( ) const

Return the number of units of glyphs EM.

This is currently hard-coded to 1024, but could in future depend on actual font file being used.

References assert.

Referenced by gnash::Font::unitsPerEM().


The documentation for this class was generated from the following files: