Skip to content
Draft
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9cb0d55
Add small 5x3 font
ItRainsSmiles Aug 20, 2023
698f4b2
Added support for large fonts.
Aug 16, 2023
326d6ab
Changes requested before pull request can get merged.
pwasmund Aug 24, 2023
1c2ddf1
basic integration of additional fronts from upstream PRs
softhack007 Nov 21, 2025
2701ec8
font integration step 2: register with getFontInfo
softhack007 Nov 21, 2025
c1a5df4
font integration step 3: drawText support for multi-byte rows
softhack007 Nov 21, 2025
6cfa1ee
fix name clash in drawCharacter
softhack007 Nov 21, 2025
a7da43f
correction for byte index calculation
softhack007 Nov 21, 2025
57bf5ee
second fix for pixel offset in drawCharacter
softhack007 Nov 21, 2025
6d1f36d
third fix for drawCharacter 🫣
softhack007 Nov 21, 2025
b9a0317
guess what
softhack007 Nov 21, 2025
0897ad9
errm ... yes
softhack007 Nov 21, 2025
37eb0ae
fix shift overflow when width = 8
softhack007 Nov 21, 2025
e257842
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 22, 2025
37889f1
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 23, 2025
8144ea1
preliminary: large font integration into scrolling text
softhack007 Nov 23, 2025
3a3ad71
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 23, 2025
ef3df30
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 24, 2025
4df4440
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 24, 2025
4e45456
goodbye, esp01.
softhack007 Nov 24, 2025
4df2be4
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 24, 2025
3bc5d5b
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 25, 2025
aabacdc
fix failed athome_music build
softhack007 Nov 25, 2025
1971b6d
disable ARDUINOJSON_DECODE_UNICODE when WLEDMM_SAVE_FLASH
softhack007 Nov 25, 2025
7e34007
Merge branch 'mdev' into more_fonts_backport
softhack007 Nov 25, 2025
2f1ff72
drawCharacter rewrite
softhack007 Nov 25, 2025
b3712f5
bugfix
softhack007 Nov 26, 2025
d315626
remove unneeded cast
softhack007 Nov 26, 2025
abc90e9
text rotation support, WLEDMM style
softhack007 Nov 26, 2025
a5444bb
improved and very fast map()
softhack007 Nov 26, 2025
215a4bc
Merge branch 'mdev' into more_fonts_backport
softhack007 Dec 1, 2025
196f94e
Merge branch 'mdev' into more_fonts_backport
softhack007 Dec 3, 2025
a54c608
Merge branch 'mdev' into more_fonts_backport
softhack007 Dec 16, 2025
56127e8
Merge branch 'mdev' into more_fonts_backport
softhack007 Dec 16, 2025
967aada
Merge branch 'mdev' into more_fonts_backport
softhack007 Dec 17, 2025
7b7f558
Merge branch 'mdev' into more_fonts_backport
softhack007 Dec 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ default_envs =
esp8266_4MB_M
; esp8266pro_16MB_S
esp8266pro_16MB_M
esp01_1MB_S
;; esp01_1MB_S ;; dead - firmware too big for 1MB flash
;;
athom_music_esp32_4MB_M
adafruit_matrixportal_esp32s3_tinyUF2 ;; HUB75 supported, uses adafruit bootloader
Expand Down Expand Up @@ -1704,8 +1704,8 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_OTA
-D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash size limit
-D WLED_DISABLE_PARTICLESYSTEM2D ;; exceeds flash size limit
-D WLEDMM_SAVE_FLASH
;; -D WLED_DISABLE_LOXONE
;; -D WLED_DISABLE_MQTT
-D WLED_DISABLE_LOXONE
-D WLED_DISABLE_MQTT
;; -D WLED_DISABLE_2D ;; last resort to reduce flash size
lib_deps = ${esp8266.lib_deps}
lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation
Expand Down Expand Up @@ -1834,6 +1834,7 @@ lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compila
board_build.partitions = ${esp32.big_partitions}
board_build.f_flash = 80000000L ; use full 80MHz speed for flash (default = 40Mhz)
board_build.flash_mode = qio ; (dio = dual i/o; more compatible than qio = quad i/o)
monitor_filters = esp32_exception_decoder
; RAM: [== ] 23.7% (used 77720 bytes from 327680 bytes)
; Flash: [========= ] 93.1% (used 1768897 bytes from 1900544 bytes)

Expand Down Expand Up @@ -2180,6 +2181,7 @@ lib_deps = ${esp32s3.lib_deps} ${common_mm.lib_deps_S} ${common_mm.lib_deps_V4_
board_build.partitions = tools/WLED_ESP32_8MB.csv
; RAM: [== ] 21.1% (used 69156 bytes from 327680 bytes)
; Flash: [======== ] 75.9% (used 1591817 bytes from 2097152 bytes)
monitor_filters = esp32_exception_decoder

[env:esp32S3_8MB_S]
;; MM for ESP32-S3 boards - FASTPATH + optimize for speed; ; HUB75 support included (may still have pin conflicts)
Expand Down Expand Up @@ -2869,7 +2871,8 @@ build_unflags = ${esp32_legacy.build_unflags}
-D USERMOD_ARTIFX ;; disabled to save some program space in flash
-D USERMOD_DALLASTEMPERATURE ;; disabled - flash space is too tight for this
-D USERMOD_ROTARY_ENCODER_UI ;; see above
${common_mm.DMXin_build_flags}
${common_mm.DMXin_build_flags} ;; no pins
${common_mm.HUB75_build_flags} ;; no pins for HUB75
build_flags = ${esp32_4MB_M_base.build_flags}
${Athom_PDMmic.build_flags}
-D WLED_AP_SSID_UNIQUE
Expand All @@ -2889,8 +2892,10 @@ build_flags = ${esp32_4MB_M_base.build_flags}
; -D PWM_PIN=-1
; -D WLED_USE_MY_CONFIG
-D WLEDMM_SAVE_FLASH
-D WLED_DISABLE_PARTICLESYSTEM1D ;; exceeds flash limit
lib_ignore = ${esp32_4MB_M_base.lib_ignore}
${common_mm.DMXin_lib_ignore}
${common_mm.HUB75_lib_ignore}
; RAM: [=== ] 26.3% (used 86204 bytes from 327680 bytes)
; Flash: [========= ] 93.6% (used 1471681 bytes from 1572864 bytes)

Expand Down
45 changes: 44 additions & 1 deletion wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6790,6 +6790,13 @@ uint16_t mode_2Dfloatingblobs(void) {
static const char _data_FX_MODE_2DBLOBS[] PROGMEM = "Blobs@!,# blobs,Blur;!;!;2;c1=8";


// preliminary - for testing
#define WLED_ENABLE_TINY_FONT
#define WLED_ENABLE_LARGE_FONTS
#if defined(ARDUINO_ARCH_ESP32) && !defined(WLEDMM_SAVE_FLASH)
#define WLED_ENABLE_XXXL_FONT
#endif

////////////////////////////
// 2D Scrolling text //
////////////////////////////
Expand All @@ -6805,6 +6812,7 @@ uint16_t mode_2Dscrollingtext(void) {

int letterWidth;
int letterHeight;
#if 0 // legacy
switch (map(SEGMENT.custom2, 0, 255, 1, 5)) {
default:
case 1: letterWidth = 4; letterHeight = 6; break;
Expand All @@ -6813,7 +6821,42 @@ uint16_t mode_2Dscrollingtext(void) {
case 4: letterWidth = 7; letterHeight = 9; break;
case 5: letterWidth = 5; letterHeight = 12; break;
}
const int yoffset = map(SEGMENT.intensity, 0, 255, -rows/2, rows/2) + (rows-letterHeight)/2;
#else

unsigned max_font = 5; // legacy: 0..5
#ifdef WLED_ENABLE_LARGE_FONTS
max_font += 3; // 3 more
#endif
#ifdef WLED_ENABLE_XXXL_FONT
max_font += 1; // 1 more
#endif

switch (map2(SEGMENT.custom2, 0, 255, 0, max_font)) {
case 0:
#ifdef WLED_ENABLE_TINY_FONT
letterWidth = 3; letterHeight = 5; break; // tiny 3x5 font (reduced)
#endif
case 1: letterWidth = 4; letterHeight = 6; break;
case 2: letterWidth = 5; letterHeight = 8; break;
case 3: letterWidth = 6; letterHeight = 8; break;
case 4: letterWidth = 7; letterHeight = 9; break;
default:
case 5: letterWidth = 5; letterHeight = 12; break;
#ifdef WLED_ENABLE_LARGE_FONTS
case 6: letterWidth =12; letterHeight = 16; break; // 12x16 font
case 7: letterWidth =12; letterHeight = 24; break; // 12x24 font
case 8: letterWidth =16; letterHeight = 32; break; // 16x32 font
#endif
#if defined(WLED_ENABLE_XXXL_FONT) && defined(WLED_ENABLE_LARGE_FONTS)
case 9: letterWidth =25; letterHeight = 57; break; // 25x57 font
#endif
#if defined(WLED_ENABLE_XXXL_FONT) && !defined(WLED_ENABLE_LARGE_FONTS)
case 6: letterWidth =25; letterHeight = 57; break; // 25x57 font
#endif
}
#endif

const int yoffset = map2(SEGMENT.intensity, 0, 255, -rows/2, rows/2) + (rows-letterHeight)/2;
char text[WLED_MAX_SEGNAME_LEN+1] = {'\0'};
unsigned maxLen = (SEGMENT.name) ? min(WLED_MAX_SEGNAME_LEN, (int)strlen(SEGMENT.name)) : 0; // WLEDMM make it robust against too long segment names

Expand Down
28 changes: 17 additions & 11 deletions wled00/FX_2Dfcn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,7 @@ void Segment::drawText(const unsigned char* text, size_t maxLen, int16_t x, int1

#if defined(WLED_ENABLE_FULL_FONTS)
FontInfo_t font = getFontInfo(w, h); // use central font selection legic
if (font.raw == nullptr) return; // font invalid or not found
uint16_t decoded_text[WLED_MAX_SEGNAME_LEN+1] = { 0 }; // UTF-16 converted text. Cannot be longer than WLED_MAX_SEGNAME_LEN
size_t utf16_index = 0;
for(const unsigned char* now = text; now != nullptr && now[0] != '\0'; now = nextUnicode(now, maxLen)) {
Expand Down Expand Up @@ -919,7 +920,9 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
const uint16_t cols = virtualWidth();
const uint16_t rows = virtualHeight();
FontInfo_t font = getFontInfo(w, h); // use central font selection logic
if (!font.isProgMem || font.width_bytes > 1) return; // do nothing for not (yet) supported font features: width_bytes > 1, !isProgMem
if (font.raw == nullptr) return; // font invalid or not found
//if (!font.isProgMem || font.width_bytes > 1) return;
if (!font.isProgMem) return; // do nothing for not (yet) supported font features: !isProgMem
if (chr < font.firstChar || chr > font.lastChar) return; // do nothing when out of limits
chr = chr - font.firstChar; // adjust chr to point to the first allowed character byte

Expand All @@ -928,39 +931,42 @@ void Segment::drawCharacter(unsigned char chr, int16_t x, int16_t y, uint8_t w,
uint32_t bgCol = SEGCOLOR(1);

//if (w<5 || w>6 || h!=8) return;
if (drawShadow) w++; // one more column for shadow on right side
if (drawShadow && ((w % 8) != 0)) w++; // one more column for shadow on right side
for (int i = 0; i<h; i++) { // // paint character - top down by row (height)
int y0 = y + i;
if (y0 < 0) continue; // drawing off-screen
if (y0 >= rows) break; // drawing off-screen
uint8_t bits = 0;
uint8_t bits_up = 0; // WLEDMM this is the previous line: font[(chr * h) + i -1]

// for wide fonts, we can add a loop here :for(offset=0, offset < font.width_bytes; offset++) {}
for(int xoffset=0; xoffset < font.width_bytes; xoffset++) { // handle wide fonts
int pixels_offset = xoffset * 8; // pixel offset inside row -> 8 bits per byte

// get 8 pixels (byte) from raw font data
bits = pgm_read_byte_near(&font.raw[(chr * h) + i]);
if ((i>0) && drawShadow) bits_up = pgm_read_byte_near(&font.raw[(chr * h) + i -1]);
bits = pgm_read_byte_near(&font.raw[(chr * h*font.width_bytes) + i*font.width_bytes + xoffset]);
if ((i>0) && drawShadow) bits_up = pgm_read_byte_near(&font.raw[(chr * h*font.width_bytes) + i*font.width_bytes + xoffset -font.width_bytes]);

if (col2 != BLACK) col = ColorFromPalette(grad, (i+1)*255/h, 255, NOBLEND);
uint32_t fgCol = uint32_t(col) & 0x00FFFFFF; // WLEDMM cache color value

for (int j = 0; j<w; j++) { // paint character - single row of pixels (width)
int x0 = x + (w-1) - j;
int numBits = (xoffset+1 < font.width_bytes) ? 8: (w - 8*(font.width_bytes-1) ); // 8 for full bytes, remaining bits for last partial byte
for (int j = 0; j<numBits; j++) { // paint character - single row of pixels (width)
int x0 = x + (numBits-1) - j + pixels_offset;
if (unsigned(x0) < cols) { // WLEDMM same as "x0 > 0 && x0 < cols"
if ((bits>>(j+(8-w))) & 0x01) { // bit set & drawing on-screen
if ((bits>>(j+(8-numBits))) & 0x01) { // bit set & drawing on-screen
setPixelColorXY(x0, y0, fgCol);
} else {
if (drawShadow) {
// WLEDMM
if ((j < (w-1)) && (bits>>(j+(8-w) +1)) & 0x01) setPixelColorXY(x0, y0, bgCol); // blank when pixel to the right is set
else if ((j > 0) && (bits>>(j+(8-w) -1)) & 0x01) setPixelColorXY(x0, y0, bgCol);// blank when pixel to the left is set
else if ((bits_up>>(j+(8-w))) & 0x01) setPixelColorXY(x0, y0, bgCol); // blank when pixel above is set
if ((j < (numBits-1)) && (bits>>(j+(8-numBits) +1)) & 0x01) setPixelColorXY(x0, y0, bgCol); // blank when pixel to the right is set
else if ((j > 0) && (bits>>(j+(8-numBits) -1)) & 0x01) setPixelColorXY(x0, y0, bgCol);// blank when pixel to the left is set
else if ((bits_up>>(j+(8-numBits))) & 0x01) setPixelColorXY(x0, y0, bgCol); // blank when pixel above is set
}
}
}
}
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
softhack007 marked this conversation as resolved.
}

#define WU_WEIGHT(a,b) ((uint8_t) (((a)*(b)+(a)+(b))>>8))
Expand Down
Loading