diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2024-10-10 19:49:25 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2024-10-10 19:49:25 +0900 |
| commit | 170af86eced1c4c15c47617e80a29498f4f2f576 (patch) | |
| tree | 2c9be851f206137fb413b84879dd9658ac71b54f /st/x.c | |
| parent | c03a1a680b86c43e2bf29df97de9825ab5c20caa (diff) | |
Init
Diffstat (limited to 'st/x.c')
| -rw-r--r-- | st/x.c | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -1045,21 +1045,6 @@ 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 @@ -1327,7 +1312,24 @@ xinit(int cols, int rows) die("could not init fontconfig.\n"); usedfont = (opt_font == NULL)? fonts[currentfont] : opt_font; - xloadfonts(usedfont, 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) { + xloadfonts(usedfont, 12); + } else { + xloadfonts(usedfont, 0); + } + /* spare fonts */ xloadsparefonts(); |
