IdreesInc / PlayBook

A cranky ebook reader for the Playdate console
https://play.date/games/playbook/
Mozilla Public License 2.0
36 stars 5 forks source link

add chinese font display support #7

Closed Antonoko closed 1 month ago

Antonoko commented 3 months ago

I really like this tool, thank you so much for your excellent work! Recently I want to add Chinese fonts on it to support the reading of Chinese text.

Currently, I have made this few changes:

Snipaste_2024-03-18_19-38-52

I am currently encountering some problems that are difficult for me to solve and hope to seek your help..:

Snipaste_2024-03-18_19-38-38

Lua's support for Unicode and UTF-8 is quite limited. When using functions like 'sub' for substring extraction, it is unable to yield accurate results. It's a bit challenging, and I can't currently think of a good approach to solve this problem...

Antonoko commented 1 month ago

At the end, I built a Chinese reader from scratch and solved the typesetting problem by converting the text into a table first.

https://github.com/Antonoko/pocket-reader

IdreesInc commented 1 month ago

That's a great idea! I was able to add chinese support by adding custom UTF-8 support eventually, though without the ability to read chinese I can only hope it is accurate. Good luck with your project!

Antonoko commented 1 month ago

Support for UTF-8 sounds like the ultimate solution! I have a project to convert Chinese fonts and limited Japanese kana, provide some preset fnt fonts, feel free to checkout: https://github.com/Antonoko/Chinese-font-for-playdate

At the beginning, I posted some demos on SNS when I was adding Chinese support, and received some feedback from users, including the hope that the playbook can read Chinese (tbh I didn't expect that many users want to do this, but people in this area once had a strong historical memory of secretly reading novels through mp3-like device during class.), so I started to study your project code and learned a lot. Thank you so much for your work.

If there are plans to add Asian text support in the future, I am willing to help participate in the test and feedback. 😆 (basically, they are just regular and independent square character in same width

SNS reference link:

IdreesInc commented 1 month ago

That's amazing, thanks for sharing! It's hard for someone like me who can't read anything but english to debug text in a different language, but using the new font I added to PlayBook (think it was called Asheville?), you should be able to read stuff in different languages. The international language support I added probably isn't nearly as good for Chinese text as your application, so I am recommending it to people who are looking for something similar to PlayBook specifically for Chinese text!