• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

Linux中文化之一次搞定RedHat8.0simsun字体的shell程序

发布: 2007-7-04 12:06 | 作者: admin | 来源:  网友评论 | 查看: 12次 | 进入软件测试论坛讨论

领测软件测试网
  我根据翔羽的<完美的redhat8,,,>的文章,编了这个bash程序,我在这里不能上传,所以
  把源文件剪贴拷贝到这里。你可以把#!/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<\/dir>/\/usr\/X11R6\/lib\/X11\/fonts\/TrueType<\/dir>\
  \/usr\/X11R6\/lib\/X11\/fonts\/Type1<\/dir>/' /etc/fonts/fonts.conf > ~/tmpfile
  cat ~/tmpfile > /etc/fonts/fonts.conf
  sed -e '/If[[:space:]]*the[[:space:]]*font/,/<\/match>/s/.*<\/string>/SimSun<\/string>/' /etc/fonts/fonts.conf > ~/tmpfile
  cat ~/tmpfile > /etc/fonts/fonts.conf
  sed -e '/zh<\/string>/,/<\/edit>/s/.*<\/bool>/true<\/bool>/' /etc/fonts/fonts.conf > ~/tmpfile
  cat ~/tmpfile > /etc/fonts/fonts.conf
  sed -e '/monospace<\/family>/,/<\/prefer>/{
  //a\
  SimSun<\/family>
  }' /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
  
  
  

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网