dwm-flexipatch icon indicating copy to clipboard operation
dwm-flexipatch copied to clipboard

Set default font in config.h

Open plum opened this issue 3 years ago • 9 comments

Hello, and thank you for yor greta work, of which boogles my mind, as to how you do this patch scri[pting. Amazing!

My question: I cannot see the line: static const char font[] in the config.def.h.

I do see: static const char font[] = "monospace 10"; #else static const char *fonts[] = { "monospace:size=10" }; #endif // BAR_PANGO_PATCH static const char dmenufont[] = "monospace:size=10";

Way I wish to do is set the font for dmenu, because somehow what i have now is unacceptably wide spacing, unreadable.

plum avatar Apr 05 '21 09:04 plum

So you have this right which is controls the font used for dwm, more specifically the font used for the bar. https://github.com/bakkeby/dwm-flexipatch/blob/905dc4d7afda05ca5dcc7c2f6dc9f0b25c7f8cda/config.def.h#L103-L107

You can add multiple (fallback) fonts if you want to, but the pango patch only supports a single font hence it has a separate config, but all of this is unrelated to what you are asking about.

If you look at how dmenu is spawned then we see that a variable dmenucmd is used https://github.com/bakkeby/dwm-flexipatch/blob/905dc4d7afda05ca5dcc7c2f6dc9f0b25c7f8cda/config.def.h#L785

which is defined as such: https://github.com/bakkeby/dwm-flexipatch/blob/905dc4d7afda05ca5dcc7c2f6dc9f0b25c7f8cda/config.def.h#L749-L763

The font passed to dmenu is defined by a variable dmenufont as seen here: https://github.com/bakkeby/dwm-flexipatch/blob/905dc4d7afda05ca5dcc7c2f6dc9f0b25c7f8cda/config.def.h#L108

That is where you would set the font for dmenu.

Alternatively you could change the command to not pass in the -fn argument, in which case the font used would be whatever you compiled dmenu with.

bakkeby avatar Apr 06 '21 09:04 bakkeby

Thank you for kind response.

I see; I was unsure about line 105 , as to how it related to line 108, both outside the Pango patch. I shall go ahead then and modify line 108.

plum avatar Apr 06 '21 19:04 plum

is it possible to set fallback fonts with Pango patch? I used to use 2 fonts

monospace:size=12, JoyPixels:size=10 in the normal setup without Pango, but with Pango seems i can only set 1 font, and then the emoji font is 2 big in comparison to the monospace font that i use

kronikpillow avatar Apr 21 '21 08:04 kronikpillow

No that's one of the limitations of the pango patch, it only supports one font.

Pango is nice if you want bold, italic or underline text in your status, but if you are only after colors then personally I find the status2d patch to be a better option.

bakkeby avatar Apr 21 '21 08:04 bakkeby

actually im looking for a solution for dwm with google's new variable fonts, for example Inconsolata v3+ had huge width in between letters on all suckless software, it's supposedly a xft bug but there is no visible solution to it, so far only way I'v made Inconsolata work properly was with the pango patch, but then again, like I said, i can't control fallback font variables and the icons become to big with it

kronikpillow avatar Apr 21 '21 08:04 kronikpillow

I found this https://github.com/googlefonts/Inconsolata/issues/42 looks to have a workaround for st and apparently you have commented as well :)

Based on this commit it sounds like a decade ago dwm used cairo, but it was replaced with Xft instead. https://git.suckless.org/dwm/commit/fd3c19bd550e346d515c8e124c7fa55599a1aa22.html

bakkeby avatar Apr 21 '21 12:04 bakkeby

Also this maybe, https://www.reddit.com/r/suckless/comments/jcgb47/lf_on_st_with_inconsolata_as_monospace_font/

Suggests getting a patched version from the AUR (nerd-fonts-inconsolata).

bakkeby avatar Apr 21 '21 14:04 bakkeby

trust me mate, i'v looked everywhere and tried everything, the suggested solution of the "patch to st" makes the font look weird (or i didn't patch it properly) but it doesn't look as nearly close as what it looks like on alacritty for example, the solution to use nerd-fonts-inconsolata isn't viable as it renders some glyphs instead of the actual letter, for example letter b shows as a "telephone glyph", plus the nerd-fonts version is v 2.something while the new variable Inconsolata is v3.* I'v went back and fort to not have to replace Inconsolata, and eventually ended up giving up and replacing Inconsolata as my monospace font with mononoki ... the v2 and v3 Inconsolata fonts are visibly different, and the xft problem is not with Inconsolata only, it's with all variable fonts ... when using pango, the problem is gone, but then Im stuck with a problem of not being able to control the pixelsize of my emo-icons font

kronikpillow avatar Apr 23 '21 08:04 kronikpillow

Yes I saw comments saying that the nerd-fonts-inconsolata had a lot of problems on it's own. I also tested and saw that it works fine with the pango patch, but of course then you only have one font. The patch to st I believe is a best effort adjustment to the letter spacing. That st hack can also not be used in dwm or dmenu, so I think if one really need this particular font then the best bet would be to try and manually patch Xft like one of the later comments in the googlefonts issue suggests.

bakkeby avatar Apr 23 '21 09:04 bakkeby