mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 14:10:53 +00:00
Additional larger font for InkHUD UI (#7201)
* Add 12pt fonts * Add fontMedium In addition to fontSmall and fontLarge * Set fonts in nicheGraphics.h * Change all uses of fontLarge to fontMedium fontLarge was previously set at 9pt. fontLarge is now 12pt, fontMedium is 9pt. (NB: fonts may be customized per-variant) * Use fontLarge with "All Messages" and "DMs" applets * Documentation
This commit is contained in:
@@ -97,15 +97,25 @@ void InkHUD::DMApplet::onRender()
|
||||
// Extra gap below the header
|
||||
int16_t textTop = headerDivY + padDivH;
|
||||
|
||||
// Determine size if printed large
|
||||
// Attempt to print with fontLarge
|
||||
uint32_t textHeight;
|
||||
setFont(fontLarge);
|
||||
uint32_t textHeight = getWrappedTextHeight(0, width(), text);
|
||||
textHeight = getWrappedTextHeight(0, width(), text);
|
||||
if (textHeight <= (uint32_t)height()) {
|
||||
printWrapped(0, textTop, width(), text);
|
||||
return;
|
||||
}
|
||||
|
||||
// If too large, swap to small font
|
||||
if (textHeight + textTop > (uint32_t)height()) // (compare signed and unsigned)
|
||||
setFont(fontSmall);
|
||||
// Fallback (too large): attempt to print with fontMedium
|
||||
setFont(fontMedium);
|
||||
textHeight = getWrappedTextHeight(0, width(), text);
|
||||
if (textHeight <= (uint32_t)height()) {
|
||||
printWrapped(0, textTop, width(), text);
|
||||
return;
|
||||
}
|
||||
|
||||
// Print text
|
||||
// Fallback (too large): print with fontSmall
|
||||
setFont(fontSmall);
|
||||
printWrapped(0, textTop, width(), text);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user