You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cyrilyc font 6x8, and special character support for scrolling text #5101
Good day, gentlemen! I'm trying to edit a 6x8 font file to add Cyrillic letters in scrolling text mode. I followed the instructions on the official website, but the project won't compile in VS Code, and I'm getting a ton of errors when selecting the board. I have zero programming experience. Could anyone help me with this? Thanks in advance.
@bsveselov-rgb will your cyrilic letters replace the normal "roman" ASCII 32 thru 127 ?
currently WLED scrolling text does not support unicode, or any other extended character set. For example, not even the German "Umlaut" letters (äöüÄÖÜß) are supported. Same for other writing system like Greek, Arabic, Hebrew, Hindi, Korean, Chinese, Japanese, Cyrilic, Emoji, etc.
This was a design decision, to cope with limited Flash memory.
Yes. I need a version with only the Cyrillic font. After consulting DeepSeek and reading, I found a font with 6x8 Cyrillic characters. Is it possible to compile the firmware with just one font version, for example?
by exchanging all "roman" letters like 'A' with a Cyrillic letter (bitmap encoded in bytes), one by one.
I don't know how a cycilic keyboard works - does it produce ASCII codes below 126?
It might still not lead to the expected result when you use the keyboard to type messages - maybe you'll have to "encode" each cyrilic character of the text manually, letter-by-letter.
Yes, I understood that and found the necessary code for the characters. Here's an example:
// А (0xC0)
PS: maybe you still did not do it right 🤔
as I said, you cannot "add" the cyrilic letters at their ASCII position (here: 0xC0) because WLED scrolling text only accepts letters up to ASCII 126 = 0x7E . It means that you must replace roman letters, for example exchange the bytes for "B" (0x42) with the bytes to draw "Б".
There are of course a lot of "known unknowns" - for example I'm not sure if the esp32 framework already provides something to convert UTF-8 strings to CP437 strings. Finding Font files for other codepages might be a big challenge, and it is not clear if extra font files would ever be integrated into the main WLED codebase. Full codepage support would always be optional (custom build_flags), because localized fonts will increase firmware size considerably.
Btw, 8266 will probably never have this feature, due to 8266 firmware size limits. But I could image a solution for esp32 boards with at least 8MB flash.
@softhack007 I've already recommended that someone implements loading font files (binary or JSON or whatever) from file system. That would allow anyone to upload custom font without the need for custom compiling.
However, that feature might be only feasible on ESP32 (and variants) as ESP8266 lacks free RAM for font data.
I do not think implementing full Unicode support is feasible but a font file might allow this (at the cost of accessing flash during effect drawing).
I've already recommended that someone implements loading font files (binary or JSON or whatever) from file system. That would allow anyone to upload custom font without the need for custom compiling.
I just had the same thought and ran a quick test to see if it can be read directly from the file, well it can't. Opening a file and reading a few bytes then closing takes 25ms... BUT if the file is kept open, the access is very fast, 100us or so. littleFS allows for multiple files to be open, I checket up to 4 without issues, if this also works on ESP8266 then there is no need to load it to RAM.
edit: accessing 4 files in parallel also works on ESP8266, it is a bit slower though, reading 10 bytes per pass takes 270us, still more than fast enough so this appraoch would be feasible.
@DedeHai so for the full picture, we'd need a string conversion from UTF-8 (or unicode?) to codepage xyz encoding, to have an index for the font tables ... any ideas?
edit: for boards with PSRAM, we could even load the font files into PSRAM for caching.
I already have it sketched out in my head, something like this:
pack the chars as bits, padded to full bytes for easier access, so a 7x9 char would be 8 bytes (63bits plus one padding bit) instead of the currently use 9 bytes.
to keep it simple: the first three bytes in the font file describe the font format, first byte is the bits-per-char, second is the start offset, third is the end of the table.
so a "greek only font" without fancy stuff would start somewhere around char 164 and end at char 238 but nothing sais it cannot be a full 0-255 ASCII table supporting all chars, including numbers.
the naming could be to replace the current 5 fonts as overrides, font1.fnt to font5.fnt. it would in theory also allow for fonts with much larger chars for HUB75, the limit would onyl be the access time to read the chars but it is quite fast, less than 10us per byte.
edit: actually the limit would be 256bits per char unless we make that header 4 bytes, which would be reasonable I guess.
edit2: now that I think about it, it really makes little sense to not always start a font at char 0, since it's stored in FS we can spare a few hundred extra bytes to keep the fonts simple and more universal for users. If a font does not contain the extended chars > 127, the file read at that position will just fail, so should be easy to catch.
edit3: forgot we need width and height of a char, so header would be 2 bytes for width and height. To support all languages, we'd need UTF-8 suport which I dont think is feasible with reasonable effort.
@DedeHai so we would still need a way to convert unicode (UTF-8) - which is used by the WebUI when you name your segment in greek, or even you name it "schöne Grüße aus Grønland 👋 ", into the "codepage" that's used by your font file. Of course some unicode chars will not be supported by the font. However some basic unicode parser / translator would be necessary to pick the right character to display.
To support all languages, we'd need UTF-8 suport which I dont think is feasible with reasonable effort.
A possible solution for the "codepage mapping" might be to translate UTF-8 into UTF-16 (aka UCS-2), which covers almost any letter supported by UTF-8 but always needs two bytes per letter - if we forget about the 4-byte variable codes for exotic stuff.
Codes < 127 are always ASCII codes, so no mapping needed for roman letters, numbers etc.
Font file: for all "characters" > 126, add two bytes which indicate the UTF-16 code for the letter or symbol (might be replaced with a generic UTF16-to-codepage_xyz translation list for all user fonts)
WLED translates the segment name from UTF-8 into UTF-16 (straight forward, no LUT involved)
if UTF16_index < 127 --> display font[UTF16_index]
if UTF16_index >= 127 -> scan the font until we find font[x].utf16 == UTF16_index --> display if found, show " " otherwise
The whole process could be accelerated if we can build a translation table in RAM.
Some magic python script could generate the font file, and generate UTF-16 indices when needed.
Loading font data from files would be a great effort. It could also enable flexible font widths, different font styles etc. With these easily editable files it would also be possible to replace certain characters with custom ones.
Some time a ago I wrote some lines and referenced the MD_Parola library also using font files: #3071 is also mentioning some other ideas for scrolling text.
The UTF8 conversion can be done like this: https://forum.arduino.cc.....
Font file: for all "characters" > 126, add two bytes which indicate the UTF-16 code for the letter or symbol (might be replaced with a generic UTF16-to-codepage_xyz translation list for all user fonts)
will this work both ways? the text is stored in preset as segment name.
will this work both ways? the text is stored in preset as segment name.
I think it will work. Most likely we don't even recognise that presets and segment names are already UTF-8, because when you enter a string in the webUI, it will arrive in WLED as unicode (UTF-8), and the same string (even when handled as char *) sent back to the UI will be decoded as UTF-8. That's why people can already use greek letters or emoji as segment names.
Actually for Font rendering in scrolling text, only the "forward" direction will be needed because we can do it without modifying seg.name.
new function: DrawString receives the segment name as input
-> copy seg.name to temporary string for conversion
-> convert to UTF-16, but skip "extended codes" which require more than 2 bytes (extended = emoji and other funstuff)
-> new function byte UTF16_to_FontChar(uint16_t wchar, font&) --> convert to font -specific byte_index
-> draw font[byte_index]
for the first shot, we can have a static conversion (switch-case) in UTF16_to_FontChar that maps UTF-16 to a codepage (like CP437) used by the font. The wikipedia CP437 page has all the unicode codes needed for this CP437 translation, so I can grab them and directly generate case codepoint_abcd: return index_xyz; break; with a simple shell script.
In general there seems to be some C++ standard template class that can do the conversion, but I did not look deeper into that.
Edit: just did a quick check (WLED-MM but should be the same in upstream): yes unicode can be entered in in segment name (WebUI), its properly saved in presets.json, and properly displayed when you load a preset.
conclusion: unicode already works in WLED, we just did not notice it ;-)
The rabbit has created a nice flowchart for the "simplified" UTF8 - to DrawCharacter flow --> working on it, so we can build on something and extend the idea with custom font loading, custom codepages, etc.
sequenceDiagram
autonumber
participant App as Application (drawCharacter)
participant UTF8 as UTF-8 input
participant U16 as unicodeToWchar16()
participant CP437 as wchar16ToCodepage437()
participant Font as console_font_4x6
Note over App,Font: New optional full-font flow (WLED_ENABLE_FULL_FONTS)
App->>UTF8: provide UTF-8 string
UTF8->>U16: unicodeToWchar16(utf8)
U16-->>CP437: returns uint16_t codepoint
CP437->>CP437: map codepoint -> CP437 byte (switch table)
CP437-->>App: CP437 byte
App->>Font: index glyph using CP437 byte
Font-->>App: glyph bitmap
Loading
only one thing missing: instead of DrawCharacter, the scrolling text has to call a new method DrawText, and pass the complete segment name string for UTF-8 decoding.
You might want to "hold your horses" about flexible width glyphs, though. We are still on "fixed with", however it would be possible in future to calculate the real width of each glyph, and advance the next drawing position based on this. Actually that's a "third topic" - in addition to font file loading, and (limited) unicode support.
I have made significant progress in this. all the ground work is done, I have first light for a font with variable glyph width loaded from a file, still not using the variable width though as that needs some more restructuring. I also added utf8 support, but I still need to test if that actually works. will keep you posted.
its currently not very fast though, especially when running multiple segments FPS drop below 20 but on a single segment it runs at like 50fps without any glyph cache, i.e. each frame is constructed directly from the file.
edit: PSRAM would really help, could load the whole font into ram. lots of room for optimization later on.
For utf-8 (unicode) support you can take a side-look at WLED-MM: it took me some time to get the unicode decoding right, as there are many special and errors cases to consider.
@softhack007 that is A LOT of code, I took a much simpler approach but still need to test it, my version of utf8 decoder is less than 20 lines of code, I checked only a few chars and it was correct, still need to check more though. I also defined a new font format that is very similar to what you did, still need to work out a clever way to parse and store the info. As I am sick in bed I do some vibe coding of a font conversion tool whenever I feel well enough. If everything works out as I have it sketched in my mind, its going to be awesome and very user friendly: load any font (ttf, otf, woff) adjust 3 sliders to rasterize it to any size you like (already works quite well), choose what extension (if any) you want for 128-255 chars, export it as a binary file, upload to wled file system. then load it in scrolling text (proof of concept done).
edit:
once I have it working I will do a draft PR for review and working out the details.
@softhack007 that is A LOT of code, I took a much simpler approach but still need to test it, my version of utf8 decoder is less than 20 lines of code
@DedeHai agreed that my version is a bit over-engineered, especially I tried to also catch common "unicode exploits" - this includes nasty cases like overlong encodings, surrogate pairs and "continuation followed by \0". This means i had to be careful about using "strlen" because strlen may not tell the complete truth.
You may also need a special unicode-aware "strlen" variant, see nextUnicode() and strlenUC() in my code.
The core function is 30 lines of code (unicodeToWchar16()) plus a few more lines for the codepage lookup table - implemented as a switch-case for best efficiency and to avoid having the table in RAM.
I think the core of my idea is the right way; strings in the UI - like segment names - are already in utf-8 so we only need to
convert string to utf-16
convert utf-16 to font glyph (codepage table)
adjust some code that "shortens" the segment name - you cannot cut the string everywhere, but only between two utf-8 entities.
If you proceed with your new font loading code, maybe we can plug-in my unicodeToWchar16() function, its completely standalone.
check if any of the three "extension" bits is set. if so, check if enough chars are still available and then assume that its encoded correctly - if not it will return a bogus value and fail the lookup i.e. simply wont render.
I already realized I need a "strlenutf8" function and have it implemented (also not tested but it's simple enough)
my font format actually "encodes" the codepage quite simply and very flexible: in the header it has a 32bit offset, glyphs 127-255 (or 128, not decided yet as 127 is "del" and could be used as an extra glyph) will hold glyphs from offset (inclusive) to offset +128 (or +127). now checking if the requested unicode is in the font is simple.
the "WLED Font Factory" takes care of the rest. Select a font, select code table extension (or go custom offset, 0x2200 will encode math symbols for example) and save it. Any (utf8)char that is in the font will render. no codepage lookup needed.
ok got a proof of concept hack working, displaying Cyrilic font from a custom font file. so my UTF8 stuff seems correct. now comes the tedious part of making it work without hacking ;)
Activity
softhack007 commentedon Nov 18, 2025
@bsveselov-rgb will your cyrilic letters replace the normal "roman" ASCII 32 thru 127 ?
currently WLED scrolling text does not support unicode, or any other extended character set. For example, not even the German "Umlaut" letters (äöüÄÖÜß) are supported. Same for other writing system like Greek, Arabic, Hebrew, Hindi, Korean, Chinese, Japanese, Cyrilic, Emoji, etc.
This was a design decision, to cope with limited Flash memory.
bsveselov-rgb commentedon Nov 18, 2025
Yes. I need a version with only the Cyrillic font. After consulting DeepSeek and reading, I found a font with 6x8 Cyrillic characters. Is it possible to compile the firmware with just one font version, for example?
softhack007 commentedon Nov 18, 2025
you would need to replace the content of wled00/src/font/console_font_6x8.h
WLED/wled00/src/font/console_font_6x8.h
Lines 788 to 798 in aaad450
by exchanging all "roman" letters like 'A' with a Cyrillic letter (bitmap encoded in bytes), one by one.
I don't know how a cycilic keyboard works - does it produce ASCII codes below 126?
It might still not lead to the expected result when you use the keyboard to type messages - maybe you'll have to "encode" each cyrilic character of the text manually, letter-by-letter.
bsveselov-rgb commentedon Nov 18, 2025
Yes, I understood that and found the necessary code for the characters. Here's an example:
The problem is, I can't compile the bin file for the firmware. Can I ask you for help by posting or sending the code for the Cyrillic characters?
softhack007 commentedon Nov 18, 2025
sorry, not myself - I'm too busy with other stuff atm :-(
But you can ask on discord, where we have a very active user community and lots of people who are ready to help others with their projects
Join the Discord server to discuss everything about WLED!
softhack007 commentedon Nov 18, 2025
PS: maybe you still did not do it right 🤔
as I said, you cannot "add" the cyrilic letters at their ASCII position (here: 0xC0) because WLED scrolling text only accepts letters up to ASCII 126 = 0x7E . It means that you must replace roman letters, for example exchange the bytes for "B" (0x42) with the bytes to draw "Б".
softhack007 commentedon Nov 18, 2025
Just for the curious - i've made a rough overview of what would be needed to support the full CP437, and later even add fonts for other codepages
There are of course a lot of "known unknowns" - for example I'm not sure if the esp32 framework already provides something to convert UTF-8 strings to CP437 strings. Finding Font files for other codepages might be a big challenge, and it is not clear if extra font files would ever be integrated into the main WLED codebase. Full codepage support would always be optional (custom build_flags), because localized fonts will increase firmware size considerably.
Btw, 8266 will probably never have this feature, due to 8266 firmware size limits. But I could image a solution for esp32 boards with at least 8MB flash.
blazoncek commentedon Nov 18, 2025
@softhack007 I've already recommended that someone implements loading font files (binary or JSON or whatever) from file system. That would allow anyone to upload custom font without the need for custom compiling.
However, that feature might be only feasible on ESP32 (and variants) as ESP8266 lacks free RAM for font data.
I do not think implementing full Unicode support is feasible but a font file might allow this (at the cost of accessing flash during effect drawing).
DedeHai commentedon Nov 18, 2025
I just had the same thought and ran a quick test to see if it can be read directly from the file, well it can't. Opening a file and reading a few bytes then closing takes 25ms... BUT if the file is kept open, the access is very fast, 100us or so. littleFS allows for multiple files to be open, I checket up to 4 without issues, if this also works on ESP8266 then there is no need to load it to RAM.
edit: accessing 4 files in parallel also works on ESP8266, it is a bit slower though, reading 10 bytes per pass takes 270us, still more than fast enough so this appraoch would be feasible.
softhack007 commentedon Nov 18, 2025
@DedeHai so for the full picture, we'd need a string conversion from UTF-8 (or unicode?) to codepage xyz encoding, to have an index for the font tables ... any ideas?
edit: for boards with PSRAM, we could even load the font files into PSRAM for caching.
DedeHai commentedon Nov 18, 2025
I already have it sketched out in my head, something like this:
need of course some pythong script to generate these binary blobs from the current format, or if there are other commonly available pixel font formats, also support converting those.
ASCII tables are always 256 bytes in size, 128-255 are extended chars so here is for greek for example: https://www.ascii-codes.com/cp869.html
so a "greek only font" without fancy stuff would start somewhere around char 164 and end at char 238 but nothing sais it cannot be a full 0-255 ASCII table supporting all chars, including numbers.
the naming could be to replace the current 5 fonts as overrides, font1.fnt to font5.fnt. it would in theory also allow for fonts with much larger chars for HUB75, the limit would onyl be the access time to read the chars but it is quite fast, less than 10us per byte.
edit: actually the limit would be 256bits per char unless we make that header 4 bytes, which would be reasonable I guess.
edit2: now that I think about it, it really makes little sense to not always start a font at char 0, since it's stored in FS we can spare a few hundred extra bytes to keep the fonts simple and more universal for users. If a font does not contain the extended chars > 127, the file read at that position will just fail, so should be easy to catch.
edit3: forgot we need width and height of a char, so header would be 2 bytes for width and height. To support all languages, we'd need UTF-8 suport which I dont think is feasible with reasonable effort.
softhack007 commentedon Nov 18, 2025
@DedeHai so we would still need a way to convert unicode (UTF-8) - which is used by the WebUI when you name your segment in greek, or even you name it "schöne Grüße aus Grønland 👋 ", into the "codepage" that's used by your font file. Of course some unicode chars will not be supported by the font. However some basic unicode parser / translator would be necessary to pick the right character to display.
softhack007 commentedon Nov 18, 2025
A possible solution for the "codepage mapping" might be to translate UTF-8 into UTF-16 (aka UCS-2), which covers almost any letter supported by UTF-8 but always needs two bytes per letter - if we forget about the 4-byte variable codes for exotic stuff.
Codes < 127 are always ASCII codes, so no mapping needed for roman letters, numbers etc.
Font file: for all "characters" > 126, add two bytes which indicate the UTF-16 code for the letter or symbol (might be replaced with a generic UTF16-to-codepage_xyz translation list for all user fonts)
WLED translates the segment name from UTF-8 into UTF-16 (straight forward, no LUT involved)
if UTF16_index < 127 --> display font[UTF16_index]
if UTF16_index >= 127 -> scan the font until we find font[x].utf16 == UTF16_index --> display if found, show " " otherwise
The whole process could be accelerated if we can build a translation table in RAM.
Some magic python script could generate the font file, and generate UTF-16 indices when needed.
1 remaining item
softhack007 commentedon Nov 19, 2025
Slightly related: this is how unicode (aka utf-8) works: https://youtu.be/gd5uJ7Nlvvo (skip to time index 45:25 if your impatient)
ElToberino commentedon Nov 19, 2025
Loading font data from files would be a great effort. It could also enable flexible font widths, different font styles etc. With these easily editable files it would also be possible to replace certain characters with custom ones.
Some time a ago I wrote some lines and referenced the MD_Parola library also using font files: #3071 is also mentioning some other ideas for scrolling text.
The UTF8 conversion can be done like this: https://forum.arduino.cc.....
DedeHai commentedon Nov 19, 2025
will this work both ways? the text is stored in preset as segment name.
softhack007 commentedon Nov 19, 2025
I think it will work. Most likely we don't even recognise that presets and segment names are already UTF-8, because when you enter a string in the webUI, it will arrive in WLED as unicode (UTF-8), and the same string (even when handled as
char *) sent back to the UI will be decoded as UTF-8. That's why people can already use greek letters or emoji as segment names.Actually for Font rendering in scrolling text, only the "forward" direction will be needed because we can do it without modifying seg.name.
DrawStringreceives the segment name as inputbyte UTF16_to_FontChar(uint16_t wchar, font&)--> convert to font -specific byte_indexfor the first shot, we can have a static conversion (switch-case) in
UTF16_to_FontCharthat maps UTF-16 to a codepage (like CP437) used by the font. The wikipedia CP437 page has all the unicode codes needed for this CP437 translation, so I can grab them and directly generatecase codepoint_abcd: return index_xyz; break;with a simple shell script.In general there seems to be some C++ standard template class that can do the conversion, but I did not look deeper into that.
Edit: just did a quick check (WLED-MM but should be the same in upstream): yes unicode can be entered in in segment name (WebUI), its properly saved in presets.json, and properly displayed when you load a preset.
conclusion: unicode already works in WLED, we just did not notice it ;-)
softhack007 commentedon Nov 19, 2025
The rabbit has created a nice flowchart for the "simplified" UTF8 - to DrawCharacter flow --> working on it, so we can build on something and extend the idea with custom font loading, custom codepages, etc.
sequenceDiagram autonumber participant App as Application (drawCharacter) participant UTF8 as UTF-8 input participant U16 as unicodeToWchar16() participant CP437 as wchar16ToCodepage437() participant Font as console_font_4x6 Note over App,Font: New optional full-font flow (WLED_ENABLE_FULL_FONTS) App->>UTF8: provide UTF-8 string UTF8->>U16: unicodeToWchar16(utf8) U16-->>CP437: returns uint16_t codepoint CP437->>CP437: map codepoint -> CP437 byte (switch table) CP437-->>App: CP437 byte App->>Font: index glyph using CP437 byte Font-->>App: glyph bitmaponly one thing missing: instead of DrawCharacter, the scrolling text has to call a new method DrawText, and pass the complete segment name string for UTF-8 decoding.
softhack007 commentedon Nov 20, 2025
@ElToberino thanks for the reassurance :-)
You might want to "hold your horses" about flexible width glyphs, though. We are still on "fixed with", however it would be possible in future to calculate the real width of each glyph, and advance the next drawing position based on this. Actually that's a "third topic" - in addition to font file loading, and (limited) unicode support.
DedeHai commentedon Feb 12, 2026
I have made significant progress in this. all the ground work is done, I have first light for a font with variable glyph width loaded from a file, still not using the variable width though as that needs some more restructuring. I also added utf8 support, but I still need to test if that actually works. will keep you posted.
its currently not very fast though, especially when running multiple segments FPS drop below 20 but on a single segment it runs at like 50fps without any glyph cache, i.e. each frame is constructed directly from the file.
edit: PSRAM would really help, could load the whole font into ram. lots of room for optimization later on.
softhack007 commentedon Feb 13, 2026
Hi @DedeHai,
For utf-8 (unicode) support you can take a side-look at WLED-MM: it took me some time to get the unicode decoding right, as there are many special and errors cases to consider.
https://github.com/MoonModules/WLED-MM/blob/mdev/wled00/src/font/unicodetool.cpp#L18
https://github.com/MoonModules/WLED-MM/blob/mdev/wled00/src/font/codepage437.cpp#L15
https://github.com/MoonModules/WLED-MM/blob/mdev/wled00/FX_2Dfcn.cpp#L891
DedeHai commentedon Feb 13, 2026
@softhack007 that is A LOT of code, I took a much simpler approach but still need to test it, my version of utf8 decoder is less than 20 lines of code, I checked only a few chars and it was correct, still need to check more though. I also defined a new font format that is very similar to what you did, still need to work out a clever way to parse and store the info. As I am sick in bed I do some vibe coding of a font conversion tool whenever I feel well enough. If everything works out as I have it sketched in my mind, its going to be awesome and very user friendly: load any font (ttf, otf, woff) adjust 3 sliders to rasterize it to any size you like (already works quite well), choose what extension (if any) you want for 128-255 chars, export it as a binary file, upload to wled file system. then load it in scrolling text (proof of concept done).
edit:
once I have it working I will do a draft PR for review and working out the details.
softhack007 commentedon Feb 13, 2026
@DedeHai agreed that my version is a bit over-engineered, especially I tried to also catch common "unicode exploits" - this includes nasty cases like overlong encodings, surrogate pairs and "continuation followed by \0". This means i had to be careful about using "strlen" because strlen may not tell the complete truth.
You may also need a special unicode-aware "strlen" variant, see nextUnicode() and strlenUC() in my code.
The core function is 30 lines of code (unicodeToWchar16()) plus a few more lines for the codepage lookup table - implemented as a switch-case for best efficiency and to avoid having the table in RAM.
I think the core of my idea is the right way; strings in the UI - like segment names - are already in utf-8 so we only need to
If you proceed with your new font loading code, maybe we can plug-in my unicodeToWchar16() function, its completely standalone.
Get well soon 😃 and take care
DedeHai commentedon Feb 13, 2026
thanks.
I did it very simple:
my font format actually "encodes" the codepage quite simply and very flexible: in the header it has a 32bit offset, glyphs 127-255 (or 128, not decided yet as 127 is "del" and could be used as an extra glyph) will hold glyphs from offset (inclusive) to offset +128 (or +127). now checking if the requested unicode is in the font is simple.
the "WLED Font Factory" takes care of the rest. Select a font, select code table extension (or go custom offset, 0x2200 will encode math symbols for example) and save it. Any (utf8)char that is in the font will render. no codepage lookup needed.
DedeHai commentedon Feb 13, 2026
current state of things:
DedeHai commentedon Feb 14, 2026
ok got a proof of concept hack working, displaying Cyrilic font from a custom font file. so my UTF8 stuff seems correct. now comes the tedious part of making it work without hacking ;)
DedeHai commentedon Feb 15, 2026
@bsveselov-rgb please check #5372