Currently Online

Latest Posts

Topic: Font size @ 4K

pullmoll
Avatar
Joined: 2017-12-19, 17:22
Posts: 3
Ranking
Just found this site
Posted at: 2017-12-19, 17:47

Hi there, I'm packaging widelands for Void Linux and just updated to ver. 19, only to find that the binary installs as /usr/widelands instead of /usr/bin/widelands. Ok, this is my own problem face-smile.png

However, another problem I can't solve and which may be related to how I built widelands is that the in game font size on my 4K display (3840x2560) is so very damn small that it's really hard to read.

A screenshot of a menu in 2560x1440 window mode is here: http://de.tinypic.com/view.php?pic=2em0ejc&s=9

Also setting the full screen resolution to e.g. 1280x720, which I used with ver. 18, does not seem to work.

The options I used to build widelands with cmake are:

-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_INSTALL_LIBDIR=lib
-DCMAKE_INSTALL_SBINDIR=bin
-DOPTION_BUILD_WEBSITE_TOOLS=OFF
-DWL_INSTALL_DATADIR=share/widelands

It seems I can't set something like a font scaling factor from the command line or by an environment variable?

I then looked through the source and saw only some hard coded values for UI_FONT_SIZE_BIG=22, SMALL=14, ULTRASMALL=10. The only functions I found that do some sort of scaling with these fixed values are FullscreenMenuBase::fs_small() and ::fs_big() which it seems don't find the actual window (or full screen) height by calling get_h(), but perhaps the configured size?

So what could be the reason for (a) the resolution setting being ignored and (b) the font size (as a consequence?) not being scaled?

Thanks for the game! I appreciate all your work. Jürgen


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 1875
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-12-19, 18:29

Hi pullmoll, welcome to the forums face-smile.png

I think for build19 you can't do anything regarding the font size. Some users with retina displays have the same problem, afaik. Maybe we have a new font renderer in build20... but i am not sure if that will fix your issue. GunChleoc can answer that.

Thanks for packaging face-smile.png


Top Quote
pullmoll
Avatar
Joined: 2017-12-19, 17:22
Posts: 3
Ranking
Just found this site
Posted at: 2017-12-19, 18:43

kaputtnik wrote:

Hi pullmoll, welcome to the forums face-smile.png

It was about time for me...

[snip] Some users with retina displays have the same problem, afaik. [/snap]

To me it seems that the system's DPI setting is ignored and the game assumes a fixed e.g. 72 or 96 dpi (or 75 or 100). I configured a value of 150 dpi in my xfce4 DE and on the desktop the fonts are ok. If widelands would recognize such a setting wherever this may come from (no clue actually.. fontconfig? SDL2?) that would certainly help.

I could try to find out and add some code to the scaling function to adjust accordingly.

If time permits I'll take a look and devise a patch (for my own use) and contribute it.

Thanks for packaging face-smile.png

No reason. It's all about fun or is it?


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3180
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-12-19, 19:54

At the moment, the font sizes are all hard coded. I would love to have them all in a Lua file for easier customization, but that is still along way off. Plus a scaling factor in the UI. Getting everything converted to the new font renderer is only the first step - it's one of the reasons that I didn't work on this yet, because I don't want to do the work twice.

You can cheat it though by editing the font set in data/i18n/fonts.lua - just edit the size_offset for the default fontset. UI elements won't rescale for it, but you should be fine with size_offset = 4, because that's what Arabic uses.

Fullscreen switching does work, but you will have to switch to a different menu page, because they don't relayout themselves yet. Some screens are fixed in the current development trunk, but this is still a work in progress.


Busy indexing nil values

Top Quote
pullmoll
Avatar
Joined: 2017-12-19, 17:22
Posts: 3
Ranking
Just found this site
Posted at: 2017-12-22, 11:29

FWIW switching the resolution definitely does not work here. Console output of widelands

Graphics: Try to set Videomode 1280x1024
Graphics: OpenGL: Version "3.0 Mesa 17.3.0"
…
**** GRAPHICS REPORT ****
 VIDEO DRIVER x11
 pixel fmt 370546692
 size 3840 2160
**** END GRAPHICS REPORT ****

This is why I think that the font scaling in fs_small() and fs_big() calculates the point size for a height of 1024 (size * 1024 / 600) but the resolution is really 3840x2160 and thus the rendered fonts are way too small. So I have to find out why Try to set Videomode 1280x1024 fails here.


Top Quote
mallrat
Avatar
Joined: 2020-01-22, 18:24
Posts: 1
Ranking
Just found this site
Posted at: 2020-01-22, 18:27

I've worked that around with a script run_scaled.sh:

#!/bin/env bash

xrandr --output eDP1 --mode 1920x1080
"$@"
xrandr --output eDP1 --mode 3840x2160

and then run it as run_scaled.sh widelands But surely it's very appreciated to get it work with hidpi by default.


Top Quote