一次搞定RedHat8.0simsun字型的shell程式(轉)
一次搞定RedHat8.0simsun字型的shell程式(轉)[@more@]這個bash程式能一次搞定RedHat8.0simsun字型的shell程式。可以把#!/bin/bash直到reboot之間的內容複製到一個檔案中,比如sm.sh 把他放到/usr/local/temp裡面,chmod 755 sm.sh,讓它可執行。 然後,把simsun.ttc, SimSun18030.ttc, tahoma.ttf, tahomabd.ttf四個檔案 複製到上述目錄中,執行這個指令碼程式:./sm.sh 然後就重起動了,然後就能用simsun了。注意兩點:要在剛用簡體漢字裝完,沒作任何漢化情況下作;要用root作。
下面是程式:
#!/bin/bash
#
#change rh8 chinese fonts to simsun
#This is a GPL sript. The content comes form Xiang Yu. Thanks him.
#usage:
#1, install rh8 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、SimSun18030.ttc、tahoma.ttf and tahomabd.ttf
# to this temp place /usr/local/temp
#3, copy this shell script into this directory.
#4, 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
mkdir $CDIR
#copy the fonts to it
cp simsun.ttc $CDIR/simsun.ttf
cp SimSun18030.ttc $CDIR/SimSun18030.ttf
cp t* $CDIR/
#copy encodings
cp /usr/X11R6/lib/X11/fonts/encodings/encodings.dir $CDIR/
#make the fonts.dir
echo '29
simsun.ttf -misc-fixed-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
SimSun18030.ttf -misc-SimSun18030-medium-r-normal--0-0-0-0-c-0-gb18030.2000-0
ai=0.3:SimSun18030.ttf -misc-SimSun18030-medium-i-normal--0-0-0-0-c-0-gb18030.2000-0
ds=y:SimSun18030.ttf -misc-SimSun18030-bold-r-normal--0-0-0-0-c-0-gb18030.2000-0
ds=y:ai=0.3:SimSun18030.ttf -misc-SimSun18030-bold-i-normal--0-0-0-0-c-0-gb18030.2000-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' > $CDIR/fonts.dir
#make the fonts.scale
cat $CDIR/fonts.dir > $CDIR/fonts.scale
#modify /etc/X11/XF86Config
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
s/EndSection/ Load "xtt"
EndSection/
}' /etc/X11/XF86Config > ~/tmpfile
cat ~/tmpfile > /etc/X11/XF86Config
#modify gtkrc.zh_CN
sed -e '/style[[:space:]]*"gtk-default-zh-cn"/,/class[[:space:]]*"GtkWidget"[[:space:]]*style[[:space:]]*"gtk-default-zh-cn"/{
s/^[[:space:]]*fontset[[:space:]]*.*"/ fontset = "-*-*-medium-r-normal--12-*-*-*-*-*-iso10646-1,*-r-*"/
}' /etc/gtk/gtkrc.zh_CN > ~/tmpfile
cat ~/tmpfile > /etc/gtk/gtkrc.zh_CN
#modify gnome/gtkrc
sed -e 's/^[[:space:]]*fontset[[:space:]]*=.*"/ fontset = "-misc-SimSun-medium-r-normal--12-*-*-*-*-*-iso10646-1"/' /etc/gnome/gtkrc.zh_CN > ~/tmpfile
cat ~/tmpfile > /etc/gnome/gtkrc.zh_CN
#modify /etc/fonts/fonts.conf
sed -e 's/
/usr/X11R6/lib/X11/fonts/Type1/
/usr/X11R6/lib/X11/fonts/TrueType
/usr/X11R6/lib/X11/fonts/Type1/' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
sed -e '/If[[:space:]]*the[[:space:]]*font/,//s/.*/SimSun/' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
sed -e '/zh/,//s/.*/true/' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
sed -e '/monospace/,//{
//a
SimSun
}' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
#modify /usr/lib/Chinput/Chinput.ad
sed -e 's/chinput.gb18030font[[:space:]]*=[[:space:]]*.*/chinput.gb18030font = -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1/' -e 's/xft.font.family[[:space:]]*=[[:space:]]*zysong18030/xft.font.family = SimSun/' /usr/lib/Chinput/Chinput.ad > ~/tmpfile
cat ~/tmpfile > /usr/lib/Chinput/Chinput.ad
#cp the files for xmms in the system default locale gb18030
mkdir /usr/share/locale/zh_CN.GB18030
cp -a /usr/share/locale/zh_CN.GB2312/* /usr/share/locale/zh_CN.GB18030/
#Gao Ding it!
reboot
下面是程式:
#!/bin/bash
#
#change rh8 chinese fonts to simsun
#This is a GPL sript. The content comes form Xiang Yu. Thanks him.
#usage:
#1, install rh8 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、SimSun18030.ttc、tahoma.ttf and tahomabd.ttf
# to this temp place /usr/local/temp
#3, copy this shell script into this directory.
#4, 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
mkdir $CDIR
#copy the fonts to it
cp simsun.ttc $CDIR/simsun.ttf
cp SimSun18030.ttc $CDIR/SimSun18030.ttf
cp t* $CDIR/
#copy encodings
cp /usr/X11R6/lib/X11/fonts/encodings/encodings.dir $CDIR/
#make the fonts.dir
echo '29
simsun.ttf -misc-fixed-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
SimSun18030.ttf -misc-SimSun18030-medium-r-normal--0-0-0-0-c-0-gb18030.2000-0
ai=0.3:SimSun18030.ttf -misc-SimSun18030-medium-i-normal--0-0-0-0-c-0-gb18030.2000-0
ds=y:SimSun18030.ttf -misc-SimSun18030-bold-r-normal--0-0-0-0-c-0-gb18030.2000-0
ds=y:ai=0.3:SimSun18030.ttf -misc-SimSun18030-bold-i-normal--0-0-0-0-c-0-gb18030.2000-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' > $CDIR/fonts.dir
#make the fonts.scale
cat $CDIR/fonts.dir > $CDIR/fonts.scale
#modify /etc/X11/XF86Config
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
s/EndSection/ Load "xtt"
EndSection/
}' /etc/X11/XF86Config > ~/tmpfile
cat ~/tmpfile > /etc/X11/XF86Config
#modify gtkrc.zh_CN
sed -e '/style[[:space:]]*"gtk-default-zh-cn"/,/class[[:space:]]*"GtkWidget"[[:space:]]*style[[:space:]]*"gtk-default-zh-cn"/{
s/^[[:space:]]*fontset[[:space:]]*.*"/ fontset = "-*-*-medium-r-normal--12-*-*-*-*-*-iso10646-1,*-r-*"/
}' /etc/gtk/gtkrc.zh_CN > ~/tmpfile
cat ~/tmpfile > /etc/gtk/gtkrc.zh_CN
#modify gnome/gtkrc
sed -e 's/^[[:space:]]*fontset[[:space:]]*=.*"/ fontset = "-misc-SimSun-medium-r-normal--12-*-*-*-*-*-iso10646-1"/' /etc/gnome/gtkrc.zh_CN > ~/tmpfile
cat ~/tmpfile > /etc/gnome/gtkrc.zh_CN
#modify /etc/fonts/fonts.conf
sed -e 's/
/usr/X11R6/lib/X11/fonts/Type1/
/usr/X11R6/lib/X11/fonts/TrueType
/usr/X11R6/lib/X11/fonts/Type1/' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
sed -e '/If[[:space:]]*the[[:space:]]*font/,//s/.*/SimSun/' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
sed -e '/zh/,//s/.*/true/' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
sed -e '/monospace/,//{
//a
SimSun
}' /etc/fonts/fonts.conf > ~/tmpfile
cat ~/tmpfile > /etc/fonts/fonts.conf
#modify /usr/lib/Chinput/Chinput.ad
sed -e 's/chinput.gb18030font[[:space:]]*=[[:space:]]*.*/chinput.gb18030font = -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1/' -e 's/xft.font.family[[:space:]]*=[[:space:]]*zysong18030/xft.font.family = SimSun/' /usr/lib/Chinput/Chinput.ad > ~/tmpfile
cat ~/tmpfile > /usr/lib/Chinput/Chinput.ad
#cp the files for xmms in the system default locale gb18030
mkdir /usr/share/locale/zh_CN.GB18030
cp -a /usr/share/locale/zh_CN.GB2312/* /usr/share/locale/zh_CN.GB18030/
#Gao Ding it!
reboot
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10617542/viewspace-949193/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Linux下搞定truetype字型的方法(轉)Linux
- Shell 一行程式碼搞定大問題行程
- Linux Shell的輸入彩色字型Linux
- Bourne Shell及shell程式設計(轉)程式設計
- shell程式設計(轉)程式設計
- [shell問答錄]:命令、程式、子shell...(轉)
- BASH Shell的指令碼程式設計(轉)指令碼程式設計
- Linux的shell程式設計(一)(轉)Linux程式設計
- Linux的shell程式設計(二)(轉)Linux程式設計
- Linux的shell程式設計(三)(轉)Linux程式設計
- Linux的shell程式設計(四)(轉)Linux程式設計
- shell程式設計幫助(轉)程式設計
- Fedora Core 5.0 中新增字型及應用程式字型設定方法(轉)
- 記一次css字型反爬CSS
- 一個 Shell 程式的效能最佳化(轉)
- shell的命令(轉)
- BASH SHELL 程式設計簡介(轉)程式設計
- Mandrake 宋體安裝shell程式(轉)
- 一個殺死終端所有程式的 Shell(轉)
- Linux下的shell程式設計入門(轉)Linux程式設計
- Java下數字型別的轉換 (轉)Java型別
- sqlldr+awk+shell的一次記錄SQL
- ios一句程式碼搞定螢幕旋轉iOS
- 輕鬆搞定Windows惡意程式碼攻擊(轉)Windows
- Self-Delete程式之Delphi版本,終於搞定了。 (轉載) (轉)delete
- 改變標題字型,選單字型 (轉)
- Linux 程式設計之Shell程式設計(轉)Linux程式設計
- Java並行流:一次搞定多執行緒程式設計難題,讓你的程式飛起來!Java並行執行緒程式設計
- 前端之瀏覽器快取,一次搞定前端瀏覽器快取
- Linux中的字型設定 (轉)Linux
- 轉換金額大寫的SHELL程式(絕對透過驗證)(轉)
- (資料科學學習手札100)搞定matplotlib中的字型設定資料科學
- shell中常用的工具(轉)
- Shell 物件(轉)物件
- Shell Script(轉)
- shell程式設計(轉三呼的一篇文章)程式設計
- 玩轉Linux – shell 程式設計基礎Linux程式設計
- 幾個shell程式設計小知識(轉)程式設計