|
@@ -26,20 +26,16 @@ Font::Font(const char* const* glyphs, byte glyph_width, byte glyph_height, byte
|
|
, m_last_glyph(last_glyph)
|
|
, m_last_glyph(last_glyph)
|
|
{
|
|
{
|
|
m_error_bitmap = CharacterBitmap::create_from_ascii(DEFAULT_FONT_NAME::error_glyph, m_glyph_width, m_glyph_height);
|
|
m_error_bitmap = CharacterBitmap::create_from_ascii(DEFAULT_FONT_NAME::error_glyph, m_glyph_width, m_glyph_height);
|
|
|
|
+ for (unsigned ch = 0; ch < 256; ++ch) {
|
|
|
|
+ if (ch < m_first_glyph || ch > m_last_glyph) {
|
|
|
|
+ m_bitmaps[ch] = m_error_bitmap.copyRef();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ const char* data = m_glyphs[(unsigned)ch - m_first_glyph];
|
|
|
|
+ m_bitmaps[ch] = CharacterBitmap::create_from_ascii(data, m_glyph_width, m_glyph_height);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
Font::~Font()
|
|
Font::~Font()
|
|
{
|
|
{
|
|
}
|
|
}
|
|
-
|
|
|
|
-const CharacterBitmap* Font::glyph_bitmap(byte ch) const
|
|
|
|
-{
|
|
|
|
- if (!m_bitmaps[ch]) {
|
|
|
|
- if (ch < m_first_glyph || ch > m_last_glyph)
|
|
|
|
- return nullptr;
|
|
|
|
- const char* data = m_glyphs[(unsigned)ch - m_first_glyph];
|
|
|
|
- m_bitmaps[ch] = CharacterBitmap::create_from_ascii(data, m_glyph_width, m_glyph_height);
|
|
|
|
- }
|
|
|
|
- ASSERT(ch >= m_first_glyph && ch <= m_last_glyph);
|
|
|
|
- return m_bitmaps[ch].ptr();
|
|
|
|
-}
|
|
|