Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
525 stars 137 forks source link

How to use system fonts in "fontSub"? #186

Closed adam900710 closed 6 years ago

adam900710 commented 6 years ago

Hi,

Game "Finding Paradise" seems to be using mkxp for its Linux version. It's using OpenSans as font substitution.

However OpenSans doesn't have any Chinese characters, resulting all Chinese fonts rendered as square. 2017-12-15-082418_640x480_scrot

Since mkxp is providing font substitutions, can I use system font to replace OpenSans?

I tried changing mkxp.conf from

fontSub=Arial>Open Sans
fontSub=Tahoma>Open Sans
fontSub=Times New Roman>Open Sans

to

fontSub=Arial>Noto Sans CJK SC
fontSub=Tahoma>Noto Sans CJK SC
fontSub=Times New Roman>Noto Sans CJK SC

However it doesn't work.

Anything special needed to use system fonts?

kforney commented 6 years ago

The actual font files are located in the game's folder, under /Finding Paradise/Fonts. In order for the game to load a font, it needs to be in that folder, and mkxp.conf edited to match. It should work then.

adam900710 commented 6 years ago

It seems that .ttc fonts bundle is not supported.

As even I copied my system .ttc fonts to that folder and changed "fontSub=", still the same problem.

I also tried merging all Chinese characters from WenQuanYi Micro Hei into the opensans.ttf, still not working.

Is there any special requirement to use the fonts? Like font name or things like that?

adam900710 commented 6 years ago

Well, strace shows that, whatever I put in Fonts/, the binary and its child only tried to access/lstat font files, not really reading/mmap them.

Any extra ideas on what's going on here?

Ancurio commented 6 years ago

The issue is being worked on on the Finding Paradise developer side; we should have a fix soon.

Edit: To answer your question: Font files need to be in the Fonts/ folder, and fontSub= must be provided the font family name not the filename

openmac commented 6 years ago

Sorry for the inconvenience, I forgot to include the Chinese font on the Steam release (it was there for the Gog release though). The reason your fontSub config didn't work was because the game wasn't asking for Arial/Tahoma/Times New Roman, it was asking for WenQuanYi Zen Hei, so now that I have uploaded the missing font file on Steam, it should work as expected, and you should be able to substitute WenQuanYi Zen Hei with another font you prefer in the mkxp.conf.

adam900710 commented 6 years ago

Works fine now.

Just curious any idea to debug such situation? Is the font used specified in its script? If in that case, it would be possible to decrypt .rgssad file and locate the script?

And despite that, it will be a pretty nice feature to allow mkxp to use system fonts as fallback.

openmac commented 6 years ago

Yes, the font is specified in the game scripts.