Mandrake 宋體安裝shell程式(轉)

ba發表於2007-08-11
Mandrake 宋體安裝shell程式(轉)[@more@]我對Transfer的RH8的shell程式進行了修改,使之能夠執行在Mandrake9上面
取消了simsun18030,因為我覺得這個東西效果並不好,這樣作可以免去了從微軟下載的麻煩,增加了TrueSimSun(名字我自己定的),其中英文字型是完全用simsun.ttc實現的,而SimSun的英文字型則應用tahoma。
由於沒有新裝的機器,所以無法測試,還請哪位高手幫忙測試一下
Transfer的for Redhat8的版本在這裡找到


把原始檔剪貼複製到這裡。你可以把#!/bin/bash直到reboot之間的內容複製到一個檔案中,比如sm.sh
把他放到/usr/local/temp裡面,chmod 755 sm.sh,讓它可執行。
然後,把simsun.ttc(win98的.ttf請修改為ttc), tahoma.ttf, tahomabd.ttf三個檔案
複製到上述目錄中,執行這個指令碼程式:./sm.sh
然後就重起動了,然後就能用simsun了。注意兩點:要在剛用簡體漢字裝完,沒作任何漢化情況下作;
注意要用su或者root。

sh.sh指令碼如下:
#!/bin/bash
#
#Simsun font installer for Mandrake9.0
#This is a GPL sript. The content comes form Xiang Yu. Thanks him. And also thanks Transfer.
#usage:
#1, install MDK9 and select simplified chinese.
#2, make a temple directory in anywhere you prefer.
# for example /usr/local/temp
# copy 'where/it/has/the/windows_fonts/simsun.ttc' and
#all of these fonts, simsun.ttc Tahoma.ttf and tahomabd.ttf
# to this temp place /usr/local/temp
#3, copy this shell script into this directory.
#4, make sure you are root or su and then run it
#5, set the fonts to your most prefered ones in gnome, kde and xmms and others.

#first, put the fonts to the correct dir.
export CDIR=/usr/X11R6/lib/X11/fonts/TrueType
#export CDIR=/usr/local/btest
export XFConfig=/etc/X11/XF86Config-4
#export XFConfig=/usr/local/atest/XF86Config-4
export GTKRC=/etc/gtk/gtkrc.zh_CN
#export GTKRC=/usr/local/atest/gtkrc.zh_CN
export GNOMERC=/etc/gnome/gtkrc.zh_CN
#export GNOMERC=/usr/local/atest/gnome/gtkrc.zh_CN
export FONTSCONF=/etc/fonts/fonts.conf
#export FONTSCONF=/usr/local/atest/fonts.conf
export CHINPUTAD=/usr/lib/Chinput/Chinput.ad
#export CHINPUTAD=/usr/local/atest/Chinput.ad
export XMMSMO=/usr/share/locale
#export XMMSMO=/usr/local/atest

mkdir $CDIR

#copy the fonts to it
cp simsun.ttc $CDIR/simsun.ttf
cp t* $CDIR/

#copy encodings
cp /usr/X11R6/lib/X11/fonts/encodings/encodings.dir $CDIR/

#make the fonts.dir
echo '52
simsun.ttf -misc-fixed-medium-r-normal--0-0-0-0-c-0-gb18030.2000-0
simsun.ttf -misc-fixed-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
ai=0.3:simsun.ttf -misc-SimSun-medium-i-normal--0-0-0-0-c-0-gb2312.1980-0
ds=y:simsun.ttf -misc-SimSun-bold-r-normal--0-0-0-0-c-0-gb2312.1980-0
ds=y:ai=0.3:simsun.ttf -misc-SimSun-bold-i-normal--0-0-0-0-c-0-gb2312.1980-0
tahoma.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-iso8859-1
ai=0.3:tahoma.ttf -misc-SimSun-medium-i-normal--0-0-0-0-p-0-iso8859-1
tahomabd.ttf -misc-SimSun-bold-r-normal--0-0-0-0-p-0-iso8859-1
ai=0.3:tahomabd.ttf -misc-SimSun-bold-i-normal--0-0-0-0-p-0-iso8859-1
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-gbk-0
ai=0.3:simsun.ttf -misc-SimSun-medium-i-normal--0-0-0-0-p-0-gbk-0
ds=y:simsun.ttf -misc-SimSun-bold-r-normal--0-0-0-0-p-0-gbk-0
ds=y:ai=0.3:simsun.ttf -misc-SimSun-bold-i-normal--0-0-0-0-p-0-gbk-0
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-fcd8859-15
ai=0.3:simsun.ttf -misc-SimSun-medium-i-normal--0-0-0-0-p-0-fcd8859-15
ds=y:simsun.ttf -misc-SimSun-bold-r-normal--0-0-0-0-p-0-fcd8859-15
ds=y:ai=0.3:simsun.ttf -misc-SimSun-bold-i-normal--0-0-0-0-p-0-fcd8859-15
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-p-0-iso8859-15
ai=0.3:simsun.ttf -misc-SimSun-medium-i-normal--0-0-0-0-p-0-iso8859-15
ds=y:simsun.ttf -misc-SimSun-bold-r-normal--0-0-0-0-p-0-iso8859-15
ds=y:ai=0.3:simsun.ttf -misc-SimSun-bold-i-normal--0-0-0-0-p-0-iso8859-15
simsun.ttf -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1
ai=0.3:simsun.ttf -misc-SimSun-medium-i-normal--0-0-0-0-c-0-iso10646-1
ds=y:simsun.ttf -misc-SimSun-bold-r-normal--0-0-0-0-c-0-iso10646-1
ds=y:ai=0.3:simsun.ttf -misc-SimSun-bold-i-normal--0-0-0-0-c-0-iso10646-1
simsun.ttf -misc-kai-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
simsun.ttf -misc-kai-medium-r-normal--0-0-0-0-c-0-gb18030.2000-0
simsun.ttf -misc-TrueSimSun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
ai=0.3:simsun.ttf -misc-TrueSimSun-medium-i-normal--0-0-0-0-c-0-gb2312.1980-0
ds=y:simsun.ttf -misc-TrueSimSun-bold-r-normal--0-0-0-0-c-0-gb2312.1980-0
ds=y:ai=0.3:simsun.ttf -misc-TrueSimSun-bold-i-normal--0-0-0-0-c-0-gb2312.1980-0
simsun.ttf -misc-TrueSimSun-medium-r-normal--0-0-0-0-p-0-iso8859-1
ai=0.3:simsun.ttf -misc-TrueSimSun-medium-i-normal--0-0-0-0-p-0-iso8859-1
ds=y:simsun.ttf -misc-TrueSimSun-bold-r-normal--0-0-0-0-p-0-iso8859-1
ds=y:ai=0.3:simsun.ttf -misc-TrueSimSun-bold-i-normal--0-0-0-0-p-0-iso8859-1
simsun.ttf -misc-TrueSimSun-medium-r-normal--0-0-0-0-p-0-koi8-r
ai=0.3:simsun.ttf -misc-TrueSimSun-medium-i-normal--0-0-0-0-p-0-koi8-r
ds=y:simsun.ttf -misc-TrueSimSun-bold-r-normal--0-0-0-0-p-0-koi8-r
ds=y:ai=0.3:simsun.ttf -misc-TrueSimSun-bold-i-normal--0-0-0-0-p-0-koi8-r
simsun.ttf -misc-TrueSimSun-medium-r-normal--0-0-0-0-p-0-fcd8859-15
ai=0.3:simsun.ttf -misc-TrueSimSun-medium-i-normal--0-0-0-0-p-0-fcd8859-15
ds=y:simsun.ttf -misc-TrueSimSun-bold-r-normal--0-0-0-0-p-0-fcd8859-15
ds=y:ai=0.3:simsun.ttf -misc-TrueSimSun-bold-i-normal--0-0-0-0-p-0-fcd8859-15
simsun.ttf -misc-TrueSimSun-medium-r-normal--0-0-0-0-p-0-iso8859-15
ai=0.3:simsun.ttf -misc-TrueSimSun-medium-i-normal--0-0-0-0-p-0-iso8859-15
ds=y:simsun.ttf -misc-TrueSimSun-bold-r-normal--0-0-0-0-p-0-iso8859-15
ds=y:ai=0.3:simsun.ttf -misc-TrueSimSun-bold-i-normal--0-0-0-0-p-0-iso8859-15
simsun.ttf -misc-TrueSimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1
ai=0.3:simsun.ttf -misc-TrueSimSun-medium-i-normal--0-0-0-0-c-0-iso10646-1
ds=y:simsun.ttf -misc-TrueSimSun-bold-r-normal--0-0-0-0-c-0-iso10646-1
ds=y:ai=0.3:simsun.ttf -misc-TrueSimSun-bold-i-normal--0-0-0-0-c-0-iso10646-1' > $CDIR/fonts.dir

#make the fonts.scale
cat $CDIR/fonts.dir > $CDIR/fonts.scale

#modify $XFConfig
sed -e '/^Section[[:space:]]*"Files"/,/^EndSection/{
/^[[:space:]]*FontPath[[:space:]]*"/usr/X11R6/lib/X11/fonts/TrueType"/d
/RgbPath/a
FontPath "/usr/X11R6/lib/X11/fonts/TrueType"
}' -e '/Section[[:space:]]*"Module"/,/^EndSection/{
/^[[:space:]]*Load[[:space:]]*"freetype"/d
/^[[:space:]]*Load[[:space:]]*"record"/d
/^[[:space:]]*Load[[:space:]]*"type1"/d
/^[[:space:]]*Load[[:space:]]*"xtt"/d
s/EndSection/ Load "xtt"
EndSection/
}' $XFConfig > ~/tmpfile

cat ~/tmpfile > $XFConfig

#modify gtkrc.zh_CN
sed -e '{
/^[[:space:]]*fontset/,/-r-*"/d
/{/a
fontset = "-*-*-medium-r-normal--12-*-*-*-*-*-iso10646-1,*-r-*"
}' $GTKRC > ~/tmpfile

cat ~/tmpfile > $GTKRC

#modify gnome/gtkrc
sed -e 's/^[[:space:]]*fontset[[:space:]]*=.*"/ fontset = "-misc-SimSun-medium-r-normal--12-*-*-*-*-*-iso10646-1"/' $GNOMERC > ~/tmpfile

cat ~/tmpfile > $GNOMERC

#modify $FONTSCONF
sed -e '{
/ /usr/X11R6/lib/X11/fonts/TrueType/d
s/ /usr/X11R6/lib/X11/fonts/Type1/ /usr/X11R6/lib/X11/fonts/TrueType
/usr/X11R6/lib/X11/fonts/Type1/
}' $FONTSCONF > ~/tmpfile

cat ~/tmpfile > $FONTSCONF

sed -e '/If[[:space:]]*the[[:space:]]*font/,//s/.*/SimSun/' $FONTSCONF > ~/tmpfile

cat ~/tmpfile > $FONTSCONF

sed -e '/zh/,//s/.*/true/' $FONTSCONF > ~/tmpfile

cat ~/tmpfile > $FONTSCONF

sed -e '/monospace/,//{
/SimSun/d
//a
SimSun
}' $FONTSCONF > ~/tmpfile

cat ~/tmpfile > $FONTSCONF

#modify $CHINPUTAD
sed -e 's/chinput.gb2312font[[:space:]]*=[[:space:]]*.*/chinput.gb2312font = -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1/' -e 's/xft.font.family[[:space:]]*=[[:space:]]*.*/xft.font.family = SimSun/' $CHINPUTAD > ~/tmpfile
cat ~/tmpfile > $CHINPUTAD

#cp the files for xmms in the system default locale gb18030
mkdir $XMMSMO/zh_CN.GB18030
cp -a $XMMSMO/zh_CN.GB2312/* $XMMSMO/zh_CN.GB18030/

#Gao Ding it!
reboot
echo 'done! check that files now!'

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10617731/viewspace-948121/,如需轉載,請註明出處,否則將追究法律責任。

相關文章