vroland / epdiy

EPDiy is a driver board for affordable e-Paper (or E-ink) displays.
https://vroland.github.io/epdiy-hardware/
GNU Lesser General Public License v3.0
1.32k stars 184 forks source link

Is there support for Cyrillic in fonts? #252

Closed SerjPr closed 11 months ago

SerjPr commented 1 year ago

Good afternoon. I tried to add Cyrillic through fontconvert.py script. The font is converted, but the Latin works and the Cyrillic does not. Or did I make a mistake due to little experience in the code, or is there no Cyrillic support? I tried different fonts but the result is the same.

martinberlin commented 1 year ago

Please add the .ttf you are using or a link to download it. Add also:

Please when you write an issue give full details of what you are trying to do and explain how to reproduce it adding all necessary information.

SerjPr commented 1 year ago

font.zip

python3 fontconvert.py myfont 10 lucida-sans-unicode.ttf > font2_10.h

I used the script provided by LilyGo-EPD47. On it, everything was converted without errors, and the compiler did not swear. Then I found your resource. But the compiler swears at the fonts after your script. I'm new to coding so I could easily make a mistake.

martinberlin commented 1 year ago

Dear @SerjPr Cyrillic means: "an alphabet used for writing Old Church Slavic and for Russian and a number of other languages of eastern Europe and Asia."

Right? So you are asking about using specific characters that are used for example in Polish/Russian alphabet. If you open fontconvert.py you will see inside they are defined intervals to render only the characters you need and avoid making a huge fonts header file:

# inclusive unicode code point intervals
# must not overlap and be in ascending order
intervals = [
    (32, 126),
    (160, 255),
    # punctuation
    (0x2010, 0x205F),
    # arrows
    (0x2190, 0x21FF),
    # math
    #(0x2200, 0x22FF),
    # symbols
    (0x2300, 0x23FF),

Try adding there the interval for Cyrillic fonts. Not all font viewers in Linux will show you that part, please get ahold a Font software like Font Forge or similar where you can check the interval range you want to add:

Screenshot from 2023-08-25 14-29-20

After that check if the font itself is in font.h file. Then what I'm not sure if works and you have to try for yourself is to check if drawing that string, the matched character will look-up and print the character. But I think that part you where missing since I don't see any Cyrillic font in your font header file.

martinberlin commented 1 year ago

Posts will be closed after 2 months without replies after the waiting for feedback label is applied. @SerjPr please give some feedback if we can help you further