diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2024-10-06 22:48:27 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2024-10-06 22:48:27 +0900 |
| commit | e078b1fd10e2c1e4854b4d4718e6d34310ff0314 (patch) | |
| tree | 4ecb397a4b9054b00227f87cb78240bebd789633 | |
| parent | 408ec6458256197ecd9042b1933b1165714897ff (diff) | |
Init
| -rw-r--r-- | st/x.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1045,6 +1045,21 @@ xloadfonts(const char *fontstr, double fontsize) FcPattern *pattern; double fontval; + // 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) { + fontsize = 12; + } + if (fontstr[0] == '-') pattern = XftXlfdParse(fontstr, False, False); else |
