Gnash  0.8.11dev
DefineTextTag.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef GNASH_SWF_DEFINETEXTTAG_H
20 #define GNASH_SWF_DEFINETEXTTAG_H
21 
22 #include <vector>
23 #include "DefinitionTag.h" // for inheritance
24 #include "SWFRect.h" // for composition
25 #include "SWF.h"
26 #include "SWFMatrix.h"
27 #include "TextRecord.h"
28 
29 namespace gnash {
30  class movie_definition;
31  class SWFStream;
32  class RunResources;
33  class StaticText;
34  class Transform;
35 }
36 
37 namespace gnash {
38 namespace SWF {
39 
40 
43 {
44 public:
45 
46  static void loader(SWFStream& in, TagType tag, movie_definition& m,
47  const RunResources& r);
48 
50  void display(Renderer& renderer, const Transform& xform) const;
51 
52  const SWFRect& bounds() const {
53  // TODO: There is a _matrix field in the definition(!) that's
54  // currently ignored. Don't know if it needs to be transformed...
55  return _rect;
56  }
57 
59  //
64  bool extractStaticText(std::vector<const TextRecord*>& to, size_t& size)
65  const;
66 
68  DisplayObject* parent) const;
69 
70 private:
71 
73  friend class DefineText2Tag;
74 
76  //
79  std::uint16_t id)
80  :
82  {
83  read(in, m, tag);
84  }
85 
86  SWFRect _rect;
87 
88  SWFMatrix _matrix;
89 
90  void read(SWFStream& in, movie_definition& m, TagType tag);
91 
92  TextRecord::TextRecords _textRecords;
93 };
94 
96 //
99 {
100 public:
101  static void loader(SWFStream& in, TagType tag, movie_definition& m,
102  const RunResources& r);
103 };
104 
105 } // namespace SWF
106 } // namespace gnash
107 
108 #endif
gnash::readSWFMatrix
SWFMatrix readSWFMatrix(SWFStream &in)
Read a SWFMatrix from input stream.
Definition: TypesParser.cpp:49
gnash::SWF::DefineTextTag
Static text definition tag.
Definition: DefineTextTag.h:43
gnash::SWF::TextRecord::displayRecords
static void displayRecords(Renderer &renderer, const Transform &xform, const TextRecords &records, bool embedded=true)
Render the given glyph records.
Definition: TextRecord.cpp:163
TypesParser.h
gnash::SWF::DEFINETEXT
@ DEFINETEXT
Definition: SWF.h:43
gnash::SWF::TagType
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:31
gnash::Transform::matrix
SWFMatrix matrix
Definition: Transform.h:59
gnash::SWF::DefinitionTag
Immutable data representing the definition of a movie display element.
Definition: DefinitionTag.h:48
_
#define _(String)
Definition: log.h:44
Transform.h
gnash
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
gnash::Renderer
Base class for render handlers.
Definition: Renderer.h:189
gnash::key::m
@ m
Definition: GnashKey.h:159
gnash::SWF::TextRecord::TextRecords
std::vector< TextRecord > TextRecords
Definition: TextRecord.h:51
Global_as.h
StaticText.h
SWFRect.h
gnash::SWF::DefineText2Tag::loader
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Definition: DefineTextTag.cpp:83
TextRecord.h
gnash::movie_definition
Client program's interface to the definition of a movie or sprite.
Definition: movie_definition.h:96
gnash::SWF::DefineTextTag::extractStaticText
bool extractStaticText(std::vector< const TextRecord * > &to, size_t &size) const
Extract static text from TextRecords.
Definition: DefineTextTag.cpp:66
gnash::SWFRect
Rectangle class, see swf defined rectangle record.
Definition: SWFRect.h:45
gnash::key::t
@ t
Definition: GnashKey.h:166
gnash::SWF::DEFINETEXT2
@ DEFINETEXT2
Definition: SWF.h:63
gnash::key::r
@ r
Definition: GnashKey.h:164
gnash::SWF::DefineText2Tag
Parse a DefineText2Tag.
Definition: DefineTextTag.h:99
gnash::SWF::DefinitionTag::id
std::uint16_t id() const
The immutable id of the DefinitionTag.
Definition: DefinitionTag.h:76
GnashAlgorithm.h
gnash::SWF::TextRecord::RecordCounter
Accumulate the number of glyphs in a TextRecord.
Definition: TextRecord.h:75
gnash::StaticText
Static text fields, SWF-defined with read-only text.
Definition: StaticText.h:44
Font.h
gnash::RunResources
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:54
gnash::SWFMatrix
Definition: SWFMatrix.h:54
IF_VERBOSE_PARSE
#define IF_VERBOSE_PARSE(x)
Definition: log.h:378
gnash::log_parse
void log_parse(StringType msg, Args... args)
Definition: log.h:313
log.h
gnash::getRoot
movie_root & getRoot(const as_environment &env)
Definition: as_environment.cpp:645
DefineTextTag.h
DefinitionTag.h
SWF.h
gnash::Global_as
The Global object ultimately contains all objects in an ActionScript run.
Definition: Global_as.h:50
gnash::SWFStream::read_u16
std::uint16_t read_u16()
Read a aligned unsigned 16-bit value from the stream.
Definition: SWFStream.cpp:332
gnash::SWF::DefineTextTag::bounds
const SWFRect & bounds() const
Definition: DefineTextTag.h:52
RunResources.h
gnash::SWFMatrix::concatenate
void concatenate(const SWFMatrix &m)
Concatenate m's transform onto ours.
Definition: SWFMatrix.cpp:148
gnash::SWF::DefineTextTag::display
void display(Renderer &renderer, const Transform &xform) const
Draw the string.
Definition: DefineTextTag.cpp:126
gnash::SWFStream::read_u8
std::uint8_t read_u8()
Read a aligned unsigned 8-bit value from the stream.
Definition: SWFStream.cpp:319
movie_definition.h
gnash::DisplayObject
DisplayObject is the base class for all DisplayList objects.
Definition: DisplayObject.h:169
gnash::SWFStream
SWF stream wrapper class.
Definition: SWFStream.h:59
gnash::readRect
SWFRect readRect(SWFStream &in)
Read a bit-packed rectangle from an SWF stream.
Definition: TypesParser.cpp:130
gnash::Transform
The Transform class expresses a stage in a cumulative transformation.
Definition: Transform.h:34
gnash::SWFStream::ensureBytes
void ensureBytes(unsigned long needed)
Ensure the requested number of bytes are available for an aligned read in the currently opened tag.
Definition: SWFStream.cpp:50
gnash::key::SWF
@ SWF
Definition: GnashKey.h:331
gnash::SWF::DefineTextTag::createDisplayObject
virtual DisplayObject * createDisplayObject(Global_as &gl, DisplayObject *parent) const
Create a DisplayObject with the given parent.
Definition: DefineTextTag.cpp:59
gnash::SWF::DefineTextTag::loader
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Definition: DefineTextTag.cpp:42
gnash::SWF::TextRecord
Store a TextRecord.
Definition: TextRecord.h:48
SWFStream.h
SWFMatrix.h
gnash::CreatePointer
Return a pointer to a type.
Definition: GnashAlgorithm.h:32