KristalTeam / Kristal

Deltarune fangame engine for Love2D
BSD 3-Clause "New" or "Revised" License
109 stars 53 forks source link

How to use fonts #20

Closed Starcloudsea closed 1 year ago

Starcloudsea commented 1 year ago

Since some Chinese characters would show garbled characters, I decided to change the font. However, I tried many times and failed. I suspect there's something wrong with my code, but I don't quite understand the methods in the wiki... So, can you provide a more detailed tutorial or give me a sample mod? (I want to change to TTF font) Thank you! (Bing Translator is used here because I don't know much English.)

AnXing233 commented 1 year ago

Since some Chinese characters would show garbled characters, I decided to change the font. However, I tried many times and failed. I suspect there's something wrong with my code, but I don't quite understand the methods in the wiki... So, can you provide a more detailed tutorial or give me a sample mod? (I want to change to TTF font) Thank you! (Bing Translator is used here because I don't know much English.)

你可以重新创建一个 包含中文字库的字体。当然,必须是,也只能是ttf/otf(因为汉字很多不至于生成图片这么麻烦,而且后期加字也是很麻烦的) 然后在想要使用该字体的场景中的相关代码里设置字体 对了,记得代码段是utf-8编码 至于乱码吧...不知道具体情况,所以暂时不知道解决方案。反正检查字体和代码的文本编码能大概率解决问题

Starcloudsea commented 1 year ago

谢谢,但我最近不再做Deltarune Mod,如果有时间,我会试一试。 而且,我知道了乱码的原因,是因为内置的字体有些汉字不支持导致的。 以及,我很看好这个Deltarune Mod,我希望它能继续发扬光大!😉

Dobby233Liu commented 1 year ago

我知道了乱码的原因,是因为内置的字体有些汉字不支持导致的。

Side note, the stock CJK fonts in Deltarune and subsequently Kristal are made for Japanese text. For Chinese text you'd want to use your own fonts