summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--st/x.c15
1 files changed, 15 insertions, 0 deletions
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) ==