From 7f4cccde2ae53c083ababaaea19be4a9c45b7091 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 10 Jan 2025 08:15:11 +0000 Subject: [PATCH] GTK: fixes to the previous font fallback patch. I'd forgotten that I'd already chosen a default client-side font, for NOT_X_WINDOWS builds. I should have made the two defaults match! Now both default font names are defined in the header file. --- unix/platform.h | 16 +++++++++++++--- unix/window.c | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/unix/platform.h b/unix/platform.h index 670febd7..413a0282 100644 --- a/unix/platform.h +++ b/unix/platform.h @@ -394,12 +394,22 @@ void setup_fd_socket(Socket *s, int infd, int outfd, int inerrfd); void fd_socket_set_psb_prefix(Socket *s, const char *prefix); /* - * Default font setting, which can vary depending on NOT_X_WINDOWS. + * Default font settings. We have a default font for each of + * client-side and server-side, so that we can use one of each as a + * fallback, and we also have a single overall default which goes into + * Conf to populate the initial state of Default Settings. + * + * The overall default varies depending on NOT_X_WINDOWS: if X is + * available then the default is xterm's traditional "fixed", but if + * it's not, so that only client-side fonts can be used at all, we + * switch to a client-side default. */ +#define DEFAULT_GTK_CLIENT_FONT "client:Monospace 12" +#define DEFAULT_GTK_SERVER_FONT "server:fixed" #ifdef NOT_X_WINDOWS -#define DEFAULT_GTK_FONT "client:Monospace 12" +#define DEFAULT_GTK_FONT DEFAULT_GTK_CLIENT_FONT #else -#define DEFAULT_GTK_FONT "server:fixed" +#define DEFAULT_GTK_FONT DEFAULT_GTK_SERVER_FONT #endif /* diff --git a/unix/window.c b/unix/window.c index 3316f996..7302dc2c 100644 --- a/unix/window.c +++ b/unix/window.c @@ -5361,8 +5361,8 @@ void new_session_window(Conf *conf, const char *geometry_string) goto fonts_ok; static const char *const fallbacks[] = { - "client:Monospace 10", - "server:fixed", + DEFAULT_GTK_CLIENT_FONT, + DEFAULT_GTK_SERVER_FONT, }; for (size_t i = 0; i < lenof(fallbacks); i++) { Conf *fallback_conf = conf_new();