sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

generate_fontconfig_autodetect.sh (1451B)


      1 #!/usr/bin/env bash
      2 
      3 # Generate a fontconfig configuration file
      4 # See /etc/fonts/conf.d/README
      5 
      6 BASEDIR=$(dirname `readlink -f "$0"`)
      7 source ${BASEDIR}/colors.sh
      8 
      9 SCRIPTS[0]=${BASEDIR}/detect_font_terminal/find_font_gnometerminal.sh
     10 SCRIPTS[1]=${BASEDIR}/detect_font_terminal/find_font_terminator.sh
     11 
     12 declare -A FONT_NAMES
     13 
     14 if [ -z $VERBOSE ]; then
     15     echo '<?xml version="1.0"?>'
     16     echo '<!DOCTYPE fontconfig SYSTEM "fonts.dtd">'
     17     echo '<fontconfig>'
     18 else
     19     echo -e "\nDetected terminals fonts:\n"
     20 fi
     21 
     22 for SCRIPT in "${SCRIPTS[@]}"; do
     23     if [ -n "$VERBOSE" ]; then
     24 	eval "$SCRIPT"
     25     else
     26 	while IFS='\n' read FONT_NAME; do
     27 	    FONT_NAME=`echo $FONT_NAME | tr -d '\n'`
     28 	    FONT_NAMES["$FONT_NAME"]=1
     29 	done < <(eval $SCRIPT)
     30     fi
     31 done
     32 
     33 for FONT_NAME in "${!FONT_NAMES[@]}"; do
     34     if [ -z $VERBOSE ]; then
     35 	echo '  <alias><family>'"${FONT_NAME}"'</family><prefer><family>icons-in-terminal</family></prefer></alias>'
     36 	#echo '  <alias><family>'"${FONT_NAME}"'</family><prefer><family>icons-in-terminal</family></prefer><default><family>icons-in-terminal</family></default></alias>'
     37     fi
     38 done
     39 
     40 if [ -z $VERBOSE ]; then
     41     echo '</fontconfig>'
     42 else
     43     echo -e "\n${YELLOW}IMPORTANT:${NORMAL}"
     44     echo "install-autodetect.sh is experimental"
     45     echo -e "If your terminal isn't listed or if there is not your font, ${UNDERLINE}use install.sh instead${NORMAL}"
     46     echo "See https://github.com/sebastiencs/icons-in-terminal/issues/1"
     47 fi