-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Retrieve DPI from get_player_information #10632
Comments
What you're seeing is not about Windows, it's DPI scaling. It'd make sense to expose screen resolution and/or DPI to get_player_information. |
This is why absolutely sized fonts aren't recommended. I should have put that somewhere in Exposing window size to the server in any way isn't a good idea because the window size can change at any time so it could get invalidated or change without the server knowing. DPI isn't likely to change, so that might be OK. |
Not anymore, I fixed that in #9586. |
I mentionned above: with the same settings on both Linux or Windows. There's no Windows-specific default font size anymore. Absolute or relative sizes do not fix the issue. |
DPI scaling is implemented for both X11 and Windows and for me it behaves identically on the same hardware. If the font sizes don't match, either your configuration is different or there is another bug. |
Is the DPI setting in .conf still supposed to work? It doesn't for me any more, it's stuck at 96 no matter what the value is. Maybe that's the actual problem. As for the original request, sniffing the OS and window size is kinda creepy. I don't like when browsers do it, a block game should probably not be doing it either. This info is worthless anyway because it can be spoofed. |
Alright, I just tested, and on Win 7 the game just inherits the system DPI without using the .conf setting at all. |
It's only read as fallback, this is suboptimal I know. |
This is the same problem with relatively sized fonts: the same font size looks different over different OSes. Moreover, Accessing the DPI setting from |
The reason I said this is not to say that it fixes this specific problem, but because it accommodates the user. Some people don't have very good eyesight and need larger fonts, or they just prefer a smaller or larger font. By forcing a font size in a GUI, that GUI automatically doesn't accommodate those people. In addition, even the DPI won't solve the problem. People can set their own font, like a Minecraft-esque pixelly font or a more cursive-like font, use the monospace font, or have a language that requires the fallback font. I've seen all of these myself. A GUI that works with one font won't work with the others. The fact is that it's never possible to make an absolutely-sized GUI like formspecs work with everyone's font. This is why I say that relative fonts are best. If you need big text, do something like However, this doesn't mean I'm automatically against exposing DPI information. It sounds like it could be a good idea, especially for the HUD. On the other hand, exposing the OS doesn't sound like a good idea and isn't the real root cause of the problem here. |
Then it should be also possible to know the font size in pixels. Freetype provides it: https://www.freetype.org/freetype2/docs/tutorial/step2.html |
Also it's better to increase |
Quite true, although
The difficulty is that a font size in I'm afraid there really doesn't seem to be a good way to have GUIs work absolutely perfectly on all platforms without proper layouting and/or SSCSM, although DPI and screen size could perhaps alleviate some of the problems. |
So what's left to get this into a merge-able state? |
I believe such a facility can and will be abused in a similar way that user agent strings are. |
Problem: font size appears to be much bigger on Windows than on Linux with the same settings. This is problematic when a fixed font size is set on some strings using
style*[]
, it may look good for Linux users but not on Windows or vice versa.Solution: get the OS info from
get_player_information
@v-rob @sfan5
The text was updated successfully, but these errors were encountered: