1#!/bin/sh 2 3catfontsdir() 4{ 5 while read _IN 6 do 7 case "${_IN}" in 8 *"-adobe-gen jyuu gothic"*|[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 case "${_poc}:${_enc}" in 31 p:jisx0201.1976-*) PFIX="bw=0.5" ;; 32 c:jisx0201.1976-*) PFIX="bw=0.5" ;; 33 p:*) PFIX="" ;; 34 c:*) PFIX="" ;; 35 esac 36 37 set -- "" ${_weight}-r \ 38 ${ITAL} ${_weight}-i \ 39 ${OBLI} ${_weight}-o \ 40 ${RITA} ${_weight}-ri \ 41 ${ROBL} ${_weight}-ro 42 while [ $# != 0 ]; do 43 _prefix="${PFIX}:$1"; shift 44 _variant=$1; shift 45 [ ${index_type} = "scale" -a ${_prefix} != ":" ] && continue 46 printf "%s:%s -%s-%s-%s-normal--0-0-0-0-%s-0-%s\n" \ 47 $_prefix $_file $_vendor "$_fname" $_variant $_poc $_enc 48 done | sed -e 's,::,:,g' -e 's,^:,,' 49} 50 51addentries() 52{ 53 for ENC in iso8859-1 iso10646-1 jisx0201.1976-0 jisx0208.1983-0 jisx0208.1990-0 jisx0208.1997-0 jisx0213.2004-1 54 do 55 make_xlfd ${ENC} GenJyuuGothic-ExtraLight.ttf adobe "gen jyuu gothic" p thin 56 make_xlfd ${ENC} GenJyuuGothic-Light.ttf adobe "gen jyuu gothic" p extralight 57 make_xlfd ${ENC} GenJyuuGothic-Normal.ttf adobe "gen jyuu gothic" p light 58 make_xlfd ${ENC} GenJyuuGothic-Regular.ttf adobe "gen jyuu gothic" p book 59 make_xlfd ${ENC} GenJyuuGothic-Medium.ttf adobe "gen jyuu gothic" p medium 60 make_xlfd ${ENC} GenJyuuGothic-Bold.ttf adobe "gen jyuu gothic" p bold 61 make_xlfd ${ENC} GenJyuuGothic-Heavy.ttf adobe "gen jyuu gothic" p black 62 63 make_xlfd ${ENC} GenJyuuGothic-P-ExtraLight.ttf adobe "gen jyuu gothic p" p thin 64 make_xlfd ${ENC} GenJyuuGothic-P-Light.ttf adobe "gen jyuu gothic p" p extralight 65 make_xlfd ${ENC} GenJyuuGothic-P-Normal.ttf adobe "gen jyuu gothic p" p light 66 make_xlfd ${ENC} GenJyuuGothic-P-Regular.ttf adobe "gen jyuu gothic p" p book 67 make_xlfd ${ENC} GenJyuuGothic-P-Medium.ttf adobe "gen jyuu gothic p" p medium 68 make_xlfd ${ENC} GenJyuuGothic-P-Bold.ttf adobe "gen jyuu gothic p" p bold 69 make_xlfd ${ENC} GenJyuuGothic-P-Heavy.ttf adobe "gen jyuu gothic p" p black 70 71 make_xlfd ${ENC} GenJyuuGothic-Monospace-ExtraLight.ttf adobe "gen jyuu gothic monospace" m thin 72 make_xlfd ${ENC} GenJyuuGothic-Monospace-Light.ttf adobe "gen jyuu gothic monospace" m extralight 73 make_xlfd ${ENC} GenJyuuGothic-Monospace-Normal.ttf adobe "gen jyuu gothic monospace" m light 74 make_xlfd ${ENC} GenJyuuGothic-Monospace-Regular.ttf adobe "gen jyuu gothic monospace" m book 75 make_xlfd ${ENC} GenJyuuGothic-Monospace-Medium.ttf adobe "gen jyuu gothic monospace" m medium 76 make_xlfd ${ENC} GenJyuuGothic-Monospace-Bold.ttf adobe "gen jyuu gothic monospace" m bold 77 make_xlfd ${ENC} GenJyuuGothic-Monospace-Heavy.ttf adobe "gen jyuu gothic monospace" m black 78 done 79} 80 81nfonts() 82{ 83 _L=0; while read _IN; do _L=$((${_L}+1)); done; echo ${_L} 84} 85 86install_fontsdir() 87{ 88 index_type=${1:-"dir"} 89 index="fonts.${index_type}" 90 tmpfile="${index}.tmp" 91 touch ${index} 92 (catfontsdir < ${index}; addentries ${index_type}) > ${tmpfile} 93 nfonts < ${tmpfile} > ${index} 94 cat ${tmpfile} >> ${index} 95 rm -f ${tmpfile} 96} 97 98deinstall_fontsdir() 99{ 100 index_type=${1:-"dir"} 101 index="fonts.${index_type}" 102 tmpfile="${index}.tmp" 103 catfontsdir < ${index} > ${tmpfile} 104 nfonts < ${tmpfile} > ${index} 105 cat ${tmpfile} >> ${index} 106 rm -f ${tmpfile} 107 if [ -r ${index} -a $(wc -l < ${index}) = 1 ]; then 108 rm -f ${index} 109 fi 110} 111 112case "$2" in 113POST-INSTALL) 114 cd %%FONTSDIR%% 115 install_fontsdir dir 116 install_fontsdir scale 117 ;; 118POST-DEINSTALL) 119 cd %%FONTSDIR%% 120 deinstall_fontsdir dir 121 deinstall_fontsdir scale 122 ;; 123esac 124