void TextAscii::Blit(u16 ax, u16 ay, const u16 maxw, Surface & dst) { if(message.empty()) return; std::string::const_iterator it = message.begin(); std::string::const_iterator it_end = message.end(); s8 oy = 0; const u16 sx = ax; for(; it != it_end; ++it) { if(maxw && (ax - sx) >= maxw) break; // space or unknown letter if(*it < 0x21) { ax += CharWidth(*it, font); continue; } const Surface & sprite = AGG::GetLetter(*it, font); if(!sprite.isValid()) return; // valign switch(*it) { case '-': oy = CharAscent(font) / 2; break; case '_': oy = CharAscent(font); break; // " case 0x22: // ' case 0x27: oy = 0; break; case 'y': case 'g': case 'p': case 'q': case 'j': oy = CharAscent(font) + CharDescent(font) - sprite.h(); break; default: oy = CharAscent(font) - sprite.h(); break; } sprite.Blit(ax, ay + 2 + oy, dst); ax += sprite.w(); } }
u8 TextAscii::CharHeight(Font::type_t f) { return CharAscent(f) + CharDescent(f) + 1; }
int TextAscii::CharHeight(int f) { return CharAscent(f) + CharDescent(f) + 1; }