LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 822|回复: 7

谁有美化Mandrake 9.0的宋体安装程序?

[复制链接]
发表于 2002-11-13 19:38:19 | 显示全部楼层 |阅读模式
我照着上面的方法,结果搞咂了。凡是gtk程序都出现乱码。谁能告诉我上面改了什么文件。
发表于 2002-11-13 20:56:34 | 显示全部楼层
你用的是redhat版的吧?这儿有mandrake版的。以下是我从linuxaid上找来的。

-----------------------------------------------------------------------------------------------------------------------------------------
我对Transfer的RH8的shell程序进行了修改,使之能够运行在Mandrake9上面
取消了simsun18030,因为我觉得这个东西效果并不好,这样作可以免去了从微软下载的麻烦,增加了TrueSimSun(名字我自己定的),其中英文字体是完全用simsun.ttc实现的,而SimSun的英文字体则应用tahoma。
由于没有新装的机器,所以无法测试,还请哪位高手帮忙测试一下
Transfer的for Redhat8的版本在这里找到
http://www.linuxeden.com/edu/doctext.php?docid=2629

把源文件剪贴拷贝到这里。你可以把#!/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 '{
/<dir>\/usr\/X11R6\/lib\/X11\/fonts\/TrueType<\/dir>/d
s/<dir>\/usr\/X11R6\/lib\/X11\/fonts\/Type1<\/dir>/<dir>\/usr\/X11R6\/lib\/X11\/fonts\/TrueType<\/dir>\
<dir>\/usr\/X11R6\/lib\/X11\/fonts\/Type1<\/dir>/
}' $FONTSCONF > ~/tmpfile

cat ~/tmpfile > $FONTSCONF

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

cat ~/tmpfile > $FONTSCONF

sed -e '/<string>zh<\/string>/,/<\/edit>/s/<bool>.*<\/bool>/<bool>true<\/bool>/' $FONTSCONF > ~/tmpfile

cat ~/tmpfile > $FONTSCONF

sed -e '/<family>monospace<\/family>/,/<\/prefer>/{
/<family>SimSun<\/family>/d
/<prefer>/a\
<family>SimSun<\/family>
}' $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!'
 楼主| 发表于 2002-11-13 21:21:18 | 显示全部楼层
最初由 kj501 发布
然后就重起动了,然后就能用simsun了。注意两点:要在刚用简体汉字装完,没作任何汉化情况下作;
注意要用su或者root。

But unfortunately 我已经汉化完了,然后再安装sm.sh的。我汉化好后的效果还算不错。只是浏览网页时用simsun时某些英文和数字显示得不太好。于是就想尝试一下这个东西。但是自己又是个菜鸟。现在搞到出了问题。:p ,
现在我尝试一下用别人的文件来覆盖原来的文件。不知能不能行得通。
希望上帝保佑吧!
发表于 2002-11-13 23:55:17 | 显示全部楼层

Re: 有谁用过linuxeden的宋体安装程序?

最初由 Omega 发布
我照着上面的方法,结果搞咂了。凡是gtk程序都出现乱码。谁能告诉我上面改了什么文件。


应该这里出了问提:
_______________________________

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

________________________________

你试一下这样修改:修改/etc/gtk/gtkrc.zh_CN文件
把fontset内改为 "-adobe-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-1, \
-*-*-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0,*-r-*"


 楼主| 发表于 2002-11-14 00:05:27 | 显示全部楼层
但是我不知道文件原来是怎样的?
发表于 2002-11-14 00:10:03 | 显示全部楼层
最初由 Omega 发布
但是我不知道文件原来是怎样的?


不用理,它只是修改了fontset之后的部分,我那个就是原文件的写法。
发表于 2002-11-15 11:29:01 | 显示全部楼层

我也这样照着做的,结果搞砸了。

我也这样照着做的,结果搞砸了,进不了Xwindows。

原来那个gtkrc.zh_CN根本就是个空文件。
头大。
 楼主| 发表于 2002-11-15 12:42:52 | 显示全部楼层
你如果确实没办法就把第一张碟中有关gtk的rpm包删了,再重新装上去过。我就这样解决问题的。但是每个人的情况不同。我不知道对你能否行得通。我得是能进X,只是gtk有问题而已。sm.sh改了两个gtkrc.zh_CN,/etc/gtk/gtkrc.zh_CN可能要改成这样:
# $(gtkconfigdir)/gtkrc.zh_CN
#
# This file defines the fontsets for Chinese language (zh) using
# the simplified chinese standard GuoBiao as in mainland China (CN)
#
# 1999, Pablo Saratxaga <pablo@mandrakesoft.com>
#

style "gtk-default-zh-cn" {
       fontset = "-adobe-helvetica-medium-r-normal--12-*-*-*-*-*-*-*,\
                  -*-*-medium-r-normal--16-*-*-*-*-*-gb2312.1980-0,*-r-*"
}
class "GtkWidget" style "gtk-default-zh-cn"

你试一下!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表