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

gtk: Always read gtk-xft-dpi for font scaling #4424

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

hpfr
Copy link
Contributor

@hpfr hpfr commented Jan 2, 2025

Commit ad503b8 ("linux: consider Xft.dpi to scale the content") introduced reading gtk-xft-dpi when the X11 build option is enabled.

While the name suggests it is X11-specific (perhaps it was at one point), gtk-xft-dpi is a GTK setting that can be modified regardless of GDK backend. GNOME’s Large Text accessibility setting ultimately modifies it. Outside of desktop environments, it can be set via GTK configuration files.

Remove the conditional gating the code on X11, since none of the code is actually X11-specific. While we’re here, document scaling behaviors under Config.font-size.

Fixes: ad503b8 ("linux: consider Xft.dpi to scale the content")
Fixes: #4338
Link: https://docs.gtk.org/gtk4/class.Settings.html
Link: https://docs.gtk.org/gtk4/property.Settings.gtk-xft-dpi.html

Commit ad503b8 ("linux: consider Xft.dpi to scale the content")
introduced reading gtk-xft-dpi when the X11 build option is enabled.

While the name suggests it is X11-specific (perhaps it was at one
point), gtk-xft-dpi is a GTK setting that can be modified regardless of
GDK backend. GNOME’s Large Text accessibility setting ultimately
modifies it. Outside of desktop environments, it can be set via GTK
configuration files.

Remove the conditional gating the code on X11, since none of the code is
actually X11-specific. While we’re here, document scaling behaviors
under Config.font-size.

Fixes: ad503b8 ("linux: consider Xft.dpi to scale the content")
Fixes: ghostty-org#4338
Link: https://docs.gtk.org/gtk4/class.Settings.html
Link: https://docs.gtk.org/gtk4/property.Settings.gtk-xft-dpi.html
@hpfr
Copy link
Contributor Author

hpfr commented Jan 2, 2025

Tested this on GNOME Wayland and confirmed Ghostty reacts live to the Large Text accessibility setting:

Screencast.From.2025-01-02.13-09-08.webm

The only code change is the removal of a conditional, so there’s no reason to expect it will regress X11. It wouldn’t hurt to hear from users of other Wayland compositors, though.

The change may come as a bit of a surprise to users who have modified gtk-xft-dpi in a GTK configuration file (or their DE’s equivalent, like GNOME’s Large Text toggle). If they were manually setting Ghostty’s font-size larger to match up with their other GTK applications, they won’t have to anymore. Not sure if there is a changelog entry to add somewhere? IMO this should go into 1.0.2

@mitchellh mitchellh enabled auto-merge January 2, 2025 19:55
@mitchellh mitchellh merged commit b68e9a1 into ghostty-org:main Jan 2, 2025
21 checks passed
@github-actions github-actions bot added this to the 1.0.2 milestone Jan 2, 2025
@hpfr hpfr deleted the gtk-font-scaling branch January 2, 2025 20:12
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

Successfully merging this pull request may close these issues.

GTK: Respect GNOME Large Text setting (org.gnome.desktop.interface text-scaling-factor)
3 participants