kichikuou / xsystem35-sdl2

Multi-platform implementation of AliceSoft's System3.x game engine.
https://kichikuou.github.io/web/
GNU General Public License v2.0
57 stars 8 forks source link

MsgFontBoldSize / ZB Command Unimplemented #44

Closed RottenBlock closed 6 months ago

RottenBlock commented 6 months ago

Environment

SupremeJUMBO at the wiki noticed that the ZB command doesn't seem to be working right now. Looking into it, it sets the variable MsgFontBoldSize, but unfortunately, the variable is never actually used when rendering text - just by the ZB command itself. The command apparently does work in System 3.9.

kichikuou commented 6 months ago

I believe the argument of ZB command is multiplied by 100 and used as the value of lfWeight of Windows LOGFONT struct.

System3.9 with MS Gothic font behave as follows:

ALCG0000

MS Gothic has only two weights[^1], so it is rendered in bold with ZB 6 or higher. Note that the default value of ZB is 7, which is bold.

If we implement this faithfully in xsystem35, we would use TTF_SetFontStyle with TTF_STYLE_BOLD when ZB is 6 or more. Trying it with MTLc3m.ttf (our default font) gives the following result:

xsystem35

The default ZB 7 looks too heavy, especially at larger sizes. This is more obvious when you see it in the actual game screen:

KR

Another problem is that TTF_SetFontStyle affects text width, while System3.9 does not. This may break the layout.

[^1]: Actually, MS Gothic has only one weight, and the bold version is synthesized by the font rendering engine.

Why is it like this?

For small sizes, MS Gothic uses bitmap glyphs with 1-pixel thick. This is too thin, so they may have made ZB 7 the default. Modern vector fonts (including MTLc3m.ttf) have a slightly thicker regular weight, so it probably makes more sense not to default to bold.

What should we do?

The following is just a list of potential solutions; the order is not meaningful.

Comments and suggestions are welcome!

RottenBlock commented 6 months ago

I'm personally inclined towards the .xsys35 option, so long as we aren't worried about the look of official Alicesoft games. I've sent a link to SupremeJUMBO to get their opinion.

For the record, the ZB command is fairly rare. These are the only English games that use the ZB command. I did check several Japanese games that I have on hand, none of which used ZB at all, but I don't have all of them. One of these days I need to make a searchable directory.

kichikuou commented 6 months ago

I do have a collection of ADV files from almost all AliceSoft System 3.x games and some indie games, for regression testing of xsys35c.

Below is a list of games that use the ZB command. (I often do this kind of query to find out the impact of code changes.)

I don't know if in any of these cases the ZB command is used to convey some information rather than just to improve the appearance.

SupremeJUMBO commented 6 months ago

Hello, I'm a big fan of your work! I agree that the simplest solution is to just have a flag in .xsys35rc. I'm not even sure if I'll end up needing the wider font, it was just something I noticed since I was originally using ZB to shrink the font width in the system39 version.

kichikuou commented 6 months ago

Thanks for the comment. I have implemented the .xsys35rc solution.

In the game directory put .xsys35rc file with

enable_zb: Yes

then xsystem35 will respect the ZB command.

This will be included in the next release, but if you want to try it out right away you can download a Windows binary here. (Note: The debugger is now supported only on 64-bit build.)

If you decide to actually use this feature, please let me know. I will stabilize this feature and make sure that its behavior does not change. In the meantime, consider this an experimental feature and the behavior may be changed if a better solution is found.

SupremeJUMBO commented 6 months ago

Thanks, I appreciate it! Never hurts to have more modding tools available in case I need them. The game runs so much faster and smoother on xsystem35, you did a phenomenal job.