Forked para SNOCC
Fork of RA8875 by
Diff: RA8875.cpp
- Revision:
- 101:e0aad446094a
- Parent:
- 100:0b084475d5a9
- Child:
- 103:7e0464ca6c5c
--- a/RA8875.cpp Sat Dec 19 15:55:09 2015 +0000 +++ b/RA8875.cpp Sun Jan 17 22:16:37 2016 +0000 @@ -803,6 +803,13 @@ } + +// Questions to ponder - +// - if we choose to wrap to the next line, because the character won't fit on the current line, +// should it erase the space to the width of the screen (in case there is leftover junk there)? +// - it currently wraps from the bottom of the screen back to the top. I have pondered what +// it might take to scroll the screen - but haven't thought hard enough about it. +// int RA8875::_external_putc(int c) { if (c) { @@ -811,17 +818,23 @@ } else if (c == '\n') { cursor_y += extFontHeight; } else { - int advance = character(cursor_x, cursor_y, c); // advance tells us how many pixels we advanced - INFO("x,y,advance %d,%d,%d '%c", cursor_x, cursor_y, advance, c); - if (advance) { - cursor_x += advance; - if (cursor_x >= width()) { + uint8_t charWidth, charHeight; + const uint8_t * charRecord; + + charRecord = getCharMetrics(c, &charWidth, &charHeight); + //int advance = charwidth(c); + INFO("(%d,%d) ,charWidth: %d '%c", cursor_x, cursor_y, charWidth, c); + if (charRecord) { + //cursor_x += advance; + if (cursor_x + charWidth >= width()) { cursor_x = 0; - cursor_y += extFontHeight; - if (cursor_y >= height()) { - cursor_y = 0; // @todo Should it scroll? - } + cursor_y += charHeight; } + if (cursor_y + charHeight >= height()) { + cursor_y = 0; // @todo Should it scroll? + } + (void)character(cursor_x, cursor_y, c); + cursor_x += charWidth; } } }