Skip to content

Add Cyrillic/UTF-8 text support to SH1106Display - #3175

Closed
strasharo wants to merge 1 commit into
meshcore-dev:devfrom
strasharo:cyrillic-sh1106-support
Closed

Add Cyrillic/UTF-8 text support to SH1106Display#3175
strasharo wants to merge 1 commit into
meshcore-dev:devfrom
strasharo:cyrillic-sh1106-support

Conversation

@strasharo

Copy link
Copy Markdown

Switches SH1106Display from Adafruit_SH110X/GFX to U8g2 so it can actually render Cyrillic (and other non-Latin UTF-8) text instead of falling back to block characters. Picks up on #1930 and the still-open #1439, where the author got SSD1306 working but didn't have SH1106 hardware to test against - I do, so this covers that gap.

What changed:

  • font rendering now goes through U8g2 instead of Adafruit_GFX. Using the X11 "fixed" fonts (public domain, ISO10646/Unicode-encoded, full Basic Latin + Cyrillic coverage) at two sizes to roughly match the old font's small/large text sizes
  • print()/getTextWidth() now use U8g2's UTF-8-aware drawUTF8()/getUTF8Width() instead of the old byte-per-char path
  • overrode translateUTF8ToBlocks() to just pass the string through unchanged, since the display can render it properly now and doesn't need the block-character fallback
  • fixed drawXbm() along the way - the icon/logo bitmaps in this codebase are packed MSB-first (Adafruit_GFX::drawBitmap() convention), but U8g2's own drawXBM() expects LSB-first, so icons came out completely garbled until I switched to U8g2's u8glib-compatible drawBitmap() instead, which uses the same MSB-first order

SH1106Display is shared by 7 boards (nano_g2_ultra, thinknode_m2, station_g2, wio-tracker-l1, lilygo_tbeam_1w, station_g3_esp32, lilygo_tbeam_supreme_SX1262), swapped the SH110X/GFX lib_deps for U8g2 on all of them. Built all 7 clean. Actually flash-tested on Wio Tracker L1 Pro and T-Beam Supreme since that's what I have on hand - confirmed Cyrillic text renders correctly (including a real message received over a channel), icons render correctly, and existing Latin-script screens still look right.

Not in scope here: long messages still don't wrap or scroll on this display, that's a separate thing I'll follow up with once this lands.

Switches SH1106Display from Adafruit_SH110X/GFX to U8g2 so it can
render Cyrillic (and other non-Latin UTF-8) text instead of falling
back to block characters. Continues the still-open meshcore-dev#1439, where the
author got SSD1306 working but had no SH1106 hardware to test against.

Also fixes drawXbm(): icon/logo bitmaps in this codebase are packed
MSB-first (Adafruit_GFX::drawBitmap() convention), but U8g2's own
drawXBM() expects LSB-first, so icons came out garbled until switched
to U8g2's u8glib-compatible drawBitmap(), which uses the same
MSB-first order.

SH1106Display is shared by 7 boards; swapped their SH110X/GFX lib_deps
for U8g2. Flash-tested on Wio Tracker L1 Pro and T-Beam Supreme.
@strasharo

Copy link
Copy Markdown
Author

Closing this for now - found a cleaner way to do this (wrapping the existing Adafruit_GFX driver with U8g2_for_Adafruit_GFX instead of swapping the whole rendering backend), going to rework it that way instead. Will open a new PR once it's ready.

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.

1 participant