Go to the documentation of this file.
37 class FreetypeGlyphsProvider;
96 Font(std::unique_ptr<SWF::DefineFontTag> ft);
108 Font(std::string
name,
bool bold =
false,
bool italic =
false);
124 bool matches(
const std::string&
name,
bool bold,
bool italic)
const;
142 const std::string&
name()
const {
return _name; }
172 float get_advance(
int glyph_index,
bool embedded)
const;
195 float ascent(
bool embedded)
const;
200 float descent(
bool embedded)
const;
237 std::unique_ptr<SWF::ShapeRecord>
glyph;
267 GlyphInfoRecords::size_type
glyphCount()
const;
285 int add_os_glyph(std::uint16_t
code);
288 std::unique_ptr<SWF::DefineFontTag> _fontTag;
294 std::string _displayName;
295 std::string _copyrightName;
314 std::shared_ptr<const CodeTable> _embeddedCodeTable;
319 typedef std::map<kerning_pair, float> kernings_table;
320 kernings_table m_kerning_pairs;
322 mutable std::unique_ptr<FreetypeGlyphsProvider> _ftProvider;
331 #endif // GNASH_FONT_H
FreetypeGlyphsProvider * ftProvider() const
Retrieve the FreetypeGlyphsProvider, initializing it if necessary.
Definition: Font.cpp:319
SWF::ShapeRecord * get_glyph(int glyph_index, bool embedded) const
Get glyph by index.
Definition: Font.cpp:101
std::string name
Definition: LocalConnection_as.cpp:149
void log_swferror(StringType msg, Args... args)
Definition: log.h:325
bool operator==(const kerning_pair &k) const
Definition: Font.h:56
float ascent(bool embedded) const
Return the ascent value of the font.
Definition: Font.cpp:340
#define _(String)
Definition: log.h:44
const std::string & name() const
Get name of this font.
Definition: Font.h:142
Truetype font rasterizer/converter based on freetype library.
Definition: FreetypeGlyphsProvider.h:57
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:41
bool isItalic() const
Return true if the font is italic.
Definition: Font.h:213
std::string displayName
Definition: Font.h:222
std::vector< GlyphInfo > GlyphInfoRecords
Definition: Font.h:242
unsigned short unitsPerEM() const
Return the number of units of glyphs EM.
Definition: FreetypeGlyphsProvider.cpp:401
float ascent() const
Return the font's ascender in terms of its EM own square.
Definition: FreetypeGlyphsProvider.cpp:415
GlyphInfoRecords::size_type glyphCount() const
Retrieve the number of embedded glyphs in this font.
Definition: Font.cpp:136
static std::unique_ptr< FreetypeGlyphsProvider > createFace(const std::string &name, bool bold, bool italic)
Named constructor for a face-bound rasterizer.
Definition: FreetypeGlyphsProvider.cpp:393
float descent(bool embedded) const
Return the descent value of the font in EM units.
Definition: Font.cpp:349
void log_error(StringType msg, Args... args)
Definition: log.h:283
Font(std::unique_ptr< SWF::DefineFontTag > ft)
Definition: Font.cpp:69
@ k
Definition: GnashKey.h:157
void setFlags(std::uint8_t flags)
Set the language and encoding flags of the font.
Definition: Font.cpp:144
#define IF_VERBOSE_MALFORMED_SWF(x)
Definition: log.h:404
std::unique_ptr< SWF::ShapeRecord > getGlyph(std::uint16_t code, float &advance)
Return the given DisplayObject glyph as a shape DisplayObject definition in unitsPerEM() coordinates.
Definition: FreetypeGlyphsProvider.cpp:552
std::unique_ptr< SWF::ShapeRecord > glyph
Definition: Font.h:237
~Font()
Definition: Font.cpp:96
void addFontNameInfo(const FontNameInfo &fontName)
Add display name and copyright name for an embedded font.
Definition: Font.cpp:117
code
Definition: GnashKey.h:44
bool matches(const std::string &name, bool bold, bool italic) const
Return true if this font matches given name and flags.
Definition: Font.cpp:308
void setName(const std::string &name)
Set the name of the font.
Definition: Font.cpp:173
@ p
Definition: GnashKey.h:162
size_t unitsPerEM(bool embedded) const
Return height of the EM square used for glyphs definition.
Definition: Font.cpp:257
float descent() const
Return the font's descender in terms of its own EM square.
Definition: FreetypeGlyphsProvider.cpp:408
std::uint16_t codeTableLookup(int glyph, bool embedded) const
Definition: Font.cpp:180
bool isBold() const
Return true if the font is bold.
Definition: Font.h:208
float leading() const
Return the leading value of the font.
Definition: Font.cpp:314
std::uint16_t m_char0
Definition: Font.h:53
float advance
Definition: Font.h:239
int get_glyph_index(std::uint16_t code, bool embedded) const
Return the glyph index for a given character code.
Definition: Font.cpp:201
A Font resource.
Definition: Font.h:90
bool operator<(const event_id &a, const event_id &b)
Comparator for use in stdlib containers.
Definition: event_id.h:170
std::string copyrightName
Definition: Font.h:223
A pair of strings describing the font.
Definition: Font.h:221
GlyphInfo()
Definition: Font.cpp:57
std::uint16_t m_char1
Definition: Font.h:54
float get_advance(int glyph_index, bool embedded) const
Return the advance value for the given glyph index.
Definition: Font.cpp:221
Holds information needed to draw a shape.
Definition: ShapeRecord.h:127
float get_kerning_adjustment(int last_code, int this_code) const
Definition: Font.cpp:243
Glyph info structure.
Definition: Font.h:228
@ SWF
Definition: GnashKey.h:331
std::map< std::uint16_t, int > CodeTable
Definition: Font.h:94
void setCodeTable(std::unique_ptr< CodeTable > table)
Add a CodeTable to the font.
Definition: Font.cpp:155
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:35