FreeBSD 中文化实践

来源:岁月联盟 编辑:zhu 时间:2008-01-18
FreeBSD 中文化实践内容简介:【FreeBSD教程】 FreeBSD 4.7 Release Xfree86 4.2.1 gnome 1.4 OpenOffice 1.0.1 Chinput3 使用 tar 解开压缩包。 使用如下命令将源码升级到4.2.1。 gzip -d 4.2.0-4.2.1-1-freebsd.patch.gz | patch -p0 -E 进入目录xc/n

  【FreeBSD教程】FreeBSD 4.7 Release Xfree86 4.2.1 gnome 1.4 OpenOffice 1.0.1 Chinput3
  
  使用 tar 解开压缩包。
  使用如下命令将源码升级到4.2.1。
  gzip -d < 4.2.0-4.2.1-1-freebsd.patch.gz | patch -p0 -E
  进入目录xc/nls/XI18N_OBJS,把zh文件复制一个名为zh_CN的文件,然后在这个目录中的Imakefile中加入一行:
  XI18NTarget(zh_CN)
  回到xc目录,重新编译安装整个X系统。

  设定locale为zh_CN.EUC
  c shell修改.cshrc 加入:
  setenv LC_ALL zh_CN.EUC
  setenv LANG zh_CN.EUC
  bash修改.profile 加入:
  export LC_ALL=zh_CN.EUC
  export LANG=zh_CN.EUC
  修改 /usr/X11R6/share/gnome/gtkrc.zh_CN

  将所有的fontset设置修改为:
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  修改 /usr/X11R6/share/themes/gtk/Default/gtkrc.zh_CN 如下:
  style "gtk-default-zh-cn" {
  fontset = "-adobe-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-1,
  -*-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0,*-r-*"
  }
  class "GtkWidget" style "gtk-default-zh-cn"
  重新起动X-win,现在在菜单里应该可以看见中文的菜单了。

  3.安装chinput3
  从ftp://ftp.freebsdchina.org/pub/china-ports/下载 chinput302final.tgz,tar 解压后,进行编译。
  #make
  #make data
  #make install
  #make install-data

  这个版本的源代码还有一些错误。主要如下:
  src/ZWinControl/text目录下的文件zwincontrol_gb.po中有一个重复定义,删除。
  安装时提示/usr/share/locale/zh_TW.Big5/LC_MESSAGES存在,备份后删除再进行安装。
  需要将fonts目录下的字体安装到x-win系统中。创建/usr/X11R6/lib/X11/fonts/chgb目录,将fonts目录下的两个文件拷贝到创建的目录下,并在/usr/X11R6/lib/X11/XF86Config配置文件中加入:
  FontPath "/usr/X11R6/lib/X11/fonts/chgb/"
  在用户目录下的 .xinitrc目录中加入:
  export XMODIFIERS=@im=Chinput
  chinput
  exec gnome-session
  这样在x-win执行其他程序之前起动chinput,就可以在mozilla等可以编辑文件的软件中用Ctrl Space叫出输入法了。
  将修正后的chinput3上载在 ftp://bsd.starhiway.net/pub/FreeBSD/chinput3/ 上。

  4.安装openoffice.zh_CN
  从ports安装openoffice.zh_CN,编译openoffice需要有足够的硬盘空间(约4G),进入目录/usr/ports/chinese/openoffice.zh_CN/
  #cd /usr/ports/chinese/openoffice.zh_CN
  #make
  由于openoffice倚赖很多其他软件包,ports能够自动下载所需软件包的原文件并进行安装,在他所倚赖的软件包安装完成后,会下载openoffice的源文件并开始编译。但openoffice所依靠的jdk的源代码由于有一些非凡的许可问题,需要手工到相应网站进行下载。openoffice使用了mozilla 1.0.1的源文件,在编译时会出错。将/usr/ports/www/mozilla/ 目录下的所有文件拷贝到/usr/ports/chinese/openoffice.zh_CN/work/mozilla下,再回到/usr/ports/chinese/openoffice.zh_CN下重新make,即可顺利完成编译,编译比较耗时,耐心等待编译完成吧。
  完成编译后,make install安装。
  然后在 x-win 环境下运行 openoffice, 按照提示一路下一步(Next), 就完成了设置。 注重这时的字体很模糊。
  完成了设置后,再次运行openoffice,OK,现在开始修正字体。在菜单工具->选项 里,Openoffice.org->字体替换 选中 使用替换表,在字体里写入 Andale Sans UI,在替换为一栏选择SimSun字体,然后按绿对勾按钮添加。再在前面两个选中框中选中,确定即可。现在菜单的字体完全正常了。
  在添加字体替换时,假如你找不到绿对勾按钮。可能是因为你的屏幕分辨率和字体设置问题,导致那个对话框拉的很长。可以通过设置虚拟屏幕的方式,将屏幕扩大,以便能够显示出那个按钮。
  在/usr/X11R6/lib/X11/XF86Config文件中,对应的显示模式下加入
  Virtual 1600 1200
  如:
  Section "Screen"
  Identifier "Screen0"
  Device "Card0"
  Monitor "Monitor0"
  DefaultColorDepth 16 /* 默认显示颜色深度为16位色 */
  SubSection "Display"
  Depth 1
  EndSubSection
  SubSection "Display"
  Depth 4
  EndSubSection
  SubSection "Display"
  Depth 8
  EndSubSection
  SubSection "Display"
  Depth 15
  EndSubSection
  SubSection "Display"
  Virtual 1600 1200 /* 设定虚拟屏幕大小为1600 * 1200 */
  Depth 16
  EndSubSection
  SubSection "Display"
  Depth 24
  EndSubSection
  EndSection
  附相关配置文件:
  /* XF86Config */
  Section "ServerLayout"
  Identifier "XFree86 Configured"
  Screen 0 "Screen0" 0 0
  InputDevice "Mouse0" "CorePointer"
  InputDevice "Keyboard0" "CoreKeyboard"
  EndSection
  Section "Files"
  RgbPath "/usr/X11R6/lib/X11/rgb"
  ModulePath "/usr/X11R6/lib/modules"
  FontPath "/usr/X11R6/lib/X11/fonts/TrueType/"
  FontPath "/usr/X11R6/lib/X11/fonts/URW/"
  FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
  FontPath "/usr/X11R6/lib/X11/fonts/misc/"
  FontPath "/usr/X11R6/lib/X11/fonts/Speedo/"
  FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
  FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
  FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
  EndSection
  Section "Module"
  Load "xtt"
  Load "dbe"
  Load "dri"
  Load "extmod"
  Load "glx"
  Load "pex5"
  Load "record"
  Load "xie"
  Load "xtrap"
  Load "speedo"
  Load "type1"
  EndSection
  Section "InputDevice"
  Identifier "Keyboard0"
  Driver "keyboard"
  Option "XkbRules" "xfree86"
  Option "XkbModel" "pc101"
  Option "XkbLayout" "us"
  EndSection
  Section "InputDevice"
  Identifier "Mouse0"
  Driver "mouse"
  Option "Protocol" "MouseSystems"
  Option "Device" "/dev/sysmouse"
  EndSection
  Section "Monitor"
  Identifier "Monitor0"
  VendorName "Monitor Vendor"
  ModelName "Monitor Model"
  HorizSync 31.5 - 79.0
  VertRefresh 50.0 - 90.0
  EndSection
  Section "Device"
  ### Available Driver options are:-
  ### Values: : integer, : float, : "True"/"False",
  ### : "String", : " Hz/kHz/MHz"
  ### [arg]: arg optional
  #Option "NoAccel" # []
  #Option "HWCursor" # []
  #Option "SWCursor" # []
  #Option "ShadowFB" # []
  #Option "Rotate" # []
  #Option "UseBIOS" # []
  #Option "LCDClock" # #Option "ShadowStatus" # []
  #Option "VideoRAM" # Identifier "Card0"
  Driver "savage"
  VendorName "S3"
  BoardName "Savage/IX-MV"
  ChipSet "MobileSavage"
  BusID "PCI:1:0:0"
  EndSection
  Section "Screen"
  Identifier "Screen0"
  Device "Card0"
  Monitor "Monitor0"
  DefaultColorDepth 16
  SubSection "Display"
  Depth 1
  EndSubSection
  SubSection "Display"
  Depth 4
  EndSubSection
  SubSection "Display"
  Depth 8
  EndSubSection
  SubSection "Display"
  Depth 15
  EndSubSection
  SubSection "Display"
  # Virtual 1600 1200
  Depth 16
  EndSubSection
  SubSection "Display"
  Depth 24
  EndSubSection
  EndSection
  /* /usr/X11R6/lib/X11/fonts/TrueType/fonts.dir */
  24
  simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
  ai=0.3:simsun.ttc -misc-SimSun-medium-i-normal--0-0-0-0-c-0-gb2312.1980-0
  ds=y:simsun.ttc -misc-SimSun-bold-r-normal--0-0-0-0-c-0-gb2312.1980-0
  ds=y:ai=0.3:simsun.ttc -misc-SimSun-bold-i-normal--0-0-0-0-c-0-gb2312.1980-0
  simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-iso8859-1
  ai=0.3:simsun.ttc -misc-SimSun-medium-i-normal--0-0-0-0-p-0-iso8859-1
  ds=y:simsun.ttc -misc-SimSun-bold-r-normal--0-0-0-0-p-0-iso8859-1
  ds=y:ai=0.3:simsun.ttc -misc-SimSun-bold-i-normal--0-0-0-0-p-0-iso8859-1
  simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-koi8-r
  ai=0.3:simsun.ttc -misc-SimSun-medium-i-normal--0-0-0-0-p-0-koi8-r
  ds=y:simsun.ttc -misc-SimSun-bold-r-normal--0-0-0-0-p-0-koi8-r
  ds=y:ai=0.3:simsun.ttc -misc-SimSun-bold-i-normal--0-0-0-0-p-0-koi8-r
  simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-fcd8859-15
  ai=0.3:simsun.ttc -misc-SimSun-medium-i-normal--0-0-0-0-p-0-fcd8859-15
  ds=y:simsun.ttc -misc-SimSun-bold-r-normal--0-0-0-0-p-0-fcd8859-15
  ds=y:ai=0.3:simsun.ttc -misc-SimSun-bold-i-normal--0-0-0-0-p-0-fcd8859-15
  simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-p-0-iso8859-15
  ai=0.3:simsun.ttc -misc-SimSun-medium-i-normal--0-0-0-0-p-0-iso8859-15
  ds=y:simsun.ttc -misc-SimSun-bold-r-normal--0-0-0-0-p-0-iso8859-15
  ds=y:ai=0.3:simsun.ttc -misc-SimSun-bold-i-normal--0-0-0-0-p-0-iso8859-15
  simsun.ttc -misc-SimSun-medium-r-normal--0-0-0-0-c-0-iso10646-1
  ai=0.3:simsun.ttc -misc-SimSun-medium-i-normal--0-0-0-0-c-0-iso10646-1
  ds=y:simsun.ttc -misc-SimSun-bold-r-normal--0-0-0-0-c-0-iso10646-1
  ds=y:ai=0.3:simsun.ttc -misc-SimSun-bold-i-normal—0-0-0-0-c-0-iso10646-1
  /* /usr/X11R6/share/gnome/gtkrc.zh_CN */
  # $(datadir)/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 style "GnomeScores_CurrentPlayer_style"
  {
  fg[NORMAL] = {1.0, 0.0, 0.0}
  }
  style "GnomeScores_Logo_style"
  {
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  fg[NORMAL] = {0.0, 0.0, 1.0}
  }
  style "GnomeAbout_DrawingArea_style"
  {
  bg[NORMAL] = {1.0, 1.0, 1.0}
  }
  style "GnomeAbout_Title_style"
  {
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  }
  style "GnomeAbout_Copyright_style"
  {
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  }
  style "GnomeAbout_Author_style"
  {
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  }
  style "GnomeAbout_Names_style"
  {
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  }
  style "GnomeAbout_Comments_style"
  {
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  }
  style "GnomeHRef_Label_style"
  {
  fg[NORMAL] = { 0.0, 0.0, 1.0 }
  fg[PRELIGHT] = { 0.0, 0.0, 1.0 }
  fg[INSENSITIVE] = { 0.5, 0.5, 1.0 }
  fg[ACTIVE] = { 1.0, 0.0, 0.0 }
  }
  style "GnomeGuru_PageTitle_style"
  {
  fontset = "-misc-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0"
  }
  widget "*GnomeScores*.CurrentPlayer" style "GnomeScores_CurrentPlayer_style"
  widget "*GnomeScores*.Logo" style "GnomeScores_Logo_style"
  widget "*GnomeAbout*.DrawingArea" style "GnomeAbout_DrawingArea_style"
  widget "*GnomeAbout*.Author" style "GnomeAbout_Author_style"
  widget "*GnomeAbout*.Comments" style "GnomeAbout_Comments_style"
  widget "*GnomeAbout*.Copyright" style "GnomeAbout_Copyright_style"
  widget "*GnomeAbout*.Names" style "GnomeAbout_Names_style"
  widget "*GnomeAbout*.Title" style "GnomeAbout_Title_style"
  widget "*GnomeHRef.GtkLabel" style "GnomeHRef_Label_style"
  widget "*GnomeGuru*.PageTitle" style "GnomeGuru_PageTitle_style"
  /* /usr/X11R6/share/themes/Default/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 #
  style "gtk-default-zh-cn" {
  fontset = "-adobe-helvetica-medium-r-normal--14-*-*-*-*-*-iso8859-1,
  -*-SimSun-medium-r-normal--14-*-*-*-*-*-gb2312.1980-0,*-r-*"
  }
  class "GtkWidget" style "gtk-default-zh-cn"
  

图片内容