From 2af8249b5eb163b84690caa696926dce495b3e36 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Sat, 11 Jan 2025 16:38:16 +0900 Subject: modified st/x.c --- st/x.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'st') diff --git a/st/x.c b/st/x.c index 5b26611..86bcaa1 100644 --- a/st/x.c +++ b/st/x.c @@ -1174,6 +1174,21 @@ xloadsparefonts(void) die("can't open spare font %s\n", *fp); if (defaultfontsize > 0) { + // Get screen resolution + Display *dpy = XOpenDisplay(NULL); + if (!dpy) { + die("can't open display\n"); + } + int screen = DefaultScreen(dpy); + int width = XDisplayWidth(dpy, screen); + int height = XDisplayHeight(dpy, screen); + XCloseDisplay(dpy); // Close the display after getting resolution + + // If the resolution is under 1024x768, set the fontsize to 12 + if (width <= 1024 && height <= 768) { + defaultfontsize = 10; + } + sizeshift = usedfontsize - defaultfontsize; if (sizeshift != 0 && FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) == -- cgit v1.2.3