diff options
Diffstat (limited to 'st/x.c')
| -rw-r--r-- | st/x.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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) == |
