-
Notifications
You must be signed in to change notification settings - Fork 4
cyrillic support
Unified Cyrillic support for all GFX-compatible displays in companion-radio builds, enabled via the compile flag -D CYRILLIC_SUPPORT=1. All changes are conditional (#ifdef CYRILLIC_SUPPORT) — behavior without the flag is unchanged.
| File | Description |
|---|---|
src/helpers/ui/OLEDDisplayFontsRU.cpp/.h |
ArialMT 10/16/24 fonts with Cyrillic glyphs (CP1251, 224 characters) |
src/helpers/ui/glcdfont6x8.h |
Monospace 6×8 font with Cyrillic glyphs for GFX displays |
- Added fields
_font_sizeand_cursor_y_rawto the base class (only whenCYRILLIC_SUPPORTis defined). -
printWordWrap()gained a built-in word-wrap implementation for the monospace 6×8 font:- splits the string into segments of
max_width / (6 * _font_size)characters, - prefers breaking on a space,
- tracks
_cursor_y_rawfor line positioning.
- splits the string into segments of
-
translateUTF8ToBlocks()expanded to a full UTF-8 → CP1251 converter:- lead bytes
0xD0/0xD1→ А–Я, а–я, -
0xD0/129→ Ё,0xD1/145→ ё, Ukrainian Є/І/Ї/Ґ, - unknown non-ASCII →
0xAE(placeholder®in CP1251). - Without the flag, behavior is unchanged: non-ASCII →
0xDB(block █ in CP437).
- lead bytes
-
drawStringInternal(): whenCYRILLIC_SUPPORTis defined, disables the library's internal UTF-8 rendering (utf8 = false) — the string is already in CP1251. -
drawStringMaxWidth(): whenCYRILLIC_SUPPORTis defined, uses the byte directly instead offontTableLookupFunction. -
OLEDDisplay.h: includesOLEDDisplayFontsRU.h.
The same pattern is applied to all files listed below:
| File | Display |
|---|---|
src/helpers/ui/ST7789Display.cpp |
Heltec T114 (ST7789) |
src/helpers/ui/E213Display.cpp |
E-ink 2.13" |
src/helpers/ui/E290Display.cpp |
E-ink 2.90" |
src/helpers/ui/GxEPDDisplay.cpp |
GxEPD-compatible e-ink |
src/helpers/ui/SH1106Display.cpp |
SH1106 OLED |
src/helpers/ui/SSD1306Display.cpp |
SSD1306 OLED |
src/helpers/ui/ST7735Display.cpp |
ST7735 TFT |
src/helpers/ui/ST7789LCDDisplay.cpp |
ST7789 LCD |
Change pattern in each file:
-
#include "glcdfont6x8.h"(orOLEDDisplayFontsRU.hfor SSD1306). - In the display initializer:
display->setFont(&glcdfont6x8)(or the corresponding RU font). -
setTextSize(sz): stores_font_size = sz. -
setCursor(x, y): stores_cursor_y_raw = y; adds the GFXfont baseline offset(_font_size * 7)so that calling code can use top-left coordinates.
The flag has been added to all companion-radio configurations for the following variants:
ebyte_eora_s3, gat562_30s_mesh_kit, gat562_mesh_tracker_pro, heltec_e213, heltec_e290, heltec_t114, heltec_tracker, heltec_tracker_v2, heltec_v2, heltec_v3 (3 configurations), heltec_v4, heltec_wireless_paper, ikoka_handheld_nrf, ikoka_stick_nrf, keepteen_lt1, lilygo_t3s3, lilygo_t3s3_sx1276, lilygo_tbeam_1w, lilygo_tbeam_SX1262, lilygo_tbeam_SX1276, lilygo_tbeam_supreme_SX1262, lilygo_tdeck, lilygo_techo, lilygo_techo_lite, lilygo_tlora_v2_1, mesh_pocket, meshadventurer, meshtiny, nano_g2_ultra, nibble_screen_connect, promicro, rak3401, rak4631, station_g2, thinknode_m1, thinknode_m2, thinknode_m5, wio-tracker-l1-eink, wio-tracker-l1, xiao_s3_wio.
Единая поддержка кириллицы для всех GFX-совместимых дисплеев companion-radio сборок через компилируемый флаг -D CYRILLIC_SUPPORT=1. Все изменения условны (#ifdef CYRILLIC_SUPPORT) — поведение без флага не меняется.
| Файл | Описание |
|---|---|
src/helpers/ui/OLEDDisplayFontsRU.cpp/.h |
Шрифты ArialMT 10/16/24 с кириллическими глифами (CP1251, 224 символа) |
src/helpers/ui/glcdfont6x8.h |
Моноширинный шрифт 6×8 с кириллическими глифами для GFX-дисплеев |
- Добавлены поля
_font_sizeи_cursor_y_rawв базовый класс (только приCYRILLIC_SUPPORT). -
printWordWrap()получила встроенную реализацию переноса по словам для моноширинного шрифта 6×8:- разбивает строку на отрезки по
max_width / (6 * _font_size)символов, - предпочитает разрывать по пробелу,
- отслеживает
_cursor_y_rawдля позиционирования строк.
- разбивает строку на отрезки по
-
translateUTF8ToBlocks()расширена до полноценного конвертера UTF-8 → CP1251:- lead-bytes
0xD0/0xD1→ А–Я, а–я, -
0xD0/129→ Ё,0xD1/145→ ё, украинские Є/І/Ї/Ґ, - неизвестные non-ASCII →
0xAE(заглушка®в CP1251). - Без флага поведение прежнее: non-ASCII →
0xDB(блок █ CP437).
- lead-bytes
-
drawStringInternal(): приCYRILLIC_SUPPORTотключает внутренний UTF-8 рендеринг библиотеки (utf8 = false) — строка уже в CP1251. -
drawStringMaxWidth(): приCYRILLIC_SUPPORTиспользует байт напрямую вместоfontTableLookupFunction. -
OLEDDisplay.h: подключаетOLEDDisplayFontsRU.h.
Единообразный паттерн применён ко всем перечисленным файлам:
| Файл | Дисплей |
|---|---|
src/helpers/ui/ST7789Display.cpp |
Heltec T114 (ST7789) |
src/helpers/ui/E213Display.cpp |
E-ink 2.13" |
src/helpers/ui/E290Display.cpp |
E-ink 2.90" |
src/helpers/ui/GxEPDDisplay.cpp |
GxEPD-совместимые e-ink |
src/helpers/ui/SH1106Display.cpp |
SH1106 OLED |
src/helpers/ui/SSD1306Display.cpp |
SSD1306 OLED |
src/helpers/ui/ST7735Display.cpp |
ST7735 TFT |
src/helpers/ui/ST7789LCDDisplay.cpp |
ST7789 LCD |
Паттерн изменений в каждом:
-
#include "glcdfont6x8.h"(илиOLEDDisplayFontsRU.hдля SSD1306). - В инициализаторе дисплея:
display->setFont(&glcdfont6x8)(или соответствующий RU-шрифт). -
setTextSize(sz): сохраняет_font_size = sz. -
setCursor(x, y): сохраняет_cursor_y_raw = y; добавляет смещение базовой линии GFXfont(_font_size * 7)чтобы вызывающий код мог использовать координаты левого верхнего угла.
Флаг добавлен в все companion-radio конфигурации следующих вариантов:
ebyte_eora_s3, gat562_30s_mesh_kit, gat562_mesh_tracker_pro, heltec_e213, heltec_e290, heltec_t114, heltec_tracker, heltec_tracker_v2, heltec_v2, heltec_v3 (3 конфигурации), heltec_v4, heltec_wireless_paper, ikoka_handheld_nrf, ikoka_stick_nrf, keepteen_lt1, lilygo_t3s3, lilygo_t3s3_sx1276, lilygo_tbeam_1w, lilygo_tbeam_SX1262, lilygo_tbeam_SX1276, lilygo_tbeam_supreme_SX1262, lilygo_tdeck, lilygo_techo, lilygo_techo_lite, lilygo_tlora_v2_1, mesh_pocket, meshadventurer, meshtiny, nano_g2_ultra, nibble_screen_connect, promicro, rak3401, rak4631, station_g2, thinknode_m1, thinknode_m2, thinknode_m5, wio-tracker-l1-eink, wio-tracker-l1, xiao_s3_wio.