drwhut / tabletop-club

An open-source platform for playing tabletop games in a physics-based 3D environment for Windows, macOS, and Linux! Made with the Godot Engine.
MIT License
1.24k stars 49 forks source link

Use custom font #279

Closed GrimPixel closed 1 year ago

GrimPixel commented 1 year ago

Is your feature request related to a problem? Please describe. There are already Chinese locales, which the default font doesn't support.

Describe the solution you'd like Use custom fonts.

drwhut commented 1 year ago

This is technically a duplicate of #212. As I said in that issue, fonts for unsupported characters (in this example, Chinese) will be added to the game once the language has been added as an option - and adding the ability to change the font in-game would mean having to support a wide variety of fonts in the UI, which is a daunting task.

GrimPixel commented 1 year ago

That is just one of possible solutions. It can also be specifying the path to a font file.

drwhut commented 1 year ago

Oh, that was what I thought you meant originally. What did you invision before?

GrimPixel commented 1 year ago

I thought you meant it would be like the font manager on Linux, selecting one from all installed fonts.

drwhut commented 1 year ago

No, the game comes bundled with two fonts, one for Latin characters and one for Cyrillic ones, and the engine automatically uses the correct font depending on the text being displayed. The game does not use system fonts whatsoever.

GrimPixel commented 1 year ago

There current font Cabin doesn't even cover letters with caron.

Due to the problem of “Han unification”, there should be one font for locales in the countries/territories CN, TW, HK, JP, KR, which means adding hundreds megabytes to include fonts like Source Han Sans.

drwhut commented 1 year ago

If by carons you mean the diacritics above Latin letters, that should have been resolved with an update to the font files. If it isn't, could you show a screenshot of an example that doesn't work, and which languages it affects?

I knew about the sizes of CJK fonts already, which I've pretty much accepted is necessary for when those languages are added to the game.

GrimPixel commented 1 year ago

Here are its glyphs: https://fonts.google.com/specimen/Cabin/glyphs At least Ǎ, Ě, Ǐ, Ǒ, Ǔ are not there. It hasn't been updated since Jul 23, 2020.

I mean, it is hard to count on one font that covers all glyphs of a script.

Users may have already installed those fonts and I think there's no need to duplicate them.

drwhut commented 1 year ago

My thinking is that if the default Latin font has all of the characters necessary for the languages that are available in the game, then it's OK - the font can always be changed in the future to accommodate unsupported characters.

The "may" in your statement is what's troubling me - I don't feel comfortable having to rely on the users environment for it to work properly. Plus, the method for reading system fonts will change from platform to platform, and I don't think Godot has the capability to do so yet, so it would all have to be manual.

Since the file sizes are so big, I'll have a look at how other games implement CJK fonts first before committing something that big to the git repository.