Gnash
0.8.10
|
Store a TextRecord. More...
#include <TextRecord.h>
Classes | |
struct | GlyphEntry |
struct | RecordCounter |
Accumulate the number of glyphs in a TextRecord. More... | |
Public Types | |
typedef std::vector< TextRecord > | TextRecords |
typedef std::vector< GlyphEntry > | Glyphs |
Public Member Functions | |
TextRecord () | |
bool | read (SWFStream &in, movie_definition &m, int glyphBits, int advanceBits, TagType tag) |
Read a TextRecord from the stream. | |
const Glyphs & | glyphs () const |
void | addGlyph (const GlyphEntry &ge, Glyphs::size_type num=1) |
void | clearGlyphs (Glyphs::size_type num=0) |
void | setFont (boost::intrusive_ptr< const Font > f) |
void | setURL (std::string url) |
const std::string & | getURL () const |
void | setTarget (std::string target) |
const std::string & | getTarget () const |
const Font * | getFont () const |
void | setTextHeight (boost::uint16_t height) |
float | recordWidth () const |
boost::uint16_t | textHeight () const |
bool | hasXOffset () const |
void | setXOffset (float x) |
float | xOffset () const |
bool | hasYOffset () const |
void | setYOffset (float y) |
float | yOffset () const |
void | setColor (const rgba &color) |
const rgba & | color () const |
bool | underline () const |
void | setUnderline (bool b) |
Static Public Member Functions | |
static void | displayRecords (Renderer &renderer, const Transform &xform, const TextRecords &records, bool embedded=true) |
Render the given glyph records. |
Store a TextRecord.
This consists of style information and a number of glyphs. This may be parsed from a SWFStream, or it can be constructed dynamically by TextField. A static TextField has fewer possible properties than a dynamic one.
typedef std::vector<GlyphEntry> gnash::SWF::TextRecord::Glyphs |
typedef std::vector<TextRecord> gnash::SWF::TextRecord::TextRecords |
gnash::SWF::TextRecord::TextRecord | ( | ) | [inline] |
void gnash::SWF::TextRecord::addGlyph | ( | const GlyphEntry & | ge, |
Glyphs::size_type | num = 1 |
||
) | [inline] |
void gnash::SWF::TextRecord::clearGlyphs | ( | Glyphs::size_type | num = 0 | ) | [inline] |
const rgba& gnash::SWF::TextRecord::color | ( | ) | const [inline] |
Referenced by displayRecords(), and setColor().
void gnash::SWF::TextRecord::displayRecords | ( | Renderer & | renderer, |
const Transform & | xform, | ||
const TextRecords & | records, | ||
bool | embedded = true |
||
) | [static] |
Render the given glyph records.
Display of device fonts is complicated in Gnash as we use the same rendering process as for embedded fonts. The shape and position of a font relies on the concatenated transformation of its containing DisplayObject and all parent DisplayObjects. Device fonts have the peculiarity that the glyphs are always scaled equally in both dimensions, using the y scale only. However, indentation and left margin (the starting x position) *are* scaled using the given x scale. The translation is applied as normal. The proprietary player does not display rotated or skewed device fonts. Gnash does.
References gnash::Transform::colorTransform, gnash::Transform::matrix, x, y, gnash::key::i, gnash::key::e, getFont(), IF_VERBOSE_MALFORMED_SWF, gnash::Font::unitsPerEM(), textHeight(), hasXOffset(), xOffset(), gnash::SWFMatrix::get_x_scale(), gnash::SWFMatrix::get_y_scale(), hasYOffset(), yOffset(), gnash::SWFCxForm::transform(), color(), gnash::rgba::m_a, gnash::key::j, glyphs(), gnash::SWF::TextRecord::GlyphEntry::index, gnash::key::m, gnash::SWFMatrix::concatenate_translation(), gnash::SWFMatrix::tx(), gnash::SWFMatrix::ty(), gnash::SWFMatrix::concatenate_scale(), gnash::Renderer::drawLine(), gnash::Font::get_glyph(), gnash::Renderer::drawGlyph(), gnash::SWF::TextRecord::GlyphEntry::advance, and underline().
Referenced by gnash::SWF::DefineTextTag::display(), and gnash::TextField::display().
const Font* gnash::SWF::TextRecord::getFont | ( | ) | const [inline] |
Referenced by displayRecords().
const std::string& gnash::SWF::TextRecord::getTarget | ( | ) | const [inline] |
Referenced by gnash::TextField::mouseEvent().
const std::string& gnash::SWF::TextRecord::getURL | ( | ) | const [inline] |
Referenced by gnash::TextField::mouseEvent().
const Glyphs& gnash::SWF::TextRecord::glyphs | ( | ) | const [inline] |
Referenced by displayRecords(), gnash::SWF::TextRecord::RecordCounter::operator()(), and recordWidth().
bool gnash::SWF::TextRecord::hasXOffset | ( | ) | const [inline] |
Referenced by displayRecords().
bool gnash::SWF::TextRecord::hasYOffset | ( | ) | const [inline] |
Referenced by displayRecords().
bool gnash::SWF::TextRecord::read | ( | SWFStream & | in, |
movie_definition & | m, | ||
int | glyphBits, | ||
int | advanceBits, | ||
TagType | tag | ||
) |
Read a TextRecord from the stream.
in | The SWFStream to read from. |
m | The movie_definition containing this TextRecord. |
glyphBits | The number of bits per glyph |
advanceBits | The number of bits per advance |
tag | The tag type of this TextRecord. This must be DefineText or DefineText2 |
References gnash::SWFStream::ensureBytes(), gnash::SWFStream::read_u8(), IF_VERBOSE_PARSE, _, gnash::SWFStream::read_u16(), gnash::movie_definition::get_font(), gnash::SWF::DEFINETEXT, gnash::readRGB(), gnash::readRGBA(), gnash::SWFStream::read_s16(), gnash::SWFStream::ensureBits(), gnash::key::i, gnash::SWF::TextRecord::GlyphEntry::index, gnash::SWFStream::read_uint(), gnash::SWF::TextRecord::GlyphEntry::advance, and gnash::SWFStream::read_sint().
float gnash::SWF::TextRecord::recordWidth | ( | ) | const [inline] |
References width, gnash::key::i, and glyphs().
void gnash::SWF::TextRecord::setColor | ( | const rgba & | color | ) | [inline] |
References color().
Referenced by gnash::TextField::setTextColor().
void gnash::SWF::TextRecord::setFont | ( | boost::intrusive_ptr< const Font > | f | ) | [inline] |
References gnash::key::f.
void gnash::SWF::TextRecord::setTarget | ( | std::string | target | ) | [inline] |
void gnash::SWF::TextRecord::setTextHeight | ( | boost::uint16_t | height | ) | [inline] |
References height.
void gnash::SWF::TextRecord::setUnderline | ( | bool | b | ) | [inline] |
References gnash::key::b.
void gnash::SWF::TextRecord::setURL | ( | std::string | url | ) | [inline] |
References url.
void gnash::SWF::TextRecord::setXOffset | ( | float | x | ) | [inline] |
References x.
void gnash::SWF::TextRecord::setYOffset | ( | float | y | ) | [inline] |
References y.
boost::uint16_t gnash::SWF::TextRecord::textHeight | ( | ) | const [inline] |
Referenced by displayRecords().
bool gnash::SWF::TextRecord::underline | ( | ) | const [inline] |
Referenced by displayRecords().
float gnash::SWF::TextRecord::xOffset | ( | ) | const [inline] |
Referenced by displayRecords().
float gnash::SWF::TextRecord::yOffset | ( | ) | const [inline] |
Referenced by displayRecords().