InkHUD Extended ASCII (#6768)

* Custom AdafruitGFX fonts with extended ASCII encodings

* AppletFont handles re-encoding of UTF-8 text

* Manual parsing of text which may contain non-ASCII chars

* Display emoji reactions, even when unprintable
Important to indicate to users that a message has been received, even if meaning is unclear.

* Superstitious shrink_to_fit
I don't think these help, but they're not hurting!

* Use Windows-1252 fonts by default

* Spelling

* Tidy up nicheGraphics.h

* Documentation

* Fix inverted logic
Slipped in during a last minute renaming while tidying up to push..
This commit is contained in:
todd-herbert
2025-05-23 11:16:53 +12:00
committed by GitHub
parent b12e9d43be
commit ba1ef45024
33 changed files with 3977 additions and 914 deletions

View File

@@ -23,11 +23,6 @@ int InkHUD::DMApplet::onReceiveTextMessage(const meshtastic_MeshPacket *p)
if (!isActive())
return 0;
// Abort if only an "emoji reactions"
// Possibly some implemetation of this in future?
if (p->decoded.emoji)
return 0;
// If DM (not broadcast)
if (!isBroadcast(p->to)) {
// Want to update display, if applet is foreground
@@ -96,19 +91,22 @@ void InkHUD::DMApplet::onRender()
// Print message text
// ===================
// Parse any non-ascii chars in the message
std::string text = parse(latestMessage->dm.text);
// Extra gap below the header
int16_t textTop = headerDivY + padDivH;
// Determine size if printed large
setFont(fontLarge);
uint32_t textHeight = getWrappedTextHeight(0, width(), latestMessage->dm.text);
uint32_t textHeight = getWrappedTextHeight(0, width(), text);
// If too large, swap to small font
if (textHeight + textTop > (uint32_t)height()) // (compare signed and unsigned)
setFont(fontSmall);
// Print text
printWrapped(0, textTop, width(), latestMessage->dm.text);
printWrapped(0, textTop, width(), text);
}
// Don't show notifications for direct messages when our applet is displayed