Update japanese/font-mplus-ipa to version 1.0.20060520.p1_5
[dports.git] / japanese / font-mplus-ipa / files / pkg-install.in
1 #!/bin/sh
2 # $FreeBSD: head/japanese/font-mplus-ipa/files/pkg-install.in 396873 2015-09-13 23:36:45Z hrs $
3
4 catfontsdir ()
5 {
6     while read _IN
7     do
8       case "${_IN}" in
9       *-ipa-M*|[0-9]*|"") ;;
10       *)       echo ${_IN} ;;
11       esac
12     done
13 }
14
15 ROMA=""
16 BOLD="ds=y"
17 ITAL="ai=0.15"
18 OBLI="ai=0.15"
19 RITA="ai=0.08"
20 ROBL="ai=0.08"
21
22 make_xlfd()
23 {
24         _enc=$1
25         _file=$2
26         _vendor=$3
27         _fname=$4
28         _poc=$5
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 --  "${ROMA}"       medium-r \
38                 ${BOLD}         bold-r \
39                 ${ITAL}         medium-i \
40                 ${ITAL}:${BOLD} bold-i \
41                 ${OBLI}         medium-o \
42                 ${OBLI}:${BOLD} bold-o \
43                 ${RITA}         medium-ri \
44                 ${RITA}:${BOLD} bold-ri \
45                 ${ROBL}         medium-ro \
46                 ${ROBL}:${BOLD} bold-ro
47         while [ $# != 0 ]; do
48                 _prefix="${PFIX}:$1"; shift
49                 _variant=$1; shift
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         done | sed -e 's,::,:,g' -e 's,^:,,'
53 }
54
55 addentries ()
56 {
57         for ENC in iso8859-1 iso10646-1 jisx0201.1976-0 jisx0208.1983-0 jisx0208.1990-0
58         do
59                 make_xlfd $ENC M+2VM+IPAG-circle.ttf ipa M+2VM+IPAG_circle c
60                 make_xlfd $ENC M+1VM+IPAG-circle.ttf ipa M+1VM+IPAG_circle c
61                 make_xlfd $ENC M+1P+IPAG.ttf ipa M+1P+IPAG p
62                 make_xlfd $ENC M+1P+IPAG-circle.ttf ipa M+1P+IPAG_circle p
63                 make_xlfd $ENC M+2P+IPAG.ttf ipa M+2P+IPAG p
64                 make_xlfd $ENC M+2P+IPAG-circle.ttf ipa M+2P+IPAG_circle p
65         done
66 }
67
68 nfonts ()
69 {
70     _L=0; while read _IN; do _L=$((${_L}+1)); done; echo ${_L}
71 }
72
73 case "$2" in
74 POST-INSTALL)
75         cd %%FONTSDIR%%
76         touch fonts.dir
77         (catfontsdir < fonts.dir; addentries) > fonts.dir.tmp
78         nfonts < fonts.dir.tmp > fonts.dir
79         cat fonts.dir.tmp >> fonts.dir
80         rm -f fonts.dir.tmp
81         ;;
82 POST-DEINSTALL)
83         cd %%FONTSDIR%%
84         catfontsdir < fonts.dir > fonts.dir.tmp
85         nfonts < fonts.dir.tmp > fonts.dir
86         cat fonts.dir.tmp >> fonts.dir
87         rm -f fonts.dir.tmp
88         if [ -r fonts.dir -a `wc -l < fonts.dir` = 1 ]; then
89                 rm -f fonts.dir
90         fi
91         ;;
92 esac