Skip to content

InkHUD Extended ASCII #6768

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

todd-herbert
Copy link
Contributor

@todd-herbert todd-herbert commented May 8, 2025

Resolves #6375
Adds support for extended ASCII fonts to InkHUD.

Bundled with fonts for:

  • Windows-1250 (Central European)
  • Windows-1251 (Cyrillic)
  • Windows-1252 (Western European)

Default builds use the Windows-1252 character set.

Windows-1250 and Windows-1251 supported to match existing OLED_UA, OLED_CS, OLED_PL, OLED_RU. These require a custom build, with a small change to nicheGraphics.h. Documentation on making this change will follow shortly.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)
      • Elecrow ThinkNode M1
      • Heltec Vision Master E213
      • Heltec Vision Master E290
      • Heltec Wireless Paper
      • LilyGo T3S3 E-Paper
      • LilyGo T-Echo

@thebentern thebentern requested a review from Copilot May 8, 2025 11:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR resolves issue #6375 by adding extended ASCII support to InkHUD. Key changes include:

  • Updating font selection in nicheGraphics.h to use new extended-ASCII macros (FREESANS_9PT_WIN1252 and FREESANS_6PT_WIN1252) and corresponding documentation.
  • Introducing and consistently applying text parsing (via the parse() and parseShortName() functions) to handle non-ASCII characters in message and device names.
  • Minor performance and documentation improvements such as using shrink_to_fit() on container sizes and correcting several spelling errors.

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
variants/ELECROW-ThinkNode-M1/nicheGraphics.h Updated driver setup and font configuration to use extended-ASCII fonts.
src/graphics/niche/InkHUD/docs/README.md Added sections on Fonts, Unicode parsing, and Localization; improved documentation style.
src/graphics/niche/InkHUD/Events.cpp Removed the emoji reaction short-circuit check.
src/graphics/niche/InkHUD/Applets/User/ThreadedMessage/ThreadedMessageApplet.cpp Integrated parsing of non-ASCII text via parse() for both message body and sender info.
src/graphics/niche/InkHUD/Applets/User/RecentsList/RecentsListApplet.cpp Added shrink_to_fit() calls after resizing card containers.
src/graphics/niche/InkHUD/Applets/User/Heard/HeardApplet.cpp Corrected comment spelling and added shrink_to_fit() for the cards container.
src/graphics/niche/InkHUD/Applets/User/DM/DMApplet.cpp Unified text rendering by parsing non-ASCII text before display.
src/graphics/niche/InkHUD/Applets/User/AllMessage/AllMessageApplet.cpp Ensured message text is parsed for special characters before measurement and printing.
src/graphics/niche/InkHUD/Applets/System/Pairing/PairingApplet.cpp Modified device name rendering to parse non-ASCII characters.
src/graphics/niche/InkHUD/Applets/System/Notification/NotificationApplet.cpp Updated notification text handling to re-encode non-ASCII text using parse().
src/graphics/niche/InkHUD/Applets/System/Menu/MenuApplet.cpp Added a shrink_to_fit() call for the menu items container.
src/graphics/niche/InkHUD/Applets/Examples/NewMsgExample/NewMsgExampleApplet.h Changed reference from MeshModule API to Module API in the usage description.
src/graphics/niche/InkHUD/Applets/Examples/BasicExample/BasicExampleApplet.cpp Updated comments to advise parsing text with special characters.
src/graphics/niche/InkHUD/Applets/Bases/NodeList/NodeListApplet.cpp Updated node name retrieval to use parseShortName() with fallback logic when non-printable text is detected.
src/graphics/niche/InkHUD/Applets/Bases/Map/MapApplet.cpp Replaced direct usage of node names with parsed results for both width calculation and display.
src/graphics/niche/InkHUD/AppletFont.h Introduced an Encoding enum and updated macros to support extended-ASCII modes.
src/graphics/niche/InkHUD/Applet.h Declared new functions – parse, parseShortName, and isPrintable – for handling non-ASCII text.
src/graphics/niche/InkHUD/Applet.cpp Implemented text parsing and short name fallback logic; refined overloaded printAt functions.
src/graphics/niche/Fonts/FreeSans6pt8bCyrillic.h Removed the Cyrillic font header to consolidate supported font files.
src/graphics/niche/Fonts/FreeSans6pt7b.h Updated font header definitions to match the new extended-ASCII configuration.

@fifieldt fifieldt force-pushed the inkhud/extended-ascii branch from fcc77a1 to 146cf0e Compare May 12, 2025 00:58
@thebentern thebentern requested a review from Copilot May 12, 2025 10:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for extended ASCII fonts in InkHUD with updates to font selection, text parsing, and adjustments in various applets to ensure proper handling of non-ASCII characters. Key changes include replacing legacy font references with new encoding‐aware macros, adding explicit parsing of text data via the new parse routines, and minor code cleanups (spelling corrections, vector shrink_to_fit calls).

Reviewed Changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
variants/ELECROW-ThinkNode-M1/nicheGraphics.h Updates to include new font macros and cleaner comments for the E-Ink driver setup.
src/graphics/niche/InkHUD/Applets/* Multiple applets now use parse() and parseShortName() for rendering text with extended ASCII support; emoji branch removed.
src/graphics/niche/InkHUD/AppletFont.h Introduces an Encoding enum and new macros for Windows-1250/1251/1252 fonts.
src/graphics/niche/InkHUD/Applet(.cpp) Added new parsing routines and overloaded print functions, with removal of redundant substitution calls in getTextWidth.
Various README and example files Updated documentation and example comments to reflect the new extended ASCII and font parsing functionality.
Font header files Adjustments to font bitmap and glyph definitions with some deprecated fonts removed.
Comments suppressed due to low confidence (1)

src/graphics/niche/InkHUD/Applet.cpp:345

  • The removal of getFont().applySubstitutions from the getTextWidth(std::string) overload means callers must pre-parse text to ensure special characters are handled; please verify that all usage sites comply with this change.
return getTextWidth(text.c_str());

@@ -16,7 +16,7 @@ void InkHUD::HeardApplet::onActivate()

void InkHUD::HeardApplet::onDeactivate()
{
// Avoid an unlikely situation where frquent activation / deactivation populated duplicate info from node DB
// Avoid an unlikely situation where frequent activation / deactivation populates duplicate info from node DB
Copy link
Preview

Copilot AI May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment spelling was corrected from 'frquent' to 'frequent'; please ensure consistent spelling in documentation.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Meshtastic 2.6.2: Special characters are not displayed on the device
3 participants