Adding use XftFontMatch patch

This commit is contained in:
Bakkeby 2022-08-28 21:05:55 +02:00
parent cc36f7c256
commit 2906447fef
3 changed files with 28 additions and 4 deletions

View File

@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog:
2022-08-28 - Added the use XftFontMatch patch
2022-08-24 - Added the no window decorations patch
2022-04-11 - Added the background image reload patch
@ -264,6 +266,10 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- allows mouse scroll without modifier keys for regardless of alt screen using the external
scroll program
- [use-XftFontMatch](https://git.suckless.org/st/commit/528241aa3835e2f1f052abeeaf891737712955a0.html)
- use XftFontMatch in place of FcFontMatch to allow font to scale with Xft.dpi resource
setting
- [vertcenter](https://st.suckless.org/patches/vertcenter/)
- vertically center lines in the space available if you have set a larger chscale in config.h

View File

@ -373,6 +373,20 @@
*/
#define UNIVERSCROLL_PATCH 0
/* Use XftFontMatch in place of FcFontMatch.
*
* XftFontMatch calls XftDefaultSubstitute which configures various match properties according
* to the user's configured Xft defaults (xrdb) as well as according to the current display and
* screen. Most importantly, the screen DPI is computed [1]. Without this, st uses a "default"
* DPI of 75 [2].
*
* [1]: https://cgit.freedesktop.org/xorg/lib/libXft/tree/src/xftdpy.c?id=libXft-2.3.2#n535
* [2]: https://cgit.freedesktop.org/fontconfig/tree/src/fcdefault.c?id=2.11.1#n255
*
* https://git.suckless.org/st/commit/528241aa3835e2f1f052abeeaf891737712955a0.html
*/
#define USE_XFTFONTMATCH_PATCH 0
/* Vertically center lines in the space available if you have set a larger chscale in config.h
* https://st.suckless.org/patches/vertcenter/
*/

12
x.c
View File

@ -1216,7 +1216,11 @@ xloadfont(Font *f, FcPattern *pattern)
FcConfigSubstitute(NULL, configured, FcMatchPattern);
XftDefaultSubstitute(xw.dpy, xw.scr, configured);
#if USE_XFTFONTMATCH_PATCH
match = XftFontMatch(xw.dpy, xw.scr, pattern, &result);
#else
match = FcFontMatch(NULL, configured, &result);
#endif // USE_XFTFONTMATCH_PATCH
if (!match) {
FcPatternDestroy(configured);
return 1;
@ -1735,12 +1739,12 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
fccharset);
FcPatternAddBool(fcpattern, FC_SCALABLE, 1);
FcConfigSubstitute(0, fcpattern,
FcMatchPattern);
#if !USE_XFTFONTMATCH_PATCH
FcConfigSubstitute(0, fcpattern, FcMatchPattern);
FcDefaultSubstitute(fcpattern);
#endif // USE_XFTFONTMATCH_PATCH
fontpattern = FcFontSetMatch(0, fcsets, 1,
fcpattern, &fcres);
fontpattern = FcFontSetMatch(0, fcsets, 1, fcpattern, &fcres);
/* Allocate memory for the new cache entry. */
if (frclen >= frccap) {