1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:07:35 +00:00

LibGfx+LibTTF: Allow Painter to draw TTF glyphs

This commit is contained in:
Stephan Unverwerth 2021-01-02 18:22:22 +01:00 committed by Andreas Kling
parent 0f41f5d9ba
commit 85158dc0ad
5 changed files with 66 additions and 14 deletions

View file

@ -75,18 +75,27 @@ public:
{
}
Glyph(RefPtr<Bitmap> bitmap)
Glyph(RefPtr<Bitmap> bitmap, int left_bearing, int advance, int ascent)
: m_bitmap(bitmap)
, m_left_bearing(left_bearing)
, m_advance(advance)
, m_ascent(ascent)
{
}
bool is_glyph_bitmap() const { return !m_bitmap; }
GlyphBitmap glyph_bitmap() const { return m_glyph_bitmap; }
RefPtr<Bitmap> bitmap() const { return m_bitmap; }
int left_bearing() const { return m_left_bearing; }
int advance() const { return m_advance; }
int ascent() const { return m_ascent; }
private:
GlyphBitmap m_glyph_bitmap;
RefPtr<Bitmap> m_bitmap;
int m_left_bearing;
int m_advance;
int m_ascent;
};
class Font : public RefCounted<Font> {