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

Font is too small on HiDPI display #4

Open
hydrargyrum opened this issue Dec 29, 2019 · 14 comments
Open

Font is too small on HiDPI display #4

hydrargyrum opened this issue Dec 29, 2019 · 14 comments
Labels
good first issue Good for newcomers ui

Comments

@hydrargyrum
Copy link
Owner

Also, how do I increase the diaplay font, etc? I am on a HiDPi device so this is an issue.

Originally posted by @maitra in #2 (comment)

@hydrargyrum hydrargyrum added ui good first issue Good for newcomers labels Dec 29, 2019
@maitra
Copy link

maitra commented Dec 29, 2019

I use openbox. Some applications (example, sakura) rescale and some others (example, xterm) need different fonts. The size of the window needs to be set according to the application. The font can be internally changed.

@hydrargyrum
Copy link
Owner Author

@maitra not exactly sure how to fix or even to test it.

I don't have a big enough resolution so I tried to emulate one by launching a Xephyr virtual display bigger than my resolution, and added a "-dpi 192" argument, and run Lierre within the Xephyr env, but Lierre text looked much bigger than a basic app like xterm for example.

What Qt version do you have? Can you tell more about your setup? How many DPI is your display and does the X server give the info to apps? Can you try export QT_AUTO_SCREEN_SCALE_FACTOR=1 in a terminal where you will run Lierre, to test if this changes anything?

I pushed a patch that enabled a better pixmap display qt option, but it should not affect text I believe. Can't do bad anyway.

@maitra
Copy link

maitra commented Jan 6, 2020

@maitra not exactly sure how to fix or even to test it.

I don't have a big enough resolution so I tried to emulate one by launching a Xephyr virtual display bigger than my resolution, and added a "-dpi 192" argument, and run Lierre within the Xephyr env, but Lierre text looked much bigger than a basic app like xterm for example.

What Qt version do you have?

qt: 4.8.7
qt5: 5.12.5

Can you tell more about your setup? How many DPI is your display and does the X server give the info to apps?

Don't know, how do I figure this out?

Can you try export QT_AUTO_SCREEN_SCALE_FACTOR=1 in a terminal where you will run Lierre, to test if this changes anything?

No, changes nothing.

I pushed a patch that enabled a better pixmap display qt option, but it should not affect text I believe. Can't do bad anyway.

OK, I will try, thanks!

@maitra
Copy link

maitra commented Jan 6, 2020

There appears to have been no commit for the past 8 days so perhaps not pushed?

@hydrargyrum
Copy link
Owner Author

Don't know, how do I figure this out?

Can you try those commands?

  • xrandr -q | grep connected
  • xdpyinfo | grep dots

@maitra
Copy link

maitra commented Jan 8, 2020

Thanks!

Can you try those commands?

* `xrandr -q | grep connected`
eDP-1 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 294mm x 165mm
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
* `xdpyinfo | grep dots`

resolution: 96x96 dots per inch

@hydrargyrum
Copy link
Owner Author

resolution: 96x96 dots per inch

This is interesting, 96dpi isn't high density.

On a typical 23 inches screen, physical screen dimensions can be 508x286 millimeters.
Since I don't have a hidpi screen at hand, I tested those configurations:

  1. Xephyr -screen 1920/508x1080/286
    Basic display, Lierre has readable text, the same as an unconfigured xterm.
    xdpyinfo gives: resolution: 96x96 dots per inch

  2. Xephyr -screen 3840x2160
    Big display, Lierre is very small and is unreadable, the same as an unconfigured xterm.
    xdpyinfo gives: resolution: 96x96 dots per inch (and computes 1016x572 mm size)

  3. Xephyr -screen 3840/508x2160/286:
    Big display, Lierre has readable text, much bigger text than an unconfigured xterm.
    xdpyinfo gives: resolution: 192x192 dots per inch

It seems that when the X server knows the correct physical screen dimensions, it computes higher dpi, and Lierre (thanks to PyQt) displays bigger text accordingly to higher dpi.

So it seems your X server is like my second test case. Maybe your screen physical dimensions aren't detected properly, making dpi as low as 96?

Can you give the output of this command? Is the reported screen size in millimeters approximately corresponding to your device dimensions?
xdpyinfo | grep -B2 resolution
(those reported by xrandr are never correct)

Do you typically run GTK apps? Or other Qt/PyQt apps? Do they display correctly or did you configure them?

Can you test this very basic PyQt app to see if the problem is specific to Lierre or PyQt? https://gist.github.com/hydrargyrum/407c9c268a0fe7138f9309d4bdae929a

@maitra
Copy link

maitra commented Jan 8, 2020

resolution: 96x96 dots per inch

This is interesting, 96dpi isn't high density.

On a typical 23 inches screen, physical screen dimensions can be 508x286 millimeters.
Since I don't have a hidpi screen at hand, I tested those configurations:

1. `Xephyr -screen 1920/508x1080/286`
   Basic display, Lierre has readable text, the same as an unconfigured xterm.
   xdpyinfo gives: `resolution:    96x96 dots per inch`

2. `Xephyr -screen 3840x2160`
   Big display, Lierre is very small and is unreadable, the same as an unconfigured xterm.
   xdpyinfo gives: `resolution:    96x96 dots per inch` (and computes `1016x572 mm` size)

3. `Xephyr -screen 3840/508x2160/286`:
   Big display, Lierre has readable text, much bigger text than an unconfigured xterm.
   xdpyinfo gives: `resolution:    192x192 dots per inch`

It seems that when the X server knows the correct physical screen dimensions, it computes higher dpi, and Lierre (thanks to PyQt) displays bigger text accordingly to higher dpi.

So it seems your X server is like my second test case. Maybe your screen physical dimensions aren't detected properly, making dpi as low as 96?

Can you give the output of this command? Is the reported screen size in millimeters approximately corresponding to your device dimensions?
xdpyinfo | grep -B2 resolution
(those reported by xrandr are never correct)

$ xdpyinfo | grep -B2 resolution
screen #0:
  dimensions:    3840x2160 pixels (1016x571 millimeters)
  resolution:    96x96 dots per inch


Do you typically run GTK apps? Or other Qt/PyQt apps? Do they display correctly or did you configure them?

Some of the apps display correctly, others (and xterm) I change the font and then they work. So the answer is really a mix.

Can you test this very basic PyQt app to see if the problem is specific to Lierre or PyQt? https://gist.github.com/hydrargyrum/407c9c268a0fe7138f9309d4bdae929a

Yes, it is small, about 40 mm, but I can read it. The font is the same size as with lierre.

Thanks!

@altendky
Copy link

altendky commented Jan 9, 2020

What is the actual display size? Have you done anything with the system to try to configure the dpi, scaling, or physical screen dimensions?

@maitra
Copy link

maitra commented Jan 9, 2020

What is the actual display size? Have you done anything with the system to try to configure the dpi, scaling, or physical screen dimensions?

I am on a Dell XPS 13 9370 with 4K resolution. I use openbox. I was suggested to put the following in my .Xresources:
!-------------------------------------------- ! Custom DPI !-------------------------------------------- !Xft.dpi: 144 Xft.dpi: 192 Xft.autohint: 0 Xft.lcdfilter: lcddefault Xft.hintstyle: hintslight Xft.hinting: true Xft.antialias: 1 Xft.rgba: rgb Xcursor.size: 32
which I did. It was also suggested that I put the following in my .xinitrc:

xrandr --dpi 192

but I did not need to. (What that means is that it did not make any difference from what I could tell.)

@maitra
Copy link

maitra commented Jan 9, 2020

Btw, how do I change the font for lierre? Where is it taking its font from?

@hydrargyrum
Copy link
Owner Author

Btw, how do I change the font for lierre?

Now, there's nothing for it. What's intended is that the desktop environment sets it globally and consistently for apps.

Where is it taking its font from?

Qt settings/computations I guess.

xrandr --dpi 192

Didn't it change anything?
Or echo Xft.dpi: 144 | xrdb - before running Lierre?

For X to have to detect the correct DPI: https://wiki.archlinux.org/index.php/Xorg#Display_size_and_DPI
Can you try this: https://wiki.archlinux.org/index.php/HiDPI#Qt_5 ?

@maitra
Copy link

maitra commented Jan 9, 2020

OK, I got this to work, by setting it manually. I tried:

export QT_AUTO_SCREEN_SCALE_FACTOR=1

QT_FONT_DPI=288 lierre

But the window is too small and I wonder if I can make it bigger without mousing it every time it opens.

@altendky
Copy link

altendky commented Jan 9, 2020

It really sounds like the system should be configured correctly rather than solving this just for Lierre. I'm just a passerby and even then not trying to terminate any conversation, but it does seem like the best help would be gotten from people familiar with the OS etc in question. Solving that may help other applications as well.

Also, the DPI for that screen is more like 339 (based on 4k and 13"). Though sure, maybe there's some benefit to multiples of 96. Though many systems do 125%, 150% etc, at least back in the FHD days. :]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers ui
Projects
None yet
Development

No branches or pull requests

3 participants