Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ubuntu 中文字体设置/美化
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="pattern">
<test name="lang">
<string>zh-cn</string>
</test>
<test qual="any" name="family">
<string>serif</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>NSimSun</string>
<string>SimSun</string>
<string>WenQuanYi Bitmap Song</string>
<string>Noto Serif</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>sans-serif</string>
</test>
<test name="lang">
<string>zh-cn</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Microsoft YaHei</string>
<string>WenQuanYi Micro Hei</string>
<string>Noto Sans</string>
</edit>
</match>
<match target="pattern">
<test qual="any" name="family">
<string>monospace</string>
</test>
<test name="lang">
<string>zh-cn</string>
</test>
<edit name="family" mode="prepend" binding="strong">
<string>Microsoft YaHei</string>
<string>WenQuanYi Micro Hei Mono</string>
<string>Noto Sans</string>
</edit>
</match>
<!-- Antialias -->
<!-- http://www.linuxhowtos.org/Tips%20and%20Tricks/firefoxnoaa.htm -->
<match target="font">
<test qual="any" name="size" compare="less">
<double>13</double>
</test>
<edit name="antialias" mode="assign">
<bool>false</bool>
</edit>
</match>
</fontconfig>

Ubuntu12.04版本中默认的是微米黑. Ubuntu从13.04开始取消了默认的微米黑,回退为之前的正黑。这我觉得只能用回退形容了。

在默认设置下,Ubuntu 13以后中文使用的是文泉驿正黑。我总觉得它的效果有些发虚,模糊,不满意。

于是决定替换掉回来。

Ubuntu 对中文字体的控制集中在一个文件,/etc/fonts/conf.d/69-language-selector-zh-cn.conf,from the language-selector-common pacakge.

修改如下,简单说,就是把系统默认的正黑替换为微米黑并提前。有这一个在最前面保证就足够了。

这样,英文默认Ubuntu,中文默认文泉驿微米黑,即使浏览器中带着CSS样式的文字,也有不错的显示效果。效果理想。

History:

  • Include the 69-language-selector-zh-cn.conf from Ubuntu 15.04 Vivid.
  • Update it to Ubuntu 16.04 LTS Xenial
  • Done Changing 中文默认 to 文泉驿微米黑
  • Add Antialias when pointsize <13
  • Add URxvt Xresources file

Update 2016-05-23,

Given the package size info as following, decided to remove the wqy-zenhei (文泉驿正黑) entirely, and use fonts-noto instead.

16461 fonts-wqy-zenhei
15581 fonts-noto-hinted
5167 fonts-wqy-microhei

Ref:

http://www.cnblogs.com/daizhe11/p/3384391.html

! -*- x-resource-generic -*-
*font: 6x13
*boldFont: 6x13bold
*font1: 7x14
*font2: 8x16
*background: black
*foreground: gray74
*cursorColor: green
*scrollColor: #b2b2b2
*visualBell: False
*reverseVideo: False
*meta8: False
*utmpInhibit: False
*mapAlert: False
*greek_keyboard: False
*geometry: 80x25
*saveLines: 1500
!*loginShell: False
!+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+!
!| Key symbol bindings |!
!+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::+!
Rxvt.keysym.Insert: \\e[2~
Rxvt.keysym.Home: \\e[1~
Rxvt.keysym.Prior: \\e[5~
Rxvt.keysym.Select: \\e[3~
Rxvt.keysym.End: \\e[4~
Rxvt.keysym.Next: \\e[6~
!+! rxvt-unicode ---------------------------------------------------------------
URxvt.font: xft:SimSun:pixelsize=13,xft:WenQuanYi Bitmap Song:pixelsize=13
*scrollBar: True
!scrollbar styles: rxvt, plain, next or xterm
*scrollstyle: xterm
!*scrollBar_floating: False
!jump to bottom (prompt) on tty output?
*scrollTtyOutput: False
!jump to bottom (prompt) when tty gets new lines?
*scrollWithBuffer: False
!jump to bottom (prompt) on keypress
*scrollTtyKeypress: True
!fade text n% upon unfocus
*fading: 10
!darken=(0 to 100) lighten=(-1 to -100)
*shading: 0
!de-iconify (map) on receipt of a bell character
urxvt*mapAlert: true
!inhibit writing record into the system log file utmp
urxvt*utmpInhibit: true
!screen dump settings
urxvt*print-pipe: cat > $(echo urxvt.dump.$(date +'%Y%M%d%H%m%S'))
urxvt*perl-ext-common: default,tabbed
!delimiters for double-click mouse selection
urxvt*cutchars: "()*,<>[]{}|:@$'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.