diff options
Diffstat (limited to 'Libraries/LibTTF/Font.cpp')
-rw-r--r-- | Libraries/LibTTF/Font.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Libraries/LibTTF/Font.cpp b/Libraries/LibTTF/Font.cpp index 9681e953b8..2b53332bf1 100644 --- a/Libraries/LibTTF/Font.cpp +++ b/Libraries/LibTTF/Font.cpp @@ -444,4 +444,15 @@ int ScaledFont::width(const Utf32View& utf32) const return width; } +RefPtr<Gfx::Bitmap> ScaledFont::raster_glyph(u32 glyph_id) const +{ + auto glyph_iterator = m_cached_glyph_bitmaps.find(glyph_id); + if (glyph_iterator != m_cached_glyph_bitmaps.end()) + return glyph_iterator->value; + + auto glyph_bitmap = m_font->raster_glyph(glyph_id, m_x_scale, m_y_scale); + m_cached_glyph_bitmaps.set(glyph_id, glyph_bitmap); + return glyph_bitmap; +} + } |