dmenu: fix build on older fontconfig (NetBSD 8.0)

This commit is contained in:
maya 2019-03-03 13:12:03 +00:00
parent 1d38e52b3c
commit e3147f79ba
2 changed files with 35 additions and 1 deletions

View file

@ -1,6 +1,7 @@
$NetBSD: distinfo,v 1.12 2019/02/03 21:54:01 leot Exp $
$NetBSD: distinfo,v 1.13 2019/03/03 13:12:03 maya Exp $
SHA1 (dmenu-4.9.tar.gz) = 73d1a9a844e8f285fc315ea4ee5b95da2b0bc8f4
RMD160 (dmenu-4.9.tar.gz) = fbaf4597df4596e0e7b1bf85adac5aa222e60469
SHA512 (dmenu-4.9.tar.gz) = c2779209fe012de8ca1cdd72923da6d594f4a8368c85c3c0e0afd4ae489a95fe0e6f05a947d115b6b389aa7170ab14c2c645a2031353b0a08f38327ab461fe65
Size (dmenu-4.9.tar.gz) = 15972 bytes
SHA1 (patch-drw.c) = c391b7ac6f60cce02d63c09c8cfb23ec5d3d46ef

View file

@ -0,0 +1,33 @@
$NetBSD: patch-drw.c,v 1.1 2019/03/03 13:12:03 maya Exp $
Workaround FC_COLOR not being available on fontconfig < 2.11.91
(NetBSD-8.0)
This is mostly code to reject colored fonts, so ifdef'ing it out is safe.
--- drw.c.orig 2019-02-02 12:55:02.000000000 +0000
+++ drw.c
@@ -139,11 +139,13 @@ xfont_create(Drw *drw, const char *fontn
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
* and lots more all over the internet.
*/
+#ifdef FC_COLOR
FcBool iscol;
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
XftFontClose(drw->dpy, xfont);
return NULL;
}
+#endif
font = ecalloc(1, sizeof(Fnt));
font->xfont = xfont;
@@ -350,7 +352,9 @@ drw_text(Drw *drw, int x, int y, unsigne
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
+#ifdef FC_COLOR
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
+#endif
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
FcDefaultSubstitute(fcpattern);