Skip to content

Commit f019c96

Browse files
committed
git-gui: Honor system font and let user configure fonts.
Rather than hardcoding our fonts to something that I thought was reasonable, guess font_ui off the font used by the system in the menu bar. This way the application conforms by default to whatever the user's desktop is setup to. We also now let the user supply font configuration through their repository configuration as gui.fontui (the overall UI font) and gui.fontdiff (the font used for the diff viewer). Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 058803f commit f019c96

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

git-gui

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,9 +1566,16 @@ proc unclick {w x y} {
15661566
##
15671567
## ui init
15681568

1569-
set font_ui {Helvetica 10}
1570-
set font_diff {Courier 10}
1571-
set cursor_ptr left_ptr
1569+
set font_ui {}
1570+
set font_diff {}
1571+
set cursor_ptr {}
1572+
menu .mbar -tearoff 0
1573+
catch {set font_ui [lindex $repo_config(gui.fontui) 0]}
1574+
catch {set font_diff [lindex $repo_config(gui.fontdiff) 0]}
1575+
if {$font_ui == {}} {catch {set font_ui [.mbar cget -font]}}
1576+
if {$font_ui == {}} {set font_ui {Helvetica 10}}
1577+
if {$font_diff == {}} {set font_diff {Courier 10}}
1578+
if {$cursor_ptr == {}} {set cursor_ptr left_ptr}
15721579

15731580
switch -glob -- "$tcl_platform(platform),$tcl_platform(os)" {
15741581
windows,* {set M1B Control; set M1T Ctrl}
@@ -1577,7 +1584,6 @@ unix,Darwin {set M1B M1; set M1T Cmd}
15771584
}
15781585

15791586
# -- Menu Bar
1580-
menu .mbar -tearoff 0
15811587
.mbar add cascade -label Project -menu .mbar.project
15821588
.mbar add cascade -label Edit -menu .mbar.edit
15831589
.mbar add cascade -label Commit -menu .mbar.commit

0 commit comments

Comments
 (0)