1#!/bin/sh 2 3catfontsdir() 4{ 5 while read _IN 6 do 7 case "${_IN}" in 8 *-adobe-cica-*|[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 Cica-Regular.ttf adobe "cica" m medium 61 make_xlfd $ENC Cica-Bold.ttf adobe "cica" m bold 62 done 63} 64 65nfonts() 66{ 67 _L=0; while read _IN; do _L=$((${_L}+1)); done; echo ${_L} 68} 69 70install_fontsdir() 71{ 72 index_type=${1:-"dir"} 73 index="fonts.${index_type}" 74 tmpfile="${index}.tmp" 75 touch ${index} 76 (catfontsdir < ${index}; addentries ${index_type}) > ${tmpfile} 77 nfonts < ${tmpfile} > ${index} 78 cat ${tmpfile} >> ${index} 79 rm -f ${tmpfile} 80} 81 82deinstall_fontsdir() 83{ 84 index_type=${1:-"dir"} 85 index="fonts.${index_type}" 86 tmpfile="${index}.tmp" 87 catfontsdir < ${index} > ${tmpfile} 88 nfonts < ${tmpfile} > ${index} 89 cat ${tmpfile} >> ${index} 90 rm -f ${tmpfile} 91 if [ -r ${index} -a $(wc -l < ${index}) = 1 ]; then 92 rm -f ${index} 93 fi 94} 95 96case "$2" in 97POST-INSTALL) 98 cd %%FONTSDIR%% 99 install_fontsdir dir 100 install_fontsdir scale 101 ;; 102POST-DEINSTALL) 103 cd %%FONTSDIR%% 104 deinstall_fontsdir dir 105 deinstall_fontsdir scale 106 ;; 107esac 108