Add option to adjust height when switching fonts to smaller

This commit is contained in:
Florian Wetzel
2025-02-21 15:48:55 +01:00
parent 068ef657e8
commit beab503d28

View File

@@ -99,18 +99,30 @@ again:
}
case 'f':
case 's':
case 'S':
case 'm':
{
font = [&controlChar,&oldFont]() -> uint8_t {
bool changeHeight = false;
font = [&controlChar,&oldFont,&changeHeight]() -> uint8_t {
switch (controlChar)
{
case 'f': return oldFont;
case 's': return 2;
case 'S': {
changeHeight = true;
return 2;
}
case 'm': return 4;
}
__builtin_unreachable();
}();
if (changeHeight)
{
// adjust y rendering position to new font height
poY += fontRenderer.fontHeight(oldFont) - fontRenderer.fontHeight(font);
}
auto newNewIter = newIter + 1;
if (newNewIter != std::end(str))
{