+ -
当前位置:首页 → 问答吧 → 美化与输入法的问题解决之道

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

时间:2004-10-24

来源:互联网

看到大家仍为这些问题烦恼
我写了一个小程序
希望能为各位解忧
首先
因为suse的自带的那几个中文字型似乎有问题
建议移除
使用其它字体替代
重点是要应用程序去用
因此要设定local.conf
而输入法主要问题在
suse的XIM启动的文档和其它发行版本不同
...
这个程序的用法是
将下面三帖分别存成名称为
zhpack
xim.zhpack
local.conf.zhpack
的文字档,放在同一个目录
将zhpack改成可执行档
可用
chmod +x zhpack
然后
su
./zhpack

作者: chen242   发布时间: 2004-10-24

以下文字存成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 "Press 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 "Press 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 "Press 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/FireFl...flysung.ttf.gz
gzip -d fireflysung.ttf.gz
cp fireflysung.ttf /usr/X11R6/lib/X11/fonts/truetype/
wget http://debian.linux.org.tw/pub/3Anop...40926-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 "Please Change your locale to zh_CN"
exit 1
esac
fi

作者: chen242   发布时间: 2004-10-24

以下文字存成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 <[email protected]>, 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

作者: chen242   发布时间: 2004-10-24

以下文字存成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 [email protected]>
<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>

作者: chen242   发布时间: 2004-10-24

这是之前
上传的图像
before.jpg (79.1 KB, 234 次查看)

作者: chen242   发布时间: 2004-10-24

这是之后
上传的图像
after.jpg (88.5 KB, 235 次查看)

作者: chen242   发布时间: 2004-10-24

什么版本的suse啊?
觉得[之前]的效果相当不错……

作者: addone   发布时间: 2004-10-24

我也更喜欢之前的效果。

作者: zuolun   发布时间: 2004-10-24

这是suse 9.1 pro
update 之后
上传的图像
after1.jpg (75.4 KB, 189 次查看)

作者: chen242   发布时间: 2004-10-24

您也可以使用自己的配置
上传的图像
after2.jpg (85.4 KB, 192 次查看)

作者: chen242   发布时间: 2004-10-24

老大你这是怎么做的衣告诉我们好吗.谢谢.

作者: linux1104   发布时间: 2004-10-25

“之后”的效果再把字体调大一点可能就很不错了。

作者: 锋锋   发布时间: 2004-10-25

how's about this
上传的图像
after5.jpg (97.6 KB, 160 次查看)

作者: chen242   发布时间: 2004-10-25

喜欢之前的

作者: gradetwo   发布时间: 2004-10-25

热门下载

更多