Gnash  0.8.11dev
DefineFontTag.h
Go to the documentation of this file.
1 // DefineFontTag.h Read DefineFont and DefineFontInfo tags
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 
21 // Based on the public domain work of Thatcher Ulrich <tu@tulrich.com> 2003
22 
25 //
29 
30 #ifndef GNASH_SWF_DEFINEFONTTAG_H
31 #define GNASH_SWF_DEFINEFONTTAG_H
32 
33 #include "SWF.h"
34 #include "Font.h"
35 #include <map>
36 #include <string>
37 #include <cstdint>
38 
39 // Forward declarations
40 namespace gnash {
41  class SWFStream;
42  class movie_definition;
43  class RunResources;
44 }
45 
46 namespace gnash {
47 namespace SWF {
48 
51 {
52 public:
53 
55  //
57  static void loader(SWFStream& in, TagType tag, movie_definition& m,
58  const RunResources& r);
59 
62  return _glyphTable;
63  }
64 
66  //
68  //
70  bool hasCodeTable() const {
71  return _codeTable.get();
72  }
73 
75  //
78  //
82  std::shared_ptr<const Font::CodeTable> getCodeTable() const {
83  return _codeTable;
84  }
85 
86  bool ansiChars() const { return _ansiChars; }
87  bool shiftJISChars() const { return _shiftJISChars; }
88  bool unicodeChars() const { return _unicodeChars; }
89  bool italic() const { return _italic; }
90  bool bold() const { return _bold; }
91  bool subpixelFont() const { return _subpixelFont; }
92 
94  //
96  std::int16_t leading() const {
97  return _leading;
98  }
99 
101  //
103  std::int16_t ascent() const {
104  return _ascent;
105  }
106 
108  //
110  std::int16_t descent() const {
111  return _descent;
112  }
113 
114  const std::string& name() const { return _name; }
115 
117  static void readCodeTable(SWFStream& in, Font::CodeTable& table,
118  bool wideCodes, size_t glyphCount);
119 
120 private:
121 
123  const RunResources& r);
124 
126  void readDefineFont(SWFStream& in, movie_definition& m,
127  const RunResources& r);
128 
130  void readDefineFont2Or3(SWFStream& in, movie_definition& m,
131  const RunResources& r);
132 
134  Font::GlyphInfoRecords _glyphTable;
135 
136  std::string _name;
137  bool _subpixelFont;
138  bool _unicodeChars;
139  bool _shiftJISChars;
140  bool _ansiChars;
141  bool _italic;
142  bool _bold;
143 
144  std::int16_t _ascent;
145  std::int16_t _descent;
146  std::int16_t _leading;
147 
148  typedef std::map<kerning_pair, std::int16_t> KerningTable;
149  KerningTable _kerningPairs;
150 
151  std::shared_ptr<const Font::CodeTable> _codeTable;
152 };
153 
154 
156 {
157 public:
159  //
163  static void loader(SWFStream& in, TagType tag, movie_definition& m,
164  const RunResources& r);
165 };
166 
167 }
168 }
169 
170 #endif
std::shared_ptr< const Font::CodeTable > getCodeTable() const
Retrieve the tag&#39;s Font::CodeTable.
Definition: DefineFontTag.h:82
bool subpixelFont() const
Definition: DefineFontTag.h:91
Client program&#39;s interface to the definition of a movie or sprite.
Definition: movie_definition.h:95
bool shiftJISChars() const
Definition: DefineFontTag.h:87
bool unicodeChars() const
Definition: DefineFontTag.h:88
TagType
SWF tag types. Symbolic names copied from Ming.
Definition: SWF.h:30
std::int16_t descent() const
The font descent value.
Definition: DefineFontTag.h:110
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
std::int16_t ascent() const
The font ascent value.
Definition: DefineFontTag.h:103
static void readCodeTable(SWFStream &in, Font::CodeTable &table, bool wideCodes, size_t glyphCount)
Read Font::CodeTable, which maps glyph indices to DisplayObject codes.
Definition: DefineFontTag.cpp:56
Definition: GnashKey.h:164
const std::string & name() const
Definition: DefineFontTag.h:114
bool bold() const
Definition: DefineFontTag.h:90
Class to group together per-run and external resources for Gnash.
Definition: RunResources.h:53
std::int16_t leading() const
The font leading value.
Definition: DefineFontTag.h:96
Read and store DefineFont and DefineFont2 tag.
Definition: DefineFontTag.h:50
bool italic() const
Definition: DefineFontTag.h:89
const Font::GlyphInfoRecords & glyphTable() const
Return the glyphs read from the DefineFont tag.
Definition: DefineFontTag.h:61
bool hasCodeTable() const
Check for the existence of a Font::CodeTable.
Definition: DefineFontTag.h:70
std::vector< GlyphInfo > GlyphInfoRecords
Definition: Font.h:242
bool ansiChars() const
Definition: DefineFontTag.h:86
static void loader(SWFStream &in, TagType tag, movie_definition &m, const RunResources &r)
Load a DefineFont tag.
Definition: DefineFontTag.cpp:41
std::map< std::uint16_t, int > CodeTable
Definition: Font.h:94
Definition: GnashKey.h:159
Definition: DefineFontTag.h:155
Definition: GnashKey.h:331
SWF stream wrapper class.
Definition: SWFStream.h:58