generate_fontconfig.sh (1145B)
1 #!/usr/bin/env bash 2 3 # Generate a fontconfig configuration file 4 # See /etc/fonts/conf.d/README 5 6 echo '<?xml version="1.0"?> 7 <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> 8 <fontconfig>' 9 10 echo ' <!-- You are supposed to remove all the lines but the one(s) where the font is used in your terminal -->' 11 echo ' <!-- Only monospaced fonts have been listed here -->' 12 echo " <!-- If your font isn't in the list, uncomment the next line and write its name -->" 13 echo " <!-- <alias><family>YOUR_TERMINAL_FONT</family><default><family>icons-in-terminal</family></default></alias> -->" 14 15 while IFS='\n' read FONT_NAME; 16 do 17 FONT_NAME=`echo $FONT_NAME | tr -d '\n'` 18 echo ' <alias><family>'"${FONT_NAME}"'</family><prefer><family>icons-in-terminal</family></prefer></alias>' 19 # echo ' <alias><family>'"${FONT_NAME}"'</family><prefer><family>icons-in-terminal</family></prefer><default><family>icons-in-terminal</family></default></alias>' 20 done < <(fc-list :mono family | sort | sed "s/\\\-/-/g" | grep -v 'icons-in-terminal') 21 22 echo ' <alias><family>Monospace</family><default><family>icons-in-terminal</family></default></alias>' 23 24 echo '</fontconfig>'