SH1106: Cyrillic/UTF-8 support via U8g2_for_Adafruit_GFX overlay - #3222
Open
strasharo wants to merge 1 commit into
Open
SH1106: Cyrillic/UTF-8 support via U8g2_for_Adafruit_GFX overlay#3222strasharo wants to merge 1 commit into
strasharo wants to merge 1 commit into
Conversation
Renders non-ASCII text (Cyrillic etc) using U8g2_for_Adafruit_GFX layered on top of the existing Adafruit_SH110X/GFX driver, gated behind a new DISPLAY_UTF8_FONTS build flag so it's opt-in per board. ASCII text still goes through the fast native Adafruit path. Also adds word-wrap and scrolling for long messages (with manual joystick up/down control on the Wio Tracker L1), and fixes a UTF-8-safe truncation bug in drawTextEllipsized(). Enabled on wio-tracker-l1 and lilygo_tbeam_supreme_SX1262 for now; other SH1106 boards are untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Cyrillic support for SH1106 displays (Wio Tracker L1, T-Beam Supreme for now), same technique ANTodorov used on their fork (display-utf8-support) for GxEPD/SSD1306 - keeps the stock Adafruit_SH110X/GFX driver untouched and layers U8g2_for_Adafruit_GFX on top just for non-ASCII text. ASCII still goes through the normal fast path.
Gated behind a
DISPLAY_UTF8_FONTSbuild flag so it's opt-in, nothing changes for boards that don't set it.Also threw in word-wrap + scrolling for long messages since without it a long Cyrillic message would just run off the bottom of the screen invisibly (the exact bug I ran into while testing this). Wio Tracker L1 gets manual scroll via the joystick up/down buttons too, since those were wired up but unused before.
Tested on real hardware - L1 Pro and T-Beam Supreme, both working (icons intact, wrap/scroll working, Cyrillic renders correctly).
I'd previously opened #3175 which did this by swapping the whole display backend to native U8g2, but that touched every board sharing SH1106Display and caused an icon-rendering regression from a bitmap byte-order mismatch. This is a much smaller, safer diff - closed that one and did this instead.