summaryrefslogtreecommitdiffstats
path: root/chinese/moettf/pkg-install
blob: cc556eaeddf1670f775510ff17789a5f069f2aaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh

if [ "$2" = "PRE-INSTALL" ]; then
  exit 0
fi

PKGNAME=$1
PREFIX=${PKG_PREFIX}
TTFM=${PREFIX}/bin/ttfm.sh

FONTDIR=${PREFIX}/share/fonts/TrueType
FONTS="moe_lishu.ttf moe_kai.ttf moe_sung.ttf moe_sungext.ttf moe_sungsym.ttf moe_kai_pc.ttf"
if [ "X$DEFAULT" != "X" ]; then
    DEFAULTMING="moe_sung.ttf"
    DEFAULTKAI="moe_kai.ttf"
fi

TEMPFILE=`mktemp -q /tmp/moettf.XXXX`
XFONTDIR=${X11BASE}/lib/X11/fonts/TrueType

if [ ! -x $TTFM ]; then
    echo "$TTFM not found!"
    exit 1
fi

rm -f $FONTDIR/$PKGNAME

if [ "X$WANT_CJK" != "X" ]; then
    # There's no CJK module now.
fi

if [ "X$WANT_GS" != "X" ]; then
    for f in $FONTS; do
        $TTFM --add gscjk $FONTDIR/$f
    done
    for f in $DEFAULTMING; do
        $TTFM --setdefault gscjk $FONTDIR/$f
    done
    for f in $DEFAULTKAI; do
        $TTFM --setdefault_kai gscjk $FONTDIR/$f
    done
    echo "gscjk" >> $FONTDIR/$PKGNAME
fi

if [ "X$WITHOUT_X" = "X" ]; then
    for f in $FONTS; do
        $TTFM --add xttfm $FONTDIR/$f
    done
    for f in $DEFAULTMING; do
        $TTFM --setdefault xttfm $FONTDIR/$f
    done
    for f in $DEFAULTKAI; do
        $TTFM --setdefault_kai xttfm $FONTDIR/$f
    done
    sed -e "s/ ° ê ¦ r ¼ Ð · Ç § º Å é/twmoe_sung/g" -e "s/ t w m o e _ k a i/twmoe_kai/g" $XFONTDIR/fonts.dir > $TEMPFILE
    mv $TEMPFILE $XFONTDIR/fonts.dir
    sed -e "s/ ° ê ¦ r ¼ Ð · Ç § º Å é/twmoe_sung/g" -e "s/ t w m o e _ k a i/twmoe_kai/g" $XFONTDIR/fonts.alias > $TEMPFILE
    mv $TEMPFILE $XFONTDIR/fonts.alias
    echo "xttfm" >> $FONTDIR/$PKGNAME
fi

rm -f $TEMPFILE

exit 0
OpenPOWER on IntegriCloud