You are not logged in.
My root partition is too small to have installed the 2GB of data for nerd fonts under /usr so I modified the AUR PKGBUILD to install to a dir on /opt (which I am mounting as a separate partition on the disk). This solved the installation but now I'm trying to figure out how to have the /opt/nerd-fonts-complete dir recognised as an extra system-wide font directory and the fonts known to applications.
After installing to /opt I executed:
fc-cache -s
mkfontscale /opt/nerd-fonts/otf
mkfontdir /opt/nerd-fonts/otf
mkfontscale /opt/nerd-fonts/ttf
mkfontdir /opt/nerd-fonts/ttf
I followed the docs to have an extra config file under /etc/X11/xorg.conf.d/ with the nerd-font OTF and TTF dirs configured. This is successful and being picked up by X:
$ xset -q | grep -i opt
/opt/nerd-fonts/ttf,/opt/nerd-fonts/otf,/usr/share/fonts/TTF,/usr/share/fonts/OTF,/usr/share/fonts/100dpi,/usr/share/fonts/75dpi,built-ins
I do not however see the nerd fonts in xfontsel. There's also a disparity between the following numbers:
xfontsel says 10092 (presumably) fonts detected
fc-list | wc -l gives 1839
xlsfonts | wc -l gives 7016
Questions:
Do I use fontconfig, or xorg to configure the new /opt/nerd-fonts dir?
If xfontsel is detecting >10000 fonts, why doesn't fc-list or xlsfonts? Will this cause an issue?
What I'm trying to achieve is to have xfontsel give me the correct string to configure nerd fonts for DWM via dwm's config.h file.
EDIT:
Created symlinks from the otf and ttf /opt/nerd-fonts dirs to /usr/share/fonts/{OTF,TTF} and now fontconfig recognises the nerd fonts, however, this isn't really the solution I was after. Also, xfontsel still does not recognise nerd fonts.
Last edited by miomio (2020-03-28 14:00:52)
Offline
Anyone?
Offline
Do I use fontconfig, or xorg to configure the new /opt/nerd-fonts dir?
"s/or/and/" - fontconfig isn't universally used, some processes might still rely on the fonts known by the X11 server.
why doesn't fc-list or xlsfonts?
Because you didn't suggest to have added the font path to fontconfig, https://wiki.archlinux.org/index.php/Fo … Font_paths
Will this cause an issue?
Fonts not being available through config…
xfontsel still does not recognise nerd fonts.
Did you rehas the database? (See the bottom of https://wiki.archlinux.org/index.php/X_ … escription )
Online
why doesn't fc-list or xlsfonts?
Because you didn't suggest to have added the font path to fontconfig, https://wiki.archlinux.org/index.php/Fo … Font_paths
xfontsel still does not recognise nerd fonts.
Did you rehas the database? (See the bottom of https://wiki.archlinux.org/index.php/X_ … escription )
As the first wiki link says: "The font paths initially known to Fontconfig are: /usr/share/fonts/ ..."
I sym linked to the /usr/share/fonts/{OTF,TTF} dirs the files in otf and ttf dirs of /opt/nerd-fonts. Hence `fc-list : file` is picking up the nerd fonts, e.g.:
$ fc-list : file | grep -i nerd | wc -l
1162
Yes, I've rehashed the X font database and the nerd-font dir on /opt is being picked up in Xorg.0.log.
Last edited by miomio (2020-03-23 21:51:42)
Offline
Yes, but you said
however, this isn't really the solution I was after
about the symlink approach.
About xfontsel: what's the ouput of
xlsfonts | grep -i nerd
?
Online
you can make `/etc/fonts/conf.d/00-my-font-dir.conf` include this,
<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/opt/your/font/dir</dir>
</fontconfig>
don't know about xfontsel. do you use old X apps that does not support fontconfig?
YCH
Offline
Yes, but you said
however, this isn't really the solution I was after
about the symlink approach.
About xfontsel: what's the ouput of
xlsfonts | grep -i nerd
?
It's been a while since I wrote that, and haven't updated my preference there, now I'm not too fussed - whatever works at this point!...
`xlsfonts | grep -i nerd` outputs nothing.
you can make `/etc/fonts/conf.d/00-my-font-dir.conf` include this,
<?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <dir>/opt/your/font/dir</dir> </fontconfig>
don't know about xfontsel. do you use old X apps that does not support fontconfig?
The configuration of dwm in config.h has two lines at 8 and 9 whereby you specify the font, see: https://dwm.suckless.org/customisation/font/
To get that same string but for a nerd-font I need to use xfontsel to generate it (right?).
Offline
YCH is equivalent to the fontconfig wiki link I posted.
If xlsfont doesn't list the fonts, they're not known to the server.
Post your xorg log, the xorg.conf.d snippet you created and the output of "ls -lR /opt/nerd-fonts" (this is probably going to be A LOT OF TEXT, use the tip from https://wiki.archlinux.org/index.php/Pastebin )
Edit: xlsfont is what's going to matter for dwm.
Last edited by seth (2020-03-24 13:22:18)
Online
YCH is equivalent to the fontconfig wiki link I posted.
If xlsfont doesn't list the fonts, they're not known to the server.
Post your xorg log, the xorg.conf.d snippet you created and the output of "ls -lR /opt/nerd-fonts" (this is probably going to be A LOT OF TEXT, use the tip from https://wiki.archlinux.org/index.php/Pastebin )Edit: xlsfont is what's going to matter for dwm.
Xorg.0.log: https://pastebin.com/8XChzKcv
xorg.conf.d/30-fonts.conf:
Section "Files"
FontPath "/opt/nerd-fonts/ttf"
FontPath "/opt/nerd-fonts/otf"
FontPath "/usr/share/fonts/liberation"
EndSection
`ls -LR /opt/nerd-fonts`: https://pastebin.com/1rS4rBQT
Offline
That's basically fine - since the otf/ttf fonts seem copies, what if you remove "/opt/nerd-fonts/otf" from the path?
Online
Are you sure the font names should contain "nerd"? Look in /opt/nerd-fonts/ttf/*/fonts.dir what names xorg detected for the fonts.
Edit: Sorry, disregard that. Somehow I totally missed that word in my sample mkfontdir output.
Last edited by progandy (2020-03-25 15:32:37)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
That's basically fine - since the otf/ttf fonts seem copies, what if you remove "/opt/nerd-fonts/otf" from the path?
In the FontPath ?
Offline
I got around to testing different combinations. Xorg does not like spaces in file names, so you'd have to remove or replace them with slashes or underscores.
Last edited by progandy (2020-03-25 16:13:37)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
I got around to testing different combinations. Xorg does not like spaces in file names, so you'd have to remove or replace them with slashes or underscores.
Thanks. In which files have I added spaces in file names? Or, in which files did you find the issue for you?
Offline
All font files in the nerd-fonts package have spaces in the filenames. You'll have to fix that in the PKGBUILD, either with a find/rename command or "detox -s safe".
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
All font files in the nerd-fonts package have spaces in the filenames. You'll have to fix that in the PKGBUILD, either with a find/rename command or "detox -s safe".
Thanks for the tip... Although xfontsel still not detecting the nerd fonts.
Offline
This is my sucessful test procedure:
... download terminess nerd fonts
$ mkcd /tmp/foo
$ cp "/tmp/terminess/Terminess (TTF) Bold Italic Nerd Font Complete.ttf" terminess.ttf
$ mkfontscale
$ mkfontdir
$ xset +fp /tmp/foo
$ xset fp rehash
$ xlsfonts|grep --max-count 1 nerd
-misc-terminessttf nerd font-bold-i-normal--0-0-0-0-m-0-ascii-0
Last edited by progandy (2020-03-25 20:54:16)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
I give up.
Offline
Why?
I can actually confirm progandy's findings. None of my (suspiciously few) fonts w/ a whitespace in their name shows up in X11, but in fontconfig.
All you have to do is to rename the font files, like
for name in *\ *; do echo ${name// /_}; done
and rebuild the font database as in comment #17
Online
Why?
I can actually confirm progandy's findings. None of my (suspiciously few) fonts w/ a whitespace in their name shows up in X11, but in fontconfig.
All you have to do is to rename the font files, likefor name in *\ *; do echo ${name// /_}; done
and rebuild the font database as in comment #17
Sorry I wasn't clear: I have followed the suggestion by removing the sym links in /usr/share/fonts/{OTF,TTF}, then renamed the nerd-font files in /opt/nerd-fonts/{ttf,otf} by replacing all spaces with underscores, then recreated the sym links in /usr/share/fonts/{OTF,TTF} and re-running mkfontdir and mkfontscale, then xset fp rehash. Since I already have the xorg.conf.d FontPath's for /usr/share/fonts{OTF,TTF} I didn't do xset +fp ... because X already knows about the dirs, but xlsfonts doesn't give any results to `xlsfonts | grep -i nerd`.
What if you use sym links from a different dir in your test case? How do your results differ, if at all? E.g.
... download terminess nerd fonts
$ mkcd /tmp/foo
$ cp "/tmp/terminess/Terminess (TTF) Bold Italic Nerd Font Complete.ttf" /tmp/terminess/terminess.ttf
$ ln -s /tmp/terminess/terminess.ttf ./
$ mkfontscale
$ mkfontdir
$ xset +fp /tmp/foo
$ xset fp rehash
$ xlsfonts|grep -i nerd
?
Last edited by miomio (2020-03-26 13:27:20)
Offline
Symlinks aren't picked up, a copy of the font is.
=> Add the path instead of symlinking stuff.
Online
Symlinks aren't picked up, a copy of the font is.
=> Add the path instead of symlinking stuff.
Which is exactly what I've done.
xorg.conf.d/30-fonts.conf:
Section "Files" FontPath "/opt/nerd-fonts/ttf" FontPath "/opt/nerd-fonts/otf" FontPath "/usr/share/fonts/liberation" EndSection
The fact that I symlink stuff to /usr/share/fonts/{OTF,TTF} is a backup of the above since X should already be looking in /usr/share/fonts{OTF,TTF}, but good to know symlinks aren't picked up finally, but before you tell me to copy everything to /usr/share/fonts/{OTF,TTF} please see my inital post that brought me here (disk space).
Still, `xlsfonts | grep -i nerd | wc -l` = 0
Last edited by miomio (2020-03-26 20:47:10)
Offline
Did you check if your fonts.dir file contains the correct filenames? If you ran the commands in the order from post #20, then it was wrong.
and re-running mkfontdir and mkfontscale, then xset fp rehash
mkfontscale has to be run before mkfontdir.
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |
Offline
Did you check if your fonts.dir file contains the correct filenames? If you ran the commands in the order from post #20, then it was wrong.
and re-running mkfontdir and mkfontscale, then xset fp rehash
mkfontscale has to be run before mkfontdir.
That was it.
Offline