1 #ifndef __blip_Font_hpp 2 #define __blip_Font_hpp 7 #include <commonc++/DynamicCache.h++> 8 #include <commonc++/ScopedPtr.h++> 11 struct FT_GlyphSlotRec_;
61 ccxx::ScopedPtr<Pixmap> _pixmap;
93 const char* getName()
const;
101 int getStyle()
const;
107 bool isItalic()
const;
110 int getGlyphCount()
const;
118 const FontGlyph* getGlyph(char16_t c)
const;
127 {
return(getGlyph(static_cast<char16_t>(c))); }
136 {
return(getGlyph(static_cast<char16_t>(c & 0xFFFF))); }
144 {
return(_descent); }
152 {
return(_maxAdvance); }
156 {
return(_boundingBox); }
160 Font(FT_FaceRec_* face, FT_StreamRec_* stream,
int size,
161 uint_t glyphCacheSize);
164 FT_StreamRec_* _stream;
170 mutable ccxx::DynamicCache<char16_t, FontGlyph> _cache;
173 CCXX_COPY_DECLS(
Font);
178 #endif // __blip_Font_hpp const Pixmap & getPixmap() const
Get the Pixmap which contains the glyph, rendered as an 8-bit alpha image.
Definition: Font.hpp:36
static const int ITALIC
Style constant indicating italic font.
Definition: Font.hpp:90
int getHeight() const
Get the font's height, in pixels.
Definition: Font.hpp:147
int getAdvance() const
Get the glyph's advance, in pixels.
Definition: Font.hpp:40
A rectangular size that has a width and a height.
Definition: Size.hpp:13
int getMaxAdvance() const
Get the font's maximum advance, in pixels.
Definition: Font.hpp:151
A class for loading and caching TrueType fonts.
Definition: FontManager.hpp:25
A TrueType font.
Definition: Font.hpp:74
int getDescent() const
Get the font's descent, in pixels.
Definition: Font.hpp:143
static const int BOLD
Style constant indicating bold font.
Definition: Font.hpp:87
int getLeft() const
Get the glyph's left bearing, in pixels.
Definition: Font.hpp:44
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
const FontGlyph * getGlyph(int c) const
Get the glyph for the given Unicode character.
Definition: Font.hpp:135
~FontGlyph()
Destructor.
Definition: Font.cpp:41
const Size & getBoundingBox() const
Get the font's global (maximum) glyph bounding box, in pixels.
Definition: Font.hpp:155
const FontGlyph * getGlyph(char c) const
Get the glyph for the given ASCII character.
Definition: Font.hpp:126
int getAscent() const
Get the glyph's ascent, in pixels.
Definition: Font.cpp:48
A TrueType font character glyph.
Definition: Font.hpp:24
friend class Font
Definition: Font.hpp:26
int getSize() const
Get the font point size.
Definition: Font.hpp:96
A buffer for two-dimensional pixel data, stored in inverted row order (bottom row first...
Definition: Pixmap.hpp:58
static const int PLAIN
Style constant indicating plain font.
Definition: Font.hpp:84
int getAscent() const
Get the font's ascent, in pixels.
Definition: Font.hpp:139
int getTop() const
Get the glyph's top bearing, in pixels.
Definition: Font.hpp:48
int getDescent() const
Get the glyph's descent, in pixels.
Definition: Font.cpp:56