nopnop2002 / esp-idf-st7789

ST7789 Driver for esp-idf
MIT License
254 stars 62 forks source link

About create font #43

Closed nguyentrungg closed 3 months ago

nguyentrungg commented 4 months ago

Hi. Thank you for creating a perfect library. I want to ask you how to create file .FNT from .ttf file example: concielian.ttf. Thank you so much.

nopnop2002 commented 4 months ago

TTF fonts are scalable fonts.

FNT fonts are bitmap fonts.

Searching for this keyword brings up several hits, but I have never tried it.

convert scalable fonts to bitmap font
nopnop2002 commented 4 months ago

Convert from TTF font to FONTX font

step1)
Download WFONTX64.exe from here. Developer page is here.

step2)
Select ttf font.
WFINTX64-1

step3)
Enter Height, Width, FontX2 name.
Specify half of Height for Width.
Specify your favorite font name in the FontX2 name field using up to 8 characters.
WFINTX64-2

step4)
Specify the file name to save.
WFINTX64-3

step5)
Specify the font style as required.
WFINTX64-4

step6)
Press the RUN button to convert TTF fonts to FONTX format.
WFINTX64-4

TTF_FONT

nguyentrungg commented 2 weeks ago

Hi, I saw you post an answer with instructions on how to convert ttf file to fnt file using some tool on ubuntu. I remember it was sudo otf2bdf, but I don't remember clearly. Please remind me, I would appreciate it.

nopnop2002 commented 2 weeks ago

This is OpenType to BDF font converter. https://formulae.brew.sh/formula/otf2bdf

There is probably no command on Linux to convert from TTF fonts to FONTX fonts.

Use this after converting from TTF to BDF. http://www.wheel.gr.jp/~dai/software/bdf2fontx.c

cc -o bdf2fontx bdf2fontx.c
./bdf2fontx < spleen-16x32.bdf > spleen32.fnt