Interkarma / daggerfall-unity

Open source recreation of Daggerfall in the Unity engine
http://www.dfworkshop.net
MIT License
2.7k stars 327 forks source link

Fix TextLabel metrics in 4:3 mode for MultiFormatTextLabel and ListBox. #2583

Closed DunnyOfPenwick closed 3 months ago

DunnyOfPenwick commented 7 months ago

Fix for MultiFormatTextLabel and ListBox TextLabel wrapping issues spotted in 4:3 mode.

I originally noticed an issue with wrapping TextLabels when constructing a MultiFormatTextLabel while running in 4:3 mode. Wrapped text would overlap the following line. In the TextLabel.CreateNewLabelLayoutWrapped() method, the LocalScale was (1,1), causing some bad line metric calculations.

More recently I noticed the bottom line of the npc conversation window was often not shown in 4:3 mode. This appears to be the same problem.

This fix calls GetRectangle() on the TextLabel early to establish the correct LocalScale prior to other operations.

KABoissonneault commented 3 months ago

It's been some time, you think you could provide a test that reproduces the issue so I can verify the fix?

DunnyOfPenwick commented 3 months ago

The easy way to produce the issue is by using the SDF font while in 4:3 mode and engaging in dialog. After the dialog reaches the end of the window you should begin seeing instances of text cut-off. I don't normally see it when using the non-sdf font.

KABoissonneault commented 3 months ago

I unfortunately cannot reproduce the issue, neither in Editor or in-game. Doing 320x200 or 640x400 retro mode with 4:3 or 16:10 correction, both with and without SDF

image image

Is it a specific kind of dialogue that overflows? Is it some part of the screen I'm not noticing? At least a screenshot of what you're seeing could help

DunnyOfPenwick commented 3 months ago

I didn't describe the problem correctly. The text is there, but I have to use the scroll bar to see the last line of text. 2024_06_06_11_43_19

The above screenshot is in 1920x1080 with all mods disabled using DFU 1.1.1.