28 #include <boost/scoped_ptr.hpp>
29 #include <boost/shared_ptr.hpp>
30 #include <boost/cstdint.hpp>
38 class FreetypeGlyphsProvider;
97 Font(std::auto_ptr<SWF::DefineFontTag> ft);
109 Font(
const std::string&
name,
bool bold =
false,
bool italic =
false);
125 bool matches(
const std::string&
name,
bool bold,
bool italic)
const;
143 const std::string&
name()
const {
return _name; }
173 float get_advance(
int glyph_index,
bool embedded)
const;
196 float ascent(
bool embedded)
const;
201 float descent(
bool embedded)
const;
240 boost::shared_ptr<SWF::ShapeRecord>
glyph;
262 void setFlags(boost::uint8_t flags);
270 GlyphInfoRecords::size_type
glyphCount()
const;
288 int add_os_glyph(boost::uint16_t
code);
291 boost::scoped_ptr<SWF::DefineFontTag> _fontTag;
294 GlyphInfoRecords _deviceGlyphTable;
297 std::string _displayName;
298 std::string _copyrightName;
317 boost::shared_ptr<const CodeTable> _embeddedCodeTable;
320 CodeTable _deviceCodeTable;
322 typedef std::map<kerning_pair, float> kernings_table;
323 kernings_table m_kerning_pairs;
325 mutable std::auto_ptr<FreetypeGlyphsProvider> _ftProvider;
334 #endif // GNASH_FONT_H
~Font()
Definition: Font.cpp:104
Font(std::auto_ptr< SWF::DefineFontTag > ft)
Definition: Font.cpp:76
bool isBold() const
Return true if the font is bold.
Definition: Font.h:209
Glyph info structure.
Definition: Font.h:228
std::string copyrightName
Definition: Font.h:224
A pair of strings describing the font.
Definition: Font.h:221
float descent(bool embedded) const
Return the descent value of the font in EM units.
Definition: Font.cpp:357
bool matches(const std::string &name, bool bold, bool italic) const
Return true if this font matches given name and flags.
Definition: Font.cpp:316
A Font resource.
Definition: Font.h:90
For stuff that's tricky to keep track of w/r/t ownership & cleanup. The only use for this class seems...
Definition: ref_counted.h:34
boost::uint16_t m_char1
Definition: Font.h:55
FreetypeGlyphsProvider * ftProvider() const
Retrieve the FreetypeGlyphsProvider, initializing it if necessary.
Definition: Font.cpp:327
boost::uint16_t codeTableLookup(int glyph, bool embedded) const
Definition: Font.cpp:188
Definition: GnashKey.h:157
SWF::ShapeRecord * get_glyph(int glyph_index, bool embedded) const
Get glyph by index.
Definition: Font.cpp:109
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
void setName(const std::string &name)
Set the name of the font.
Definition: Font.cpp:181
Definition: GnashKey.h:161
code
Definition: GnashKey.h:43
void setFlags(boost::uint8_t flags)
Set the language and encoding flags of the font.
Definition: Font.cpp:152
bool operator==(const kerning_pair &k) const
Definition: Font.h:57
float leading() const
Return the leading value of the font.
Definition: Font.cpp:322
float advance
Definition: Font.h:242
void setCodeTable(std::auto_ptr< CodeTable > table)
Add a CodeTable to the font.
Definition: Font.cpp:163
std::string displayName
Definition: Font.h:223
boost::shared_ptr< SWF::ShapeRecord > glyph
Definition: Font.h:240
std::map< boost::uint16_t, int > CodeTable
Definition: Font.h:95
float get_advance(int glyph_index, bool embedded) const
Return the advance value for the given glyph index.
Definition: Font.cpp:229
bool operator<(const event_id &a, const event_id &b)
Comparator for use in stdlib containers.
Definition: event_id.h:170
std::vector< GlyphInfo > GlyphInfoRecords
Definition: Font.h:245
size_t unitsPerEM(bool embedded) const
Return height of the EM square used for glyphs definition.
Definition: Font.cpp:265
Truetype font rasterizer/converter based on freetype library.
Definition: FreetypeGlyphsProvider.h:56
float get_kerning_adjustment(int last_code, int this_code) const
Definition: Font.cpp:251
boost::uint16_t m_char0
Definition: Font.h:54
GlyphInfoRecords::size_type glyphCount() const
Retrieve the number of embedded glyphs in this font.
Definition: Font.cpp:144
bool isItalic() const
Return true if the font is italic.
Definition: Font.h:214
void addFontNameInfo(const FontNameInfo &fontName)
Add display name and copyright name for an embedded font.
Definition: Font.cpp:125
Holds information needed to draw a shape.
Definition: ShapeRecord.h:126
float ascent(bool embedded) const
Return the ascent value of the font.
Definition: Font.cpp:348
Definition: GnashKey.h:331
GlyphInfo()
Definition: Font.cpp:57
int get_glyph_index(boost::uint16_t code, bool embedded) const
Return the glyph index for a given character code.
Definition: Font.cpp:209
const std::string & name() const
Get name of this font.
Definition: Font.h:143