Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Unicode language text is drawn a few pixels off target #2459

Open
tobylane opened this issue Nov 20, 2023 · 5 comments
Open

[Bug] Unicode language text is drawn a few pixels off target #2459

tobylane opened this issue Nov 20, 2023 · 5 comments
Labels
bug issue type

Comments

@tobylane
Copy link
Member

tobylane commented Nov 20, 2023

Describe the issue

The text from the Unicode languages (eg Korean) are 2 pixels off where they should be. In the first screenshot of the Build Room dialog they are down and right of the English screenshot, but in the Graphs dialog and bottom panel, they are up and left.

Steps to Reproduce

  1. Switch to a unicode font and load/start a game

  2. Open the dialogs Build Room, Hire Staff, Progress Report, Graphs

Expected Behaviour

Consistent placement

Save Game

Save game attached to report: Yes/No

CorsixTH Version

15368f1 (recent master)

Operating System

macOS 10.15

Theme Hospital Version

CD

Gamelog.txt

No response

Additional Information

Screen 2023-11-20 at 13 40 44
Screen 2023-11-20 at 13 41 36

@tobylane tobylane added the bug issue type label Nov 20, 2023
@TheCycoONE
Copy link
Member

This is because the font is taller isn't it?

@Alberth289346
Copy link
Contributor

Pasted both closer to each other (vertically aligned on the buttons), added some red marker lines for comparison, and enlarged the editor view to get more detail:
image

Bottom sticks out from the button by 3 pixels, and skips the first 4 pixels.

Note that English is not vertically centered either:
image

The top 5 pixels in a button are not used in the screen shot by Toby, for English. The title doesn't use the top 4 pixels. Moving up by 2-3 pixels looks like it should work in this case,


For the general case, a more robust solution could be to also supply size information of the text, so the code can exactly center it,

@lewri
Copy link
Member

lewri commented Feb 9, 2024

I'm guessing we draw font specifying the top left pixel position. Not very wise it seems for anything but built-in

@Alberth289346
Copy link
Contributor

Fonts are designed to look good when you fill a page / screen with text.

Different fonts have different amounts of space around the letters. Some of that space is used for getting the good distance between 2 consecutive lines of text (which we don't need here).

Other space is used by just a few "high" or "low" letters. If you happen not to use those, the empty space looks like a needless huge gap.

@TheCycoONE
Copy link
Member

Lewri is right here. Also not all fonts are the same aspect ratio. Sounds like this bug might be about choosing size better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue type
Projects
None yet
Development

No branches or pull requests

4 participants