LinuxSir.cn,穿越时空的Linuxsir!

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

美化与输入法的问题解决之道

[复制链接]
发表于 2004-10-24 11:22:04 | 显示全部楼层 |阅读模式
看到大家仍为这些问题烦恼
我写了一个小程序
希望能为各位解忧
首先
因为suse的自带的那几个中文字型似乎有问题
建议移除
使用其它字体替代
重点是要应用程序去用
因此要设定local.conf
而输入法主要问题在
suse的XIM启动的文档和其它发行版本不同
...
这个程序的用法是
将下面三帖分别存成名称为
zhpack
xim.zhpack
local.conf.zhpack
的文字档,放在同一个目录
将zhpack改成可执行档
可用
chmod +x zhpack
然后
su
./zhpack
 楼主| 发表于 2004-10-24 11:24:20 | 显示全部楼层
以下文字存成zhpack
#!/bin/sh
#For SuSE 9.1 only
#This script will
#(1)Install 2 truetype fonts: AR PL New Sung and AR PL ZenKai Uni
#   And remove other AR PL fonts if possible
#   Then modify /etc/fonts/local.conf
#(2)Install fcitx for zh_CN locale
#   Then modify /etc/X11/xim
#2004/10/24 by chen242
#
yourlang=`echo $LANG | cut -d '.' -f 1`
echo "For SuSE 9.1 only"
echo "This script will"
echo "(1)Install 2 truetype fonts:"
echo "AR PL New Sung and AR PL ZenKai Uni"
echo "And remove other AR PL fonts if possible"
echo "Then modify /etc/fonts/local.conf"
echo "(2)Install fcitx for zh_CN locale"
echo "Then modify /etc/X11/xim"
echo "ress y <enter> to continue or Press any other key <enter> to leave this script:"
read yn
if [ "$yn" = "y" ]; then
        cp local.conf.zhpack /etc/fonts/
        cp xim.zhpack /etc/X11/
        case $yourlang in
        zh_CN)
                echo "Do you want to Install fcitx"
                echo "and modify your /etc/X11/xim?"
                echo "ress y <enter> to continue or Press any other key <enter> to ignore this step"
                read Fcitx
                if [ "$Fcitx" = "y" ]; then
                        wget http://www.fcitx.org/download/fcitx-3.0.2-1.i386.rpm
                        rpm -i fcitx-3.0.2-1.i386.rpm                       
                fi
                echo "Do you want to Install AR PL New Sung and AR PL ZenKai Uni"
                echo "and modify your /etc/fonts/local.conf?"
                echo "If you say y,other AR PL fonts will be remove!"
                echo "ress y <enter> to continue or Press any other key <enter> to ignore this step"
                read Newfonts
                if [ "$Newfonts" = "y" ]; then
                        wget http://cle.linux.org.tw/fonts/FireFly/fireflysung.ttf.gz
                        gzip -d fireflysung.ttf.gz
                        cp fireflysung.ttf /usr/X11R6/lib/X11/fonts/truetype/
                        wget http://debian.linux.org.tw/pub/3 ... 0.20040926-1.tar.gz
                        tar -zxvf ttf-arphic-ukai_0.0.20040926-1.tar.gz
                        cd ttf-arphic-ukai-0.0.20040926/
                        cp ukai.ttf /usr/X11R6/lib/X11/fonts/truetype/
                        if [ -f /usr/X11R6/lib/X11/fonts/truetype/gkai00mp.ttf ]; then
                                rpm -e ttf-arphic-gkai00mp
                                AR=1
                        fi
                        if [ -f /usr/X11R6/lib/X11/fonts/truetype/bkai00mp.ttf ]; then
                                rpm -e ttf-arphic-bkai00mp
                                AR=1
                        fi
                        if [ -f /usr/X11R6/lib/X11/fonts/truetype/gbsn00lp.ttf ]; then
                                rpm -e ttf-arphic-gbsn00lp
                                AR=1
                        fi
                        if [ -f /usr/X11R6/lib/X11/fonts/truetype/bsmi00lp.ttf ]; then
                                rpm -e ttf-arphic-bsmi00lp
                                AR=1
                        fi
                        if [ "$AR" = "1" ]; then
                                rpm -e ttf-arphic
                        fi
                fi
                if [ "$Newfonts" = "y" ]; then
                        cd /etc/fonts/
                        if [ -f local.conf.zhpack ]; then
                                mv local.conf local.conf.orig.zhpack
                                mv local.conf.zhpack local.conf
                                echo "Be sure to update your system,then you can get a bold style in Chinese fonts"
                                echo "Don't forget to change fonts setting to Sans Serif or Serif"
                        else
                        echo "can't modify your /etc/fonts/local.conf"
                        fi
                fi
                if [ "$Fcitx" = "y" ]; then
                        cd /etc/X11/
                        if [ -f xim.zhpack ]; then
                                mv xim xim.orig.zhpack
                                mv xim.zhpack xim
                                chmod 755 xim
                        else
                                echo "can't modify your /etc/X11/xim"
                        fi
                fi
        ;;
        *)
                echo "lease Change your locale to zh_CN"
                exit 1
        esac
fi
 楼主| 发表于 2004-10-24 11:26:17 | 显示全部楼层
以下文字存成xim.zhpack
#!/bin/bash
#
# $Id: xim,v 1.5 2004/01/08 10:54:41 mfabian Exp $
#
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany
#
# Mike Fabian <mfabian@suse.de>, 2000, 2001, 2002


# We start the XIM server here in ~/.xim to avoid having to do the same
# for each desktop environment separately. This script is usually sourced
# by ~/.xinitrc or ~/.xsession. The input method server will die with X.

# If you prefer to use a different XIM server, feel free to
# edit this file :-)

# Determine the LC_CTYPE locale category setting
tmplang=${LC_ALL-${LC_CTYPE-${LANG-en_US}}}

# make sure we have all the necessary directories in the path to find
# the input servers and the tools like "pidof" which are used below
# (Ami is usually in /opt/gnome/bin!):
OLD_PATH=$PATH
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/opt/gnome/bin:/usr/lib/im/locale/ja/atokserver

case $tmplang in
    ja*) # Japanese
        # ATOK-X?
        if type -p atokx_client > /dev/null 2>&1 \
           && pidof /usr/lib/im/htt > /dev/null 2>&1 \
           && pidof atokmngdaemon > /dev/null 2>&1
        then
            export XMODIFIERS="@im=htt"
            LANG=ja_JP LC_ALL=ja_JP atokx_client &
        # WXG?
        elif type -p kinput2 > /dev/null 2>&1 \
             &&  pidof wxgserver > /dev/null 2>&1
        then
            export XMODIFIERS="@im=kinput2"
            kinput2 -xim -kinput -canna -cannaserver unix &
        # Canna?
        elif type -p kinput2 > /dev/null 2>&1 \
             &&  pidof cannaserver > /dev/null 2>&1
        then
            export XMODIFIERS="@im=kinput2"
            kinput2 -xim -kinput -canna -cannaserver unix &
        # Wnn6?
        elif type -p kinput2 > /dev/null 2>&1 \
             && pidof jserver > /dev/null 2>&1 \
             && test -d /usr/local/OMRONWnn6
        then
            kinput2 -xim -kinput -wnn \
                     -wnnenvrc6 /usr/local/OMRONWnn6/wnn6linux/ja_JP/wnnenvrc &
        # FreeWnn?
        elif type -p kinput2 > /dev/null 2>&1 \
             && pidof jserver > /dev/null 2>&1
        then
            export XMODIFIERS="@im=kinput2"
            kinput2 -xim -kinput -wnn &
        fi
    ;;
    ko*) # Korean
        if type -p ami > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=Ami"
            case $WINDOWMANAGER in
                *kde|*windowmaker|*wmaker)
                    ami -wm -wait &
                ;;
                *)
                    ami &
                ;;
            esac
        fi
    ;;
    zh_HK*) # Traditional Chinese for Hongkong
        if type -p xcin > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=xcin-zh_HK"
            LANG=zh_HK LC_ALL=zh_HK xcin &
        fi
    ;;   
    zh_TW*) # Traditional Chinese
        if type -p gcin > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=gcin"
            gcin &      
        elif type -p scim > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=SCIM"
            scim -d
        elif type -p xcin > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=xcin-zh_TW"
            LANG=zh_TW LC_ALL=zh_TW xcin &
        fi
    ;;
    zh_CN*) # Simplified Chinese
        if type -p fcitx > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=fcitx"
            fcitx &
        elif type -p chinput > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=Chinput"
            case $tmplang in
                zh_CN.UTF-8|zh_CN.utf-8)
                    chinput -gb &
                ;;
                *)
                    chinput &
                ;;
            esac
        elif type -p scim > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=SCIM"
            scim -d
        elif type -p xcin > /dev/null 2>&1 ; then
            export XMODIFIERS="@im=xcin-zh_CN"
            LANG=zh_CN LC_ALL=zh_CN xcin &
        fi
    ;;
    *)  # all other languages:
   
        # probably an XIM server is not needed.
        # Nevertheless it may be useful to set XMODIFIER="@im=local"
        # because "@im=local" means "use compose and dead-keys" and
        # some programs will use compose and dead-keys only if XMODIFIERS
        # is set to either "@im=local" or "@im=none".
       
        export XMODIFIERS="@im=local"
       
        # You may want to start an XIM server, even if you don't start
        # your X11-session in a language which usually needs an input server.
        # For example, some people may start their X11 session in English, because
        # they mostly use English, but nevertheless want to have a Japanese
        # input server running, because they also write Japanese texts.
        # If you always want to have the Japanese XIM server "kinput2" running,
        # uncomment the following two lines:
       
#       export XMODIFIERS="@im=kinput2"
#       kinput2 -xim -kinput -canna &

    ;;
esac

# probably better to restore the old value of PATH...
PATH=$OLD_PATH
 楼主| 发表于 2004-10-24 11:28:27 | 显示全部楼层
以下文字存成local.conf.zhpack
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file for local customizations -->
<fontconfig>
<!-- To use bitmap font for AR PL New Sung -->
<match target="font" >
<test name="family" >
<string>AR PL New Sung</string>
</test>
<test compare="more" name="pixelsize" qual="any" >
<double>11.6</double>
</test>
<test compare="less" name="pixelsize" qual="any" >
<double>13.4</double>
</test>
<edit mode="assign" name="antialias" >
<bool>false</bool>
</edit>
</match>
<match target="font" >
<test name="family" >
<string>AR PL New Sung</string>
</test>
<test compare="more" name="pixelsize" qual="any" >
<double>14.6</double>
</test>
<test compare="less" name="pixelsize" qual="any" >
<double>15.4</double>
</test>
<edit mode="assign" name="antialias" >
<bool>false</bool>
</edit>
</match>
<!-- Artificial bold for fonts without a bold version,from firefly@firefly.idv.tw-->
<match target="font">
<test target="pattern" name="weight" compare="more">
<const>medium</const>
</test>
<edit name="weight" mode="assign">
<const>bold</const>
</edit>
</match>
<!--
  Serif faces
-->
<alias>
<family>Bitstream Vera Serif</family>
<family>Times</family>
<family>Times New Roman</family>
<family>Nimbus Roman No9 L</family>
<family>Luxi Serif</family>
<family>Kochi Mincho</family>
<family>AR PL ZenKai Uni</family>
<family>Baekmuk Batang</family>
<family>FreeSerif</family>
<default><family>serif</family></default>
</alias>
<!--
  Sans-serif faces
-->
<alias>
<family>Bitstream Vera Sans</family>
<family>Helvetica</family>
<family>Arial</family>
<family>Verdana</family>
<family>Nimbus Sans L</family>
<family>Luxi Sans</family>
<family>Kochi Gothic</family>
<family>AR PL New Sung</family>
<family>Baekmuk Dotum</family>
<family>SimSun</family>
<family>FreeSans</family>
<default><family>sans-serif</family></default>
</alias>
<!--
  Monospace faces
-->
<alias>
<family>Bitstream Vera Sans Mono</family>
<family>Courier</family>
<family>Courier New</family>
<family>Andale Mono</family>
<family>Luxi Mono</family>
<family>Nimbus Mono L</family>
<family>AR PL New Sung</family>
<family>NSimSun</family>
<family>FreeMono</family>
<default><family>monospace</family></default>
</alias>
<!--
  Provide required aliases for standard names
-->
<alias>
<family>serif</family>
<prefer>
<family>Century SchoolbookL</family>
<family>Bitstream Vera Serif</family>
<family>Times New Roman</family>
<family>Nimbus Roman No9 L</family>
<family>Luxi Serif</family>
<family>Times</family>
<family>Frank Ruehl</family>
<family>Kochi Mincho</family>
<family>AR PL ZenKai Uni</family>
<family>Baekmuk Batang</family>
<family>FreeSerif</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
<family>Verdana</family>
<family>Nimbus Sans L</family>
<family>Luxi Sans</family>
<family>Arial</family>
<family>Helvetica</family>
<family>Nachlieli</family>
<family>Kochi Gothic</family>
<family>AR PL New Sung</family>
<family>Baekmuk Dotum</family>
<family>SimSun</family>
<family>FreeSans</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>Andale Mono</family>
<family>Courier New</family>
<family>Luxi Mono</family>
<family>Nimbus Mono L</family>
<family>Miriam Mono</family>
<family>Kochi Gothic</family>
<family>AR PL New Sung</family>
<family>AR PL ZenKai Uni</family>
<family>Baekmuk Dotum</family>
<family>FreeMono</family>
</prefer>
</alias>
<!--
Artificial oblique for fonts without an italic or oblique version
-->
<match target="font">
<!-- check to see if the font is roman -->
<test name="slant">
<const>roman</const>
</test>
<!-- check to see if the pattern requested non-roman -->
<test target="pattern" name="slant" compare="not_eq">
<const>roman</const>
</test>
<!-- multiply the matrix to slant the font -->
<edit name="matrix" mode="assign">
<times>
<name>matrix</name>
<matrix><double>0.9</double><double>0.2</double>
<double>0</double><double>0.95</double>
</matrix>
</times>
</edit>
<!-- pretend the font is oblique now -->
<edit name="slant" mode="assign">
<const>oblique</const>
</edit>
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>
</fontconfig>
 楼主| 发表于 2004-10-24 11:36:56 | 显示全部楼层
这是之前

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
 楼主| 发表于 2004-10-24 11:37:50 | 显示全部楼层
这是之后

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2004-10-24 12:32:19 | 显示全部楼层
什么版本的suse啊?
觉得[之前]的效果相当不错……
发表于 2004-10-24 12:48:32 | 显示全部楼层
我也更喜欢之前的效果。
 楼主| 发表于 2004-10-24 13:15:18 | 显示全部楼层
这是suse 9.1 pro
update 之后

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
 楼主| 发表于 2004-10-24 13:17:46 | 显示全部楼层
您也可以使用自己的配置

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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