Add option to adjust height when switching fonts to smaller
This commit is contained in:
@@ -99,18 +99,30 @@ again:
|
|||||||
}
|
}
|
||||||
case 'f':
|
case 'f':
|
||||||
case 's':
|
case 's':
|
||||||
|
case 'S':
|
||||||
case 'm':
|
case 'm':
|
||||||
{
|
{
|
||||||
font = [&controlChar,&oldFont]() -> uint8_t {
|
bool changeHeight = false;
|
||||||
|
font = [&controlChar,&oldFont,&changeHeight]() -> uint8_t {
|
||||||
switch (controlChar)
|
switch (controlChar)
|
||||||
{
|
{
|
||||||
case 'f': return oldFont;
|
case 'f': return oldFont;
|
||||||
case 's': return 2;
|
case 's': return 2;
|
||||||
|
case 'S': {
|
||||||
|
changeHeight = true;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
case 'm': return 4;
|
case 'm': return 4;
|
||||||
}
|
}
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
if (changeHeight)
|
||||||
|
{
|
||||||
|
// adjust y rendering position to new font height
|
||||||
|
poY += fontRenderer.fontHeight(oldFont) - fontRenderer.fontHeight(font);
|
||||||
|
}
|
||||||
|
|
||||||
auto newNewIter = newIter + 1;
|
auto newNewIter = newIter + 1;
|
||||||
if (newNewIter != std::end(str))
|
if (newNewIter != std::end(str))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user