klikli-dev / modonomicon

Data-driven minecraft in-game documentation with progress visualization.
24 stars 10 forks source link

Defining the book layout requires a datapack #181

Open Noaaan opened 8 months ago

Noaaan commented 8 months ago

This is a somewhat major issue that I would not classify as a bug nor an enhancement, hence why it is a blank issue.

When testing out the localizations of Occultism I noticed text overflow with the Russian language. I then realized that in order to fix this issue you would have to directly modify the page specification. This causes a big issue, since this is decided by the metadata in the data directory.

Unless I am missing something with Modonomicons systems - If you want to/need to change the page spec, you need to provide a datapack.

This has some implications, since in a multiplayer context you now need the server to either provide the datapack to you, or you have to make a modpack which includes the correct data for the specific language. At the same time you also have the issue where if you design the guidebook in mind to support a longer language (I.E. German or Russian), the book would look bad when localized to a shorter language (I.E. Chinese or Japanese).

I don't know if there is currently any great solutions in Modonomicon to solve this. AFAIK solving this would potentially require larger refactors of the library. Some random ideas which could in theory solve the problem:

2024-03-01_22 02 22

2024-03-02_16 36 07

2024-03-02_16 36 08

klikli-dev commented 8 months ago

You are raising a good point and a tough to solve issue.

I think overall the best solution would be page wrapping - or as patchouli supports, scaling. I previously did not look into page wrapping much as it caused issues with addressing pages by index - however #175 took steps to address that and may have fixed it entirely.

Page wrapping then might be viable, we just have to figure out the details. Open questions for me are:

klikli-dev commented 4 months ago

Tip from chonky: use Font.wordWrapHeight to check text overflow before rendering. Note from Klikli: Might need to use our own variant in case it doesn't handle markdown lists properly.

klikli-dev commented 4 months ago

@Noaaan A first step towards improving this has been made in https://github.com/klikli-dev/modonomicon/pull/224 ( which will be merged in a few minutes ). It scales the text to fit. It is not a 100% solution and page wrapping would be better, but it should at least make the text a lot more readable in localizations that currently overflow. The demo book has two sample pages that show the scaling: The advanced formatting entry (last page) in the formatting category and the image entry (last page) in the features category.