Navigation Menu

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

Company name with foreign (e.g. Czech) characters overflows #6527

Closed
DorpsGek opened this issue Dec 7, 2016 · 8 comments
Closed

Company name with foreign (e.g. Czech) characters overflows #6527

DorpsGek opened this issue Dec 7, 2016 · 8 comments
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

DorpsGek commented Dec 7, 2016

SirkoZ opened the ticket and wrote:

Company name in the company bar at the bottom middle of the screen overflows if it contains
too high characters, e.g. "Š" and others - the upper part of the character - usually
hyphenation will overflow onto map terrain when scrolling through the map - mostly downward (due south).
Again - a great example CZ/SK/EN Gamepark.cz Server - when one uses default company name with all kinds of hyphenated characters - things begin to happen. :-)

Reported version: 1.6.1
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/6527
@DorpsGek
Copy link
Member Author

adf88 wrote:

Could you give a screenshot?


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527#comment14309

@DorpsGek
Copy link
Member Author

SirkoZ wrote:

There is also server text overflow visible, however pay attention to the two "ˇ" characters and their overflow while navigating terrain...

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527#comment14311

@DorpsGek
Copy link
Member Author

adf88 wrote:

As a temporary workaround you can experiment with other fonts:

https://wiki.openttd.org/Unicode


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527#comment14312

@DorpsGek
Copy link
Member Author

adf88 wrote:

OK, I figured it out.

Long time before letters were never taller then FONT_HEIGHT_XXX thus there was always enough space to draw labels on widgets. No clipping was needed.

Since Unicode support, it's natural that some characters may be oversized (like Czech diacritics). However, before the GUI zoom feature, it was a minor problem - except of the area reserved for drawing a text, widgets also reserve some pixels for a frame. This additional space was almost always enough for the oversized characters.

Now we have GUI zoom feature. The oversize of characters is N times bigger in GUI zoom xN. Extra space reserved for a frame is no longer enough, letters may extend over the widget. And this is most problematic when they extend over whole window.

When drawing windows (DrawOverlappedWindow), the clipping rectangle is not limited to the area occupied by the window( http://hg.openttd.org/trunk.hg/file/101381b218b0/src/window.cpp# l912 ). A window may paint stuff outside of it and this won't be clipped out automatically. This causes artifacts to appear around some windows if characters are too big.

I can think of few solutions to the problem. We can add clipping and/or reserve more space for drawing labels. Reserving extra space is problematic - how much to reserve? If a font has a single, very tall character, should all widgets be as tall as it's needed to handle this extra tall character? Or maybe we should just reserve a bit more hoping that it will be enough? Poor. I prefer the first one - setup some additional clipping.

But what kind of clipping to perform? Three possibilities. 1 - clip whole windows. 2 - clip whole widgets. 3 - clip only text areas. The 3rd solution would prevent from painting labels over frames and we don't want it probably. Actually it's a nice feature that frames get overpainted by labels - the text is more readable and whole thing doesn't look awkward, it doesn't cause artifacts. Looks like solution 1 or 2 would be preferred. Both would be easy to implement and computationally cheap. Solution 2, in contrast to solution 1 would prevent occasional glitches inside windows.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527#comment14314

@DorpsGek
Copy link
Member Author

SirkoZ wrote:

I neglected to mention, that yes, I do use 2x interface (zoom) feature and 1680x1050 resolution or sometimes 1280x1024 (with 2x int.).
From what I've seen only the hyphenated characters are problematic (c, r, s....with ' ˇ ^ `). Also I saw $ being too large some time back.
If OpenTTD is truly supporting unicode/all languages, the new-fangled widget system will automatically adjust itself for added font height/to any font.
From my experience only additional 2 or 3 (1 spare) pixels of height would be necessary.


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527#comment14315

@DorpsGek
Copy link
Member Author

adf88 wrote:

Widget system automatically adjust itself for font height, yes, but the problem is that some character may be oversized - some may be taller than the height of a given font. And they cause glitches because there is no clipping mechanism. We could of course make widgets as high as the highest character but this would be a waste of screen space.

Also adding arbitrary number of pixels is a poor solution. There is so many fonts, so many languages, so many characters out there ... because of this uncertainty you will never know when things will brake again.

Clipping solves all problems. I even attempted to implement it:

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527#comment14316

@DorpsGek
Copy link
Member Author

adf88 wrote:

Something went wrong during upload. Ignore previous patches.
Additional comment to FONT_HEIGHT_XXX may be useful.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527#comment14317

@DorpsGek
Copy link
Member Author

frosch closed the ticket.

Reason for closing: Fixed

in r27713 by adf88


This comment was imported from FlySpray: https://bugs.openttd.org/task/6527

@DorpsGek DorpsGek added component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: interface This is an interface issue flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant