Commit 78726fda authored by Cyril Deguet's avatar Cyril Deguet

* bitmap_font.cpp: full support of text bitmap font

parent d5c4e1bf
......@@ -30,6 +30,7 @@ BitmapFont::BitmapFont( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
const string &rType ):
GenericFont( pIntf ), m_rBitmap( rBitmap )
{
// Build the character table
if( rType == "digits" )
{
m_width = 9;
......@@ -50,14 +51,35 @@ BitmapFont::BitmapFont( intf_thread_t *pIntf, const GenericBitmap &rBitmap,
m_skip = 5;
for( int i = 0; i < 26; i++ )
{
m_table['A'+i].m_xPos = i * m_width;
m_table['a'+i].m_xPos = i * m_width;
m_table['A'+i].m_xPos = m_table['a'+i].m_xPos = i * m_width;
}
m_table[(size_t)'"'].m_xPos = 26 * m_width;
m_table[(size_t)'@'].m_xPos = 27 * m_width;
m_table[(size_t)' '].m_xPos = 28 * m_width;
for( int i = 0; i <= 9; i++ )
{
m_table['0'+i].m_xPos = i * m_width;
m_table['0'+i].m_yPos = m_height;
}
static const char specialChars[] = {'.', ':', '(', ')', '-', '\'',
'!', '_', '+', '\\', '/', '[', ']', '^', '&', '%', ',', '=', '$',
'#'};
for( int i = 0; i < 19; i++ )
{
m_table[(size_t)specialChars[i]].m_xPos = (11 + i) * m_width;
m_table[(size_t)specialChars[i]].m_yPos = m_height;
}
m_table[(size_t)''].m_xPos = m_table[(size_t)''].m_xPos = 0;
m_table[(size_t)''].m_xPos = m_table[(size_t)''].m_xPos = m_width;
m_table[(size_t)''].m_xPos = m_table[(size_t)''].m_xPos = 3 * m_width;
m_table[(size_t)'?'].m_xPos = 4 * m_width;
m_table[(size_t)'*'].m_xPos = 5 * m_width;
static const char thirdLine[] = {'', '', '', '', '', '', '?',
'*'};
for( int i = 0; i < 8; i++ )
{
m_table[(size_t)thirdLine[i]].m_yPos = 2 * m_height;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment