uranus.webhop.net

Code: conf/quickfont

  1. #!/bin/bash
  2. #
  3. # Script: quickfont
  4. #
  5. # Version: 0.3
  6. #
  7. #
  8. # Author: DKD (dale_d at telusplanet dot net)
  9. # Thanks to darkbolt and sharth!
  10. #
  11. # Purpose: To save me having to type in all the commands
  12. # to install new TT Fonts manually each time.
  13. #
  14. # Usage: quickfont -d /path/to/fontdir
  15. #
  16. # Assumptions: python, head, tail, and grep are in your $PATH
  17. #
  18. # Warranty: This script was wrtten for my personal use and comes with
  19. # absolutely no warranty. In fact it may even damage your
  20. # system although that is unlikely. Use at your own risk.
  21. #
  22. # I disclaim all warranties with regard to the script provided herein,
  23. # including all implied warranties of merchantability and fitness
  24. # for any particular purpose. In no event shall I be liable for
  25. # any special, indirect or consequential damages or any damages
  26. # whatsoever resulting from loss of use, data or profits, whether in
  27. # an action of contract, negligence or other tortuous action,
  28. # arising out of or in connection with the use or performance
  29. # of this script.
  30. #
  31. # License: GPL - http://www.gnu.org/licenses/gpl.txt
  32. #
  33. # Grab the complete paths to xset, ttmkfdir, and mkfontalias.py
  34. # in case they caren't in the uer's $PATH (i.e. logged in as root).
  35. #
  36. XSET=$(which xset)
  37. TTMKFDIR=$(which ttmkfdir)
  38. MKFONTALIAS=$(which mkfontalias.py)
  39. #
  40. # get the font directory to add
  41. #
  42. while getopts ":d:" opt;
  43. do
  44. case $opt in
  45. d) DIR_NAME="$OPTARG" ;;
  46. \?) echo 'USAGE: quickfont -d /path/to/fontdir'
  47. exit 1
  48. esac
  49. done
  50. #
  51. # Check to make sure that the $DIR_NAME is not blank
  52. # and exit the script if it is.
  53. #
  54. if [ -z $DIR_NAME ];
  55. then
  56. echo ""
  57. echo "You did not specify a directory. The correct syntax is:"
  58. echo "quickfonts -d /path/to/fontdir"
  59. echo ""
  60. exit 1
  61. fi
  62. #
  63. # Check to make sure that the $DIR_NAME is a valid path and cd to it otherwise
  64. # exit the script
  65. #
  66. if [ ! -e $DIR_NAME ];
  67. then
  68. echo ""
  69. echo "You entered an invalid path."
  70. echo "$DIR_NAME does not exist."
  71. echo ""
  72. exit 1
  73. fi
  74. cd $DIR_NAME
  75. #
  76. # clean up old font dir, scale, alias files
  77. #
  78. if [ -e "encodings.dir" ];
  79. then
  80. rm encodings.dir
  81. fi
  82. if [ -e "fonts.alias" ];
  83. then
  84. rm fonts.alias
  85. fi
  86. if [ -e "fonts.dir" ];
  87. then
  88. rm fonts.dir
  89. fi
  90. if [ -e "fonts.scale" ];
  91. then
  92. rm fonts.scale
  93. fi
  94. #
  95. # make the new font dir, scale, alias files
  96. #
  97. echo "quickfont: Starting font installation:"
  98. $TTMKFDIR -o fonts.scale
  99. echo "Processing fonts..."
  100. head -n 1 fonts.scale > fonts.dir
  101. tail -n +2 fonts.scale | tac >> fonts.dir
  102. cp fonts.dir fonts.scale
  103. echo "Making font aliases..."
  104. $MKFONTALIAS
  105. grep 'iso8859-1"' fonts.alias > new.alias
  106. mv new.alias fonts.alias
  107. #
  108. # modify the path to xset for your system if necessary
  109. #
  110. echo "Refreshing X Font Cache..."
  111. $XSET +fp $DIR_NAME
  112. *
  113. * Display some touchy-feely stuff
  114. *
  115. echo "Completed!"
  116. echo ""
  117. echo "Your new fonts are installed and should appear in your X apps now."
  118. echo ""
  119. echo "NOTE: for Gnome and KDE, you may need to run additional"
  120. echo "commands... refer to the appropriate documentation."
  121. echo ""
  122. echo "NOTE: With Gnome it is easiest to keep all your TT Fonts in one"
  123. echo "place and make a symlink in your home directory to it named ~/.fonts"
  124. echo ""
  125. echo "!!!!!! IMPORTANT !!!!!!"
  126. echo "Unless you are just updating a pre-existing font directory,"
  127. echo "you must add the following line to your /etc/X11/XF86Config"
  128. echo "file in the \"Section \"Files\"\" or the next time you restart"
  129. echo "X, the new fonts will not display."
  130. echo ""
  131. echo "FontPath \"$DIR_NAME\""
  132. echo ""

Valid XHTML 1.0! Valid CSS!
Get Firefox!
.: Page last modified: December 03 2023 23:32:39 - Copyleft 2004 :.