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

HiDPI in Linux #141

Open
bk opened this issue Aug 29, 2016 · 6 comments
Open

HiDPI in Linux #141

bk opened this issue Aug 29, 2016 · 6 comments

Comments

@bk
Copy link

bk commented Aug 29, 2016

On my Debian stretch system with a HiDPI monitor, nvPY v0.9.7 comes up with tiny fonts in menus and other visible interface elements. Message text in dialogue boxes has normal size, but the font size of buttons inside the dialogue boxes is tiny as well.

@cpbotha
Copy link
Owner

cpbotha commented Dec 2, 2016

Very strange. Could you post a screenshot?

I'm using nvpy on 2560x1440 monitors in Linux and it all works perfectly. Could you give me steps to reproduce the issue?

@bk
Copy link
Author

bk commented Dec 2, 2016

screenshot_20161202_090535

I expected interface elements such as menus and status line to match the size of the font in the window title. As you can see from the screenshot, this is not the case.

I am currently using KDE Plasma 5.8, but have seen the same issue under XFCE and Gnome (on the same computer). My screen is a Dell P2815Q (3840x2160).

It should be said that am not using "standard" 2:1 HiDPI scaling. In KDE, for instance, I have set window scaling to 1.5 and font DPI to 144. In Gnome I used a xrandr-based scaling method to get a resolution suiting my tastes. In XFCE I used the font DPI setting along with a custom theme. Most programs work well with all three methods.

@cpbotha
Copy link
Owner

cpbotha commented Dec 2, 2016

I assume you're happy with the font and font size in your notes list and editor window: Those are configurable following https://github.com/cpbotha/nvpy#making-nvpy-slightly-less-ugly-on-linux

With regard to the font size in the controls vs the fonts in your titlebar: I had a quick look, it's probably not going to be straight-forward to fix.

I can change the scaling of non-default fonts: http://stackoverflow.com/questions/34132203/scaling-of-tkinter-python-tk-gui-in-4k-38402160-resolution -- this will only help us partially.

A better solution would be to change the code so that ALL controls use custom fonts, and then make the custom font scaling configurable. At least users will be able to tweak their nvpy until it looks right on their displays. See: http://stackoverflow.com/questions/4072150/how-to-change-a-widgets-font-style-without-knowing-the-widgets-font-family-siz/4073037#4073037

In the bit of nvpy time I am able to chew off from other projects, I first need to focus on the sqlite backend (SPEED!). Let's keep this issue here for later, or until someone else steps up to the task.

@bk
Copy link
Author

bk commented Dec 2, 2016

It seems inefficient that any tkinter program must solve such issues on its own. Is there no way to globally change the defaults for tkinter (or Tk more generally) via configuration files or themes?

@cpbotha
Copy link
Owner

cpbotha commented Dec 2, 2016

I have not been able to find such an approach. If you do, please let me know!

@bk
Copy link
Author

bk commented Dec 2, 2016

I found such a way, though it is not very clean. I simply changed the file /usr/share/tcltk/tk8.6/ttk/fonts.tcl on my system:

--- fonts.tcl.bk        2016-12-02 10:40:58.313926142 +0000
+++ fonts.tcl   2016-12-02 10:44:23.591285739 +0000
@@ -131,10 +131,10 @@
            set F(family) "Helvetica"
            set F(fixed)  "courier"
        }
-       set F(size) -12
-       set F(ttsize) -10
-       set F(capsize) -14
-       set F(fixedsize) -12
+       set F(size) 10
+       set F(ttsize) 9
+       set F(capsize) 12
+       set F(fixedsize) 10
 
        font configure TkDefaultFont -family $F(family) -size $F(size)
        font configure TkTextFont    -family $F(family) -size $F(size)

It seems that the defaults for X are given in pixels (negative numbers) rather than points (positive numbers), which is the root of the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants