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