• Dear Community Members,

    Greetings to you all! I am very grateful for the continuous help and support from the community.

    I am currently facing a dilemma that has troubled me for quite some time. I have a 128x64 pixel OLED display screen, and when attempting to render Japanese, Korean, and Chinese characters, I found that they cannot be displayed correctly. After some research, I consulted the relevant information on the Espruino official website: Fonts - Espruino, and understood that Espruino only supports ISO8859-1 and ISO10646-1/Unicode for character encoding.

    I also discovered that Bangle.js seems to have support for Unicode and UTF-8 encoding, as discussed in this thread: Notification language | Espruino. The post mentions that font libraries can be installed using

    g.setFontPBF(require("Storage").read("font.pbf"));.
    

    However, I encountered storage space limitations on the ESP32, as it only has 1MB of available space. To address this, I tried using an SD card and stored the font file (in pbf format) on it. But when I attempted to read the file with

    fs.readFileSync("font.pbf")
    

    , it caused a memory overflow, and the g.setFontPBF function does not support pipeline transmission either.

    As a result, I am currently unsure how to load pbf or bdf font files into the ESP32 to render Japanese, Korean, and Chinese characters. I am eager to receive assistance—whether there are any examples or documentation that could guide me through rendering these characters on the ESP32.

    My proficiency in English is not high, and if there is any ambiguity in my expression, I ask for your understanding.

    Lastly, I would like to express my love and appreciation for the Espruino community.

  • Hi,

    Yes, Bangle.js does support Unicode, but to make it work in ESP32 you'll need to add ESPR_UNICODE_SUPPORT=1 to the build, like in https://github.com/espruino/Espruino/blob/master/boards/BANGLEJS2.py#L60

    Actually storing the font file is more of an issue as it needs to be able to me memory-mapped, so using fs won't work. You could actually arrange to store it anywhere in flash and then use E.memoryArea(...) to create a string that maps it in, or ideally you could fit it in Storage (maybe expanding the Storage area to give you more space).

    It's also worth considering using a cut down font - for example https://github.com/espruino/BangleApps/tree/master/apps/fontkorean is just Korean, and is 400k which might be more usable

  • hi,

    Thank you for your reply, I succeeded! I studied the logic of dot matrix generation for fonts, mapped it accordingly, and compiled it into the Espruino project. By calling my own methods, I rendered it using a bitmap of the fonts. use API: g.drawImage

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Regarding the issue of non-English character encoding in the Graphics.drawString method.

Posted by Avatar for lenxu @lenxu

Actions