You are not logged in.

#1 2024-01-31 13:26:25

young_kaneda
Member
Registered: 2022-10-04
Posts: 40

[SOLVED] GTK2 and GTK3 shows different font sizes for the same value

Hello guys, having a hard time trying to figure out something that is really bothering me, I used LXAppearence to change the font size for GTK applications, unfortunately the font size looks ok for GTK3 applications, but when it comes to GTK2 apps its a different story, it appers really big, even on the LXAppearence GUI the font size already looks huge, but when comes to apps like my browser or something the font size is what it was supposed to be, so usually I have to change manually the gtkrc-2.0 to a smaller font to everything looks similar.

Last edited by young_kaneda (2026-05-23 00:36:56)

Offline

#2 2024-01-31 13:47:25

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,034

Re: [SOLVED] GTK2 and GTK3 shows different font sizes for the same value

Probably sth. around https://wiki.archlinux.org/title/Hidpi - look at

xrandr -q
xdpyinfo | grep resolution
xrdb -q | grep -i dpi
printenv

Offline

#3 2024-01-31 16:34:07

young_kaneda
Member
Registered: 2022-10-04
Posts: 40

Re: [SOLVED] GTK2 and GTK3 shows different font sizes for the same value

seth wrote:

Probably sth. around https://wiki.archlinux.org/title/Hidpi - look at

xrandr -q
xdpyinfo | grep resolution
xrdb -q | grep -i dpi
printenv

xrandr -q

Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
DP-0 disconnected primary (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-4 connected 2560x1600+0+0 (normal left inverted right x axis y axis) 345mm x 215mm
   2560x1600     60.00*+ 240.00

One thing i noted here, I only has one resolution available, but on nvidia-settings it shows the others as (scaled)

xdpyinfo | grep resolution

resolution:    191x184 dots per inch

xrdb -q | grep -i dpi (It shows nothing)

printenv

SHELL=/usr/bin/bash
WINDOWID=18874379
COLORTERM=truecolor
GLFW_IM_MODULE=ibus
GTK_IM_MODULE=fcitx
CREDENTIALS_DIRECTORY=/run/credentials/getty@tty1.service
MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=
XMODIFIERS=@im=fcitx
KITTY_PID=3226
GTK_MODULES=canberra-gtk-module
XDG_SEAT=seat0
PWD=/home/kaneda
LOGNAME=kaneda
QT_QPA_PLATFORMTHEME=qt5ct
XDG_SESSION_TYPE=tty
SYSTEMD_EXEC_PID=676
XAUTHORITY=/home/kaneda/.Xauthority
KITTY_PUBLIC_KEY=1:{-sL}s0eE>ra4X@vT0|mb^Tf<IH)i{a+ARhW=ymw
TERMINAL=/usr/bin/kitty
WINDOWPATH=1
MOTD_SHOWN=pam
HOME=/home/kaneda
LANG=en_US.UTF-8
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/system.slice/system-getty.slice/getty@tty1.service/memory.pressure
KITTY_WINDOW_ID=1
INVOCATION_ID=243b62a74fee4858bb6809097a0b7d66
XDG_SESSION_CLASS=user
TERMINFO=/usr/lib/kitty/terminfo
TERM=xterm-kitty
USER=kaneda
DISPLAY=:0
SHLVL=3
QT_IM_MODULE=fcitx
XDG_VTNR=1
XDG_SESSION_ID=1
XDG_RUNTIME_DIR=/run/user/1000
PS1=\[\e]133;k;start_kitty\a\]\[\e]133;A\a\]\[\e]133;k;end_kitty\a\]\[\e]0;\u@\h: \w\a\]\[\033[01;33m\]\u@\h\[\033[00m\]:\[\033[01;35m\]\w\[\033[00m\]$ \[\e]133;k;start_suffix_kitty\a\]\[\e[5 q\]\[\e]2;\w\a\]\[\e]133;k;end_suffix_kitty\a\]
DEBUGINFOD_URLS=https://debuginfod.archlinux.org
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/kaneda
KITTY_INSTALLATION_DIR=/usr/lib/kitty
_=/usr/bin/printenv

Offline

#4 2024-01-31 16:53:19

young_kaneda
Member
Registered: 2022-10-04
Posts: 40

Re: [SOLVED] GTK2 and GTK3 shows different font sizes for the same value

I actually solved, put the Xft.dpi as 96 (100%) and did the trick.

Offline

#5 2024-01-31 20:11:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,034

Re: [SOLVED] GTK2 and GTK3 shows different font sizes for the same value

Sanity check: the 190dpi roughly match your physical resolution, a sane™ default font size would be 8pt-12pt: do you currently use such font size or did you configure everything toobig™ (20pt+) and now adjusted gtk2 to render at 96dpi?

In the latter case it's probably more advisable to set the proper xft dpi and a sane™ font size and fix everything else for the HiDPI setup.
If you absolutely don't want to do that, you should adjust the server DPI (xdpyinfo value) to 96dpi as well.
Diverging DPI settings will rather cause you the most headaches.

Offline

Board footer

Powered by FluxBB