[dev] [dmenu] Handle invalid font names
Hi suckless team, I noticed that dmenu doesn't complain when supplied with a font that doesn't exist (e.g., dmenu -fn suckless). I found the following line in the code: drw.c:134 fprintf(stderr, "error, cannot load font: '%s'\n", fontname); so I am guessing this is a bug and not the intended behavior. Keep up the good work! Cheers, Ilias
Re: [dev] [dmenu] Handle invalid font names
On Mon, Oct 19, 2015 at 12:53:50PM +0300, Ilias Tsitsimpis wrote: > so I am guessing this is a bug and not the intended behavior. > > Keep up the good work! Jeez. No need to go all sarcastic just because of one little bug.
Re: [dev] [dmenu] Handle invalid font names
On Mon, Oct 19, 2015 at 11:00AM, Staven wrote: > On Mon, Oct 19, 2015 at 12:53:50PM +0300, Ilias Tsitsimpis wrote: > > so I am guessing this is a bug and not the intended behavior. > > > > Keep up the good work! > > Jeez. No need to go all sarcastic just because of one little bug. I wasn't sarcastic. They are doing a great work.
Re: [dev] [dmenu] Handle invalid font names
On Mon, 19 Oct 2015 12:53:50 +0300 Ilias Tsitsimpis wrote: > I noticed that dmenu doesn't complain when supplied with a font that > doesn't exist (e.g., dmenu -fn suckless). > > I found the following line in the code: > > drw.c:134 fprintf(stderr, "error, cannot load font: '%s'\n", > fontname); It looks like that line of code will never be executed as long as xft can find a usable font. According to http://stackoverflow.com/a/17176477 , that's the intended behavior and nobody will fix it. "4. forget about matching a specific font file. fontconfig will actively fight any attempt to work this way. In the post-core-fonts world, you give the font system a font pattern, and it will build a matching font for you. If the result is not the font file you expected that's because the file was evaluated and found lacking." Actually, they say to not use xft directly at all... Apparently, the xft(3) man page is wrong: "XftFontOpen takes a list of pattern element triples of the form field, type, value (terminated with a NULL), matches that pattern against the available fonts, and opens the matching font, sizing it correctly for screen number screen on display dpy. The Display data type is defined by the X11 library. Returns NULL if no match is found." Not sure what to do about this... I like to know when the specific font I asked for doesn't exist or can't be loaded. I guess the only thing you can do is verify that it's the right font by its appearance? -- Matt Boswell () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - and proprietary attachments
Re: [dev] [dmenu] Handle invalid font names
On Mon, Oct 19, 2015 at 11:53 AM, Ilias Tsitsimpis wrote: > Hi suckless team, > > I noticed that dmenu doesn't complain when supplied with a font that > doesn't exist (e.g., dmenu -fn suckless). > > I found the following line in the code: > > drw.c:134 fprintf(stderr, "error, cannot load font: '%s'\n", fontname); > > so I am guessing this is a bug and not the intended behavior. > I'm aware of this behaviour, it is "intended" as we use Xft and it's not too bothersome. Ofcourse you can use the fc-match program to see what font actually will be used. Note that dmenu will error out when no font can be loaded: if (!drw->fontcount) in dmenu.c. Kind regards, Hiltjo