Skip to contentSkip to conversation

gitk: use symbolic font names "sans" and "monospace" when available

PATCH Applied Jonathan Nieder 4 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitk: use symbolic font names "sans" and "monospace" when available

The following only concerns systems using X and the client-side font rendering framework from freedesktop.org. Windows and Mac OS X are not affected.

Starting with version 8.5, Tk uses freetype and fontconfig by default to render fonts on platforms that support it. Gitk currently defaults to the font Helvetica for the interface and Courier for diffs, and both unfortunately look rather bad on screen in the default configuration on many Linux distros with anti-aliasing and poor hinting.

It is better to default to "sans" and "monospace", which are mapped by fontconfig to some appropriate font of the sysadmin and user's choosing (typically Bitstream Vera Sans and Mono). The result looks more sensible and it makes gitk feel like a well-behaved software citizen since its fonts match other native apps.

This patch does not change the appearance of gitk for users that have already run it, since gitk uses the remembered UI and diff font names from ~/.gitk

---
Hi,

A variant of this patch that just unconditionally set the fonts has been in Debian for more than a year, but just now I finally got around to making it conditional. Tested with tk 8.5 (where fontconfig is used) and tk 8.4 (where it isn't) and the autodetection seems to work.

Sensible?

Jonathan

 gitk-git/gitk |    5 +++++
 1 file changed, 5 insertions(+)
gitk-git/gitk +5 -0
index 64ef3c40..6981cb20 100755
@@ -11426,6 +11426,11 @@ if {[tk windowingsystem] eq "aqua"} {
     set mainfont {{Lucida Grande} 9}
     set textfont {Monaco 9}
     set uifont {{Lucida Grande} 9 bold}
+} elseif {![catch {::tk::pkgconfig get fontsystem} xft] && $xft eq "xft"} {
+    # fontconfig!
+    set mainfont {sans 9}
+    set textfont {monospace 9}
+    set uifont {sans 9 bold}
 } else {
     set mainfont {Helvetica 9}
     set textfont {Courier 9}
Signature · 1 line
1.7.9.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Jonathan Nieder

The following only concerns systems using X and the client-side font rendering framework from freedesktop.org. Windows and Mac OS X are not affected.

Starting with version 8.5, Tk uses freetype and fontconfig by default to render fonts on platforms that support it. Gitk currently defaults to the font Helvetica for the interface and Courier for diffs, and both unfortunately look rather bad on screen in the default configuration on many Linux distros with anti-aliasing and poor hinting.

It is better to default to "sans" and "monospace", which are mapped by fontconfig to some appropriate font of the sysadmin and user's choosing (typically Bitstream Vera Sans and Mono). The result looks more sensible and it makes gitk feel like a well-behaved software citizen since its fonts match other native apps.

Quoted 6 lines

This patch does not change the appearance of gitk for users that have already run it, since gitk uses the remembered UI and diff font names from ~/.gitk

Quoted 34 lines

---
Hi,

A variant of this patch that just unconditionally set the fonts has been in Debian for more than a year, but just now I finally got around to making it conditional. Tested with tk 8.5 (where fontconfig is used) and tk 8.4 (where it isn't) and the autodetection seems to work.

Sensible?

Jonathan

 gitk-git/gitk |    5 +++++
 1 file changed, 5 insertions(+)
gitk-git/gitk +5 -0
index 64ef3c40..6981cb20 100755
@@ -11426,6 +11426,11 @@ if {[tk windowingsystem] eq "aqua"} {
     set mainfont {{Lucida Grande} 9}
     set textfont {Monaco 9}
     set uifont {{Lucida Grande} 9 bold}
+} elseif {![catch {::tk::pkgconfig get fontsystem} xft] && $xft eq "xft"} {
+    # fontconfig!
+    set mainfont {sans 9}
+    set textfont {monospace 9}
+    set uifont {sans 9 bold}
 } else {
     set mainfont {Helvetica 9}
     set textfont {Courier 9}
Signature · 1 line
1.7.9.2
Acked-by on v1 1/1
#3 lore raw
In reply to Jonathan Nieder
Quoted 17 lines · Jonathan Nieder

The following only concerns systems using X and the client-side font rendering framework from freedesktop.org. Windows and Mac OS X are not affected.

Starting with version 8.5, Tk uses freetype and fontconfig by default to render fonts on platforms that support it. Gitk currently defaults to the font Helvetica for the interface and Courier for diffs, and both unfortunately look rather bad on screen in the default configuration on many Linux distros with anti-aliasing and poor hinting.

It is better to default to "sans" and "monospace", which are mapped by fontconfig to some appropriate font of the sysadmin and user's choosing (typically Bitstream Vera Sans and Mono). The result looks more sensible and it makes gitk feel like a well-behaved software citizen since its fonts match other native apps.

Quoted 6 lines

This patch does not change the appearance of gitk for users that have already run it, since gitk uses the remembered UI and diff font names from ~/.gitk

Sounds reasonable to me.

Quoted 32 lines

---
Hi,

A variant of this patch that just unconditionally set the fonts has been in Debian for more than a year, but just now I finally got around to making it conditional. Tested with tk 8.5 (where fontconfig is used) and tk 8.4 (where it isn't) and the autodetection seems to work.

Sensible?

Jonathan

 gitk-git/gitk |    5 +++++
 1 file changed, 5 insertions(+)
gitk-git/gitk +5 -0
index 64ef3c40..6981cb20 100755
@@ -11426,6 +11426,11 @@ if {[tk windowingsystem] eq "aqua"} {
     set mainfont {{Lucida Grande} 9}
     set textfont {Monaco 9}
     set uifont {{Lucida Grande} 9 bold}
+} elseif {![catch {::tk::pkgconfig get fontsystem} xft] && $xft eq "xft"} {
+    # fontconfig!
+    set mainfont {sans 9}
+    set textfont {monospace 9}
+    set uifont {sans 9 bold}
 } else {
     set mainfont {Helvetica 9}
     set textfont {Courier 9}
Signature · 1 line
Mark
#4 lore raw
In reply to Jonathan Nieder
Quoted 17 lines · Jonathan Nieder

The following only concerns systems using X and the client-side font rendering framework from freedesktop.org. Windows and Mac OS X are not affected.

Starting with version 8.5, Tk uses freetype and fontconfig by default to render fonts on platforms that support it. Gitk currently defaults to the font Helvetica for the interface and Courier for diffs, and both unfortunately look rather bad on screen in the default configuration on many Linux distros with anti-aliasing and poor hinting.

It is better to default to "sans" and "monospace", which are mapped by fontconfig to some appropriate font of the sysadmin and user's choosing (typically Bitstream Vera Sans and Mono). The result looks more sensible and it makes gitk feel like a well-behaved software citizen since its fonts match other native apps.

Quoted 6 lines

This patch does not change the appearance of gitk for users that have already run it, since gitk uses the remembered UI and diff font names from ~/.gitk

Thanks, applied.

Paul.

#5 lore raw
Quoted 1 line · Paul Mackerras

Thanks, applied.

Thanks to all of you for looking it over.