ftsf / nico

a Game Framework in Nim inspired by Pico-8.
MIT License
624 stars 35 forks source link

How to draw text "中文 cn zh font" (Hei.ttf:43KB) in nico #103

Closed Angluca closed 1 year ago

Angluca commented 1 year ago

Example all use draw english, Please tell me how to use func draw "中文字体" text . T^T

Angluca commented 1 year ago

https://takwolf.itch.io/ark-pixel-font T^T I'm a newbie, Don't know how to generate font png data, Teach me pls .

ftsf commented 1 year ago

You need a 3 color png file with black characters (index 1) on transparent background (index 0), separated by white pixels (index 2).

The png.dat file should contain the list of characters (int UTF-8) in the same order that they appear in the png

ftsf commented 1 year ago

image

example of the png image format

Angluca commented 1 year ago

Is there a limit to increasing the size and length in png&data? Maybe add more than a hundred characters to it ...

Well, Thx to tell me :)

ftsf commented 1 year ago

It should be fine!