1#!/bin/sh 2 3catfontsdir() 4{ 5 while read _IN 6 do 7 case "${_IN}" in 8 *-misc-myrica\ m-*|[0-9]*|"") ;; 9 *) echo ${_IN} ;; 10 esac 11 done 12} 13 14ROMA="" 15BOLD="ds=y" 16RITA="ai=0.08" 17ROBL="ai=0.08" 18 19make_xlfd() 20{ 21 _enc=$1 22 _file=$2 23 _vendor=$3 24 _fname=$4 25 _poc=$5 26 _weight=$6 27 28 case "${_poc}:${_enc}" in 29 p:jisx0201.1976-*) PFIX="bw=0.5" ;; 30 c:jisx0201.1976-*) PFIX="bw=0.5" ;; 31 p:*) PFIX="" ;; 32 c:*) PFIX="" ;; 33 esac 34 35 set -- "" ${_weight}-r \ 36 ${RITA} ${_weight}-ri \ 37 ${ROBL} ${_weight}-ro 38 while [ $# != 0 ]; do 39 _prefix="${PFIX}:$1"; shift 40 _variant=$1; shift 41 [ ${index_type} = "scale" -a ${_prefix} != ":" ] && continue 42 printf "%s:%s -%s-%s-%s-normal--0-0-0-0-%s-0-%s\n" \ 43 $_prefix $_file $_vendor "$_fname" $_variant $_poc $_enc 44 done | sed -e 's,::,:,g' -e 's,^:,,' 45 46 _prefix="${PFIX}:" 47 [ ${index_type} = "scale" -a ${_prefix} != ":" ] && return 48 _file=$(echo $_file | sed -e 's,\.ttf$,Italic&,') 49 for _variant in ${_weight}-i ${_weight}-o; do 50 printf "%s:%s -%s-%s-%s-normal--0-0-0-0-%s-0-%s\n" \ 51 $_prefix $_file $_vendor "$_fname" $_variant $_poc $_enc 52 [ ${index_type} = "scale" ] && break 53 done | sed -e 's,::,:,g' -e 's,^:,,' 54} 55 56addentries() 57{ 58 for ENC in iso8859-1 iso10646-1 jisx0201.1976-0 jisx0208.1983-0 jisx0208.1990-0 jisx0208.1997-0 jisx0213.2004-1 59 do 60 make_xlfd $ENC MyricaM.TTC misc "myrica m" m medium 61 done 62} 63 64nfonts() 65{ 66 _L=0; while read _IN; do _L=$((${_L}+1)); done; echo ${_L} 67} 68 69install_fontsdir() 70{ 71 index_type=${1:-"dir"} 72 index="fonts.${index_type}" 73 tmpfile="${index}.tmp" 74 touch ${index} 75 (catfontsdir < ${index}; addentries ${index_type}) > ${tmpfile} 76 nfonts < ${tmpfile} > ${index} 77 cat ${tmpfile} >> ${index} 78 rm -f ${tmpfile} 79} 80 81deinstall_fontsdir() 82{ 83 index_type=${1:-"dir"} 84 index="fonts.${index_type}" 85 tmpfile="${index}.tmp" 86 catfontsdir < ${index} > ${tmpfile} 87 nfonts < ${tmpfile} > ${index} 88 cat ${tmpfile} >> ${index} 89 rm -f ${tmpfile} 90 if [ -r ${index} -a $(wc -l < ${index}) = 1 ]; then 91 rm -f ${index} 92 fi 93} 94 95case "$2" in 96POST-INSTALL) 97 cd %%FONTSDIR%% 98 install_fontsdir dir 99 install_fontsdir scale 100 ;; 101POST-DEINSTALL) 102 cd %%FONTSDIR%% 103 deinstall_fontsdir dir 104 deinstall_fontsdir scale 105 ;; 106esac 107