Hachimi-Hachimi / Hachimi

はちみーをなめると〜 Game enhancement and translation mod for Honse Game.
https://hachimi.leadrdrk.com
GNU General Public License v3.0
13 stars 0 forks source link

Text label is not scaled properly in the story view's text frame #25

Closed KevinVG207 closed 1 month ago

KevinVG207 commented 1 month ago

UmaTL stories are created with its font in mind, which is a bit thinner/smaller so more text can fit on a single line without it overlapping with the Auto button. I recognized this and for Carotene I made the text slightly smaller during stories.

It would be nice if text could be made smaller for Hachimi as well, as newlines no longer work correctly when Hachimi (or the game?) adds its own linebreak, but without the linebreak it would overlap with the buttons. (See image for an example.)

image

As a reference, this is the code from Carotenify where settings is the TextGenerationSettings handed to populate_with_errors.

settings->fontSize *= 0.9f;
settings->lineSpacing *= 0.8f;
Vector2_t tmp_pivot = settings->pivot;
tmp_pivot.y += 0.08f;
settings->pivot = tmp_pivot;
LeadRDRK commented 1 month ago

This feature is already present in Hachimi where it modifies the font size and line spacing in the text frame directly instead of relying on the text generator. They're already configured for the EN translations: text_frame_font_size_multiplier = 0.9, text_frame_line_spacing_multiplier = 0.8. Any formatting tags in the text itself will completely override these settings. The pivot is currently not supported. As for the text wrapping, it seems your text is already prewrapped. Hachimi intentionally ignores any newlines already in the text so as to allow the translator to override it as they want, but it will still attempt to wrap the text at the earliest point it thinks the text will overflow without taking the existing newlines into account. The wrapping line width in Hachimi is configured to be slightly narrower than what the UmaTL translations wrap at because they collide with the UI and I think that's nasty. This is also why Hachimi's story translations don't have any line breaks from their UmaTL counterpart, even in places where it's absolutely needed for punctuation purposes (I'd need someone to go through them and manually add line breaks where needed).

KevinVG207 commented 1 month ago

Personality I would want Hachimi accomodate UmaTL and to make the text slightly smaller still. I don't think you're going to find someone willing to sit through hundreds, if not thousands of text blocks to insert newlines that look good.

In my case there have been times where I specifically worded a sentence in a way as to make it fit within the bounds and altering the newlines on those might even require me to rewrite the sentence again.

Here"s what I think I would do:

Tbh, auto-wrapping text in dialogue blocks like this is a pet peeve of mine that even shows up in officially translated games. I think it is ugly if it wraps and leaves a single word on the next line. I'm willing to make that script myself and do the reformatting but only if the text size can be a little smaller so it lowers the amount of work for me.

Edit: I just checked only the character stories (04) with Carotene's ones imported as well, is over 19.000 text fields. I don't think anyone will manually add newlines when they already had them before importing.

LeadRDRK commented 1 month ago

I'm not asking anyone to go through all that, and I've never bothered to actually re-add the line breaks. Because in most cases it doesn't change the readability of the text, and it doesn't affect the punctuation.

This feature was implemented as a stopgap for importing translations from projects that had elements that weren't fully compatible with Hachimi's own translation project, namely UmaTL, where everything was translated for a different font. The initial thought was that since Hachimi originally used the game's font without any scaling, 1. there needed to be a way to re-wrap the text, 2. the translations needed to be font-agnostic so that any future changes wouldn't require any changes to the translations at all, and 3. I don't waste my time trying to rewrap everything, and as a bonus, translators can just blindly write text without worrying about wrapping the text themselves (even without a TL tool). So this is actually the opposite of what you think I want you to do (manually rewrap text). In the context of actually having people working on translations for Hachimi, it also acts as a hard limit so that translators won't write text that's too long, so you also have the benefit of quality control without doing anything.

Using TLs from other projects has always been and still is the case for Hachimi, so it's still needed. And it's not like the wrapping system is unpredictable or some kind of untamable wild beast that will always mess up your manual line breaks, it just really doesn't want your text to overflow while letting you force line breaks at your own discretion, if you really need a line break, just test it in game first (or later when you've finished and doing QA), and add a line break wherever you want. It was just particular bad in your case because there was a line break right after the text wrapper's own line break, leading to that single word on a line. I mean who doesn't hate that, you just need to use it correctly and adapt your TLs properly.

Here's a quick demo. This is the original text without any line breaks:

O mighty and revered three pillars, witness my dance till its end. Draw near, draw near, heed the resolve set in my heart.

This is what it looks like in game: image

Let's say I want to add line break right at the first comma. This is safe to do because, if you look at the text, it isn't right after the text wrapper has wrapped it. So I just need to do this:

O mighty and revered three pillars,\nwitness my dance till its end. Draw near, draw near, heed the resolve set in my heart.

And the text wrapper will respond properly to my (forced) line break: image

About the font size: It should be the same as Carotenify, since the contents in that text frame will eventually go through TextGenerator where the same settings get applied. I don't have a fair comparison for that based on existing images due to resolution differences, but I'm sure that the values get calculated the same way with the same variables, unless one of them is applying it the wrong way.

KevinVG207 commented 1 month ago

My fault for choosing an example that overlaps with the UI (I thought I made my safezone correctly but I guess not.)

Even if the ones made for Carotene are correct that still leaves the UmaTL ones that have lost their newlines, when they might have been placed strategically by their authors. Maybe I'll investigate how many times the lines auto-wrap for those when the newlines are kept so I get a sense of how much of a problem it will be...

LeadRDRK commented 1 month ago

My fault for choosing an example that overlaps with the UI (I thought I made my safezone correctly but I guess not.)

I edited my comment btw, I don't think it was a fair comparison(?) since one was on PC and one was on mobile and I'm unsure if the mod-scaled font sizes are actually the same.

LeadRDRK commented 1 month ago

Update: I've confirmed a defect in Hachimi where the font size is not scaled properly in the main story view, sorry about the previous assumptions.

I'll now use this issue for tracking that bug. If you have any other problems, please create a new issue.

KevinVG207 commented 1 month ago

No need to feel sorry! We're both trying to make Hachimi better (and I also would like to make the switch from Carotene to Hachimi seamless) and if that's the end result of the conversations then it's a good thing.