07th-mod / matsuribayashi

23 stars 10 forks source link

Font missing Character in Japanese Fragment Menu [JP only] #41

Open drojf opened 1 year ago

drojf commented 1 year ago

after unlocking the fragments in matsuribayashi, the japanese menu text displays "カケラ ぎをする", which doesn't make any sense. Based on the corresponding text in the console version, I suspect that it's supposed to say "カケラ紡ぎをする"

Our Mod's Menu 1669567433331

Console Version 1669567355331

I can't seem to find the image for this button in the https://github.com/07th-mod/ui-editing-scripts repository? But because it is red colored, we must have replaced it? I'm not sure what happened there...unless it was manually patched rather than using our ui-editing-scripts see below

drojf commented 1 year ago

Oh I think I get it, this is just text, not an image, in flow.txt

https://github.com/07th-mod/matsuribayashi/blob/69409b3c57d2744a5799800f70a84ac8d0ebb067/Update/flow.txt#L195

https://github.com/07th-mod/matsuribayashi/blob/69409b3c57d2744a5799800f70a84ac8d0ebb067/Update/flow.txt#L204

For whatever reason the font we use can't display that character (紡)? I'm not sure what characters are actually supported on the font used by the menu buttons...

drojf commented 1 year ago

It does look like the msgothic_2 font (I assume this is used for menus) is missing that character. It looks like it has a much smaller set of characters than msgothic_0.

As a workaround, I'll write the missing character in hiragana like so:

カケラつむぎをする

or if not enough space

カケラつむぎ (like how it looks in the console game)


This issue might also affect the console arcs (unless it adds more characters to the atlas for msgothic_2):

It has

SavePoint("警察事件調書", "Police Case Files");

and

SavePoint("カケラ紡ぎ", "Connecting Fragments");

which might not be rendered correctly.

drojf commented 1 year ago

OK, I looked into this even more...it looks like this menu appears when you call FragmentViewChapterScreen(); - NOT the SavePoint() function which I wrote about above (the SavePoint() fn only makes a save point and doesn't display this menu)

It looks like the text is stored in the ChapterScreen class in the public List<ChapterButton> ChapterButtons;. But I couldn't easily figure out how to change the text, I could only hide the text by disabling the public MeshRenderer TextMesh; on the ChapterButton object.

For now I think this is too difficult to change, so I won't try to fix this for now.

drojf commented 1 year ago

ok, I did figure out how to change the text...it turns out there is this class called "TextRefresher" which handles setting English/Japanese text automatically. The actual text strings are probably set in the Unity editor, which is why they don't appear in the code.

If you run this in the Show() function of the ChapterScreen class, you can set the text (this will just override the first button).

            TextRefresher textRefresher = ChapterButtons[0].TextMesh.GetComponent<TextRefresher>();
            textRefresher.Japanese = "カケラつむぎをする";

This should really be set in the localization.json so it can be set for other languages.