RodZill4 / material-maker

A procedural textures authoring and 3D model painting tool based on the Godot game engine
MIT License
3.52k stars 222 forks source link

Font size too small in 4K resolution screen #82

Open spkingr opened 4 years ago

spkingr commented 4 years ago

I can't change the font size, it's too small to read.

Calinou commented 4 years ago

This should be handled already by https://github.com/RodZill4/material-maker/blob/master/material_maker/main_window.gd#L110-L113. Maybe your display isn't reporting its DPI correctly?

Which operating system are you using? Also, do you have several monitors with different DPI?

RodZill4 commented 4 years ago

I cannot test this. Are there ways to emulate high DPI on low DPI monitors ?

Calinou commented 4 years ago

Are there ways to emulate high DPI on low DPI monitors ?

Unfortunately, I don't think you can do this in a "comfortable" manner, unless you use an external tool to forcibly resize the window to a resolution larger than your screen. But in this case, you won't be able to see the full window on your screen.

spkingr commented 4 years ago

I have a custom build with the theme resource used in Material Maker, and the font gets bigger now.

leonard7e commented 4 years ago

I doubled DPI in my XUbuntu.

Tried two ways …

(1) xfce4-settings-editor // xsettings // Xft // DPI <= 192

(2) xfconf-query -c xsettings -p /Gdk/WindowScalingFactor -s 2 xfconf-query -c xfwm4 -p /general/theme -s Default-xhdpi

MaterialMaker font still same tiny size. I cant push MaterialMaker to change to a larger font.

Calinou commented 4 years ago

@leonard7e For the record, the hiDPI check is done here: https://github.com/RodZill4/material-maker/blob/2a848d0b08aedf045dd885a897dbcdee917db767/material_maker/main_window.gd#L121-L124

For hiDPI mode to kick in, your display needs to have a DPI greater than or equal to 192 and have a width greater than or equal to 2048 pixels. Also, maybe you need to log out and back in to apply the DPI change on Linux.

@RodZill4 We should add a --force-hidpi command-line argument to force the hiDPI mode regardless of DPI and screen resolution. This way, it can be forced in problematic cases like this one.

spkingr commented 4 years ago

My computer is Dell Precision M5510, my display resolution is 3840x2160, I downloaded the newest version 0.92, and the font is still too small to work. So I just need to clone the source code and modify the font size in theme resource, and then recompile it to use. I don't know why the HiDPI check code does not work for me.

Calinou commented 4 years ago

@spkingr Many displays have broken DPI reporting. Can you add print(OS.get_screen_dpi()) somewhere in Material Maker's startup code and tell us the value it prints?

spkingr commented 4 years ago

@spkingr Many displays have broken DPI reporting. Can you add print(OS.get_screen_dpi()) somewhere in Material Maker's startup code and tell us the value it prints?

It prints 168. I'm aware that my font or layout scale setting is 175% in Windows 10, does this matter?

Edit: It really matters! I switch the scale settings back to 100% and now it prints 96.

Calinou commented 4 years ago

@spkingr Your DPI is below 192, which means the automatic hiDPI mode won't kick in. The issue is that it only supports integer scaling (2), not fractional scaling like 1.75. Doing so is much more difficult because Godot will scale the rendering using nearest-neighbor interpolation. This would look pretty bad when used with a non-integer scaling ratio.

It is possible to filter a scaled Viewport using linear filtering, but it's more difficult as it involves using an additional TextureRect node. I guess we should add a font size setting, but it will likely break how UI elements are laid out when used.

leonard7e commented 4 years ago

I edited MM sources too. MM prints screen DPI of 91.

For XFCE4, I try out DPI == 128 now. Thats not 91…

xdpyinfo gives … (I did not touch this)

leonard@LittlePony ~> grep DPI /var/log/Xorg.0.log
[    12.334] (==) modeset(0): DPI set to (96, 96)

Thats different from 91 too.

Not sure where this '91' comes from …

Arnklit commented 4 years ago

Would it be possible to add the option to set this manually like is available in Godot? I'm having this same issue. I'm guessing the problem is that I have both a 4k screen and a 1080p screen connected. Windows 10.

Calinou commented 4 years ago

@Arnklit It looks like there's already an option for this somewhere, but there's a sanity check that prevents hiDPI from kicking in if the screen resolution is too low:

https://github.com/RodZill4/material-maker/blob/master/material_maker/main_window.gd#L178-L182

If we remove that check, we risk making Material Maker unusable when the hiDPI detection is being trigger-happy. I'm not sure if we want that.

In the meantime, try starting Material Maker while using a window on the 4K monitor instead of the 1080p monitor.

That said, hiDPI support in non-game applications isn't something we can fully fix outside the Godot editor right now. To have proper hiDPI support, we'll have to wait until https://github.com/godotengine/godot/pull/21446 is merged, which will likely only happen with Godot 4.0.

RodZill4 commented 4 years ago

@Arnklit could you please test the latest build dev? It have an option in the Preferences dialog to set the UI scale (defaults to old behavior with value 0). Thanks! https://github.com/RodZill4/material-maker/actions/runs/329813695

Arnklit commented 4 years ago

@RodZill4 Thanks that works beautifully! 👍

lloydmarquart commented 3 years ago

Is there any update on supporting UI scaling without losing resolution on HiDPI setups?

I have a 4K monitor and when I apply a custom UI scaling of anything larger than 1, everything is indeed scaled up, but without retaining its sharpness... I've attached an image to illustrate this. The window's title bar is a reference for the native resolution: As you can see at 100%, the title bar and the MM UI are both sharp and clear, but once I increase the UI scaling they become out of sync.

Untitled

I think a really good example of handling UI scaling is blender, but I don't know at all if a behavior like that could be implemented in MaterialMaker's UI. Perhaps blender dynamically resizes all texts and icons according to the scaling factor set in the preferences?

I guess one could argue that this is kind of nitpicking, but it's very apparent to me, especially when i can't see preview 2D/3D clearly without setting the UI scaling back to 1.0 (resulting in tiny text).

Otherwise really loving the app and its potential!

Calinou commented 3 years ago

I think a really good example of handling UI scaling is blender, but I don't know at all if a behavior like that could be implemented in MaterialMaker's UI. Perhaps blender dynamically resizes all texts and icons according to the scaling factor set in the preferences?

Now that https://github.com/godotengine/godot/pull/52137 is merged, this can be implemented once Material Maker is updated to use Godot 3.4 (which isn't released yet). I expect Godot 3.4 to be released in 2-4 weeks from now, but it'll take some more time for Material Maker to be updated too.

MorenoJoshua commented 8 months ago

@Arnklit could you please test the latest build dev? It have an option in the Preferences dialog to set the UI scale (defaults to old behavior with value 0). Thanks! https://github.com/RodZill4/material-maker/actions/runs/329813695

NVM, this is the answer for anyone that has issues