public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix default font scaling
@ 2024-06-15  8:53 Serhii Tereshchenko
  2024-06-15 16:32 ` Eric Sunshine
  2024-06-16 10:30 ` Johannes Sixt
  0 siblings, 2 replies; 12+ messages in thread
From: Serhii Tereshchenko @ 2024-06-15  8:53 UTC (permalink / raw)
  To: git; +Cc: Serhii Tereshchenko

This fixes font scaling for default fonts, where we don't set font
sizes explicitly.

Without this, on 4k monitor with text-scaling-factor configured in Gnome,
labels, buttons and settings are using very small font sizes. (Probably,
not just Gnome but anything that sets custom DPI).

Screenshots here: https://twiukraine.com/@partizan/112619567918546426

Signed-off-by: Serhii Tereshchenko <serg.partizan@gmail.com>
---
 git-gui.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/git-gui.sh b/git-gui.sh
index 8bc8892..23dd82d 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -810,6 +810,16 @@ if {[is_Windows]} {
 ## config defaults
 
 set cursor_ptr arrow
+
+# For whatever reason, Tk does not apply font scaling to default fonts,
+# but applies font scaling when setting size explicitly.
+# Default -size 10 is still 10, when you look at it with `font actual ...`,
+# but explicitl -size 10 becomes 10 * scale factor.
+# So, we need to configure fonts to use their default font sizes, but scaled.
+foreach font_name [font names] {
+	font configure $font_name -size [font actual $font_name -size]
+}
+
 font create font_ui
 if {[lsearch -exact [font names] TkDefaultFont] != -1} {
 	eval [linsert [font actual TkDefaultFont] 0 font configure font_ui]
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-06-23 15:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-15  8:53 [PATCH] Fix default font scaling Serhii Tereshchenko
2024-06-15 16:32 ` Eric Sunshine
2024-06-16 10:30 ` Johannes Sixt
2024-06-16 12:37   ` Serhii Tereshchenko
2024-06-20 17:24     ` Johannes Sixt
2024-06-20 18:11       ` Serhii Tereshchenko
2024-06-20 22:04         ` Johannes Sixt
2024-06-21  7:18           ` Serhii Tereshchenko
2024-06-23  9:13             ` Johannes Sixt
2024-06-23 10:11               ` serg.partizan
2024-06-23 14:00                 ` serg.partizan
2024-06-23 15:50                   ` Johannes Sixt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox