Gentoo Chinese font beautification

Source: Internet
Author: User

Install necessary components and Fonts

# Emerge Cairo fontconfig libxft FreeType
# Emerge arphicfonts wqy-bitmapfont cjkuni-fonts corefonts TTF-bitstream-Vera

 

Then, you can use the local. conf provided by the grass-roots development kit (setting local. conf is safer than changing fonts. conf) to display the local. conf file in simplified mode.

Thanks to linuxsir. org for providing this file.

File:/etc/fonts/local. conf

<?xml version="1.0"?>
<fontconfig>
<alias>
<family>serif</family>
<prefer>
<family>Bitstream Vera Serif</family>
<family>Microsoft Yahei</family>
<family>DejaVu Serif</family>
<family>AR PL ShanHeiSun Uni</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer>
<family>Bitstream Vera Sans</family>
<family>Microsoft Yahei</family>
<family>DejaVu Sans</family>
<family>AR PL ShanHeiSun Uni</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<alias>
<family>monospace</family>
<prefer>
<family>Bitstream Vera Sans Mono</family>
<family>Microsoft Yahei</family>
<family>DejaVu Sans Mono</family>
<family>AR PL ShanHeiSun Uni</family>
<family>WenQuanYi Bitmap Song</family>
<family>AR PL ZenKai Uni</family>
</prefer>
</alias>
<match target="font" >
<edit name="rgba" mode="assign">
<const>none</const>
</edit>
<edit mode="assign" name="antialias" >
<bool>true</bool>
</edit>
<edit mode="assign" name="autohint" >
<bool>false</bool>
</edit>
<edit name="hinting">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign" >
<const>hintmedium</const>
</edit>
</match>
<match target="font" >
<test name="family" compare="contains" >
<string>Song</string>
<string>Sun</string>
<string>Kai</string>
<string>Ming</string>
</test>
<test name="weight" compare="less_eq">
<int>100</int>
</test>
<test compare="more_eq" target="pattern" name="weight" >
<int>180</int>
</test>
<edit mode="assign" name="embolden" >
<bool>true</bool>
</edit>
</match>
<match target="font" >
<test name="family" compare="contains" >
<string>Song</string>
<string>Sun</string>
<string>Kai</string>
<string>Ming</string>
</test>
<edit name="globaladvance">
<bool>false</bool>
</edit>
<edit name="spacing">
<int>0</int>
</edit>
<edit name="hinting">
<bool>true</bool>
</edit>
<edit name="autohint">
<bool>false</bool>
</edit>
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
<test name="pixelsize" compare="less_eq">
<int>18</int>
</test>
<edit name="antialias" mode="assign" >
<bool>false</bool>
</edit>
</match>
<match target="font" >
<test name="family" compare="contains" >
<string>Microsoft Yahei</string>
</test>
<edit name="globaladvance">
<bool>false</bool>
</edit>
<edit name="spacing">
<int>0</int>
</edit>
</match>
</fontconfig>

 

 

========================================================== ========================================

========================================================== ========================================

========================================================== ========================================

========================================================== ========================================

Gentoo howto added Fonts

Manually add

If you need to manually addPortageYou can add a font that is not provided or not available. Take simsun. TTC as an example.

Copy font

Copy the font file to a folder in/usr/share/fonts, such as/usr/share/fonts/TTF. Then modify the File Permission

Code:Modify permissions
# chmod 644 /usr/share/fonts/TTF/simsun.ttc

Modify/etc/X11/Xorg. conf

Make sure that the section "Files" in/etc/X11/Xorg. conf has the corresponding path, for example:

File:/Etc/X11/Xorg. conf
Section "Files"
...
FontPath "/usr/share/fonts/TTF"
...
EndSection

Generate fonts. dir and fonts. Scale

This step aims to enable programs that use the X core font API to use the font. Examples of such programs include xterm, emacs, and xmms.

InstallX11-apps/mkfontdir.AndX11-apps/mkfontscaleAnd generate fonts. dir and fonts. Scale

Code:Install mkfontdir and mkfontscale
$ emerge mkfontdir mkfontscale
$ cd /usr/share/fonts/TTF
$ sudo mkfontdir
$ sudo mkfontscale

Update the fontconfig Cache

The purpose of this step is to enable the fontconfig to be used to configure the font. Both QT and GTK + 2 belong to this type.

Code:FC-Cache-FV

$ Sudo FC-Cache-FV

Verify that the installation is successful
Prompt!After completing the above steps, you may need to restart your X and continue the following operations.

Programs that use the X core font API

InstallX11-apps/xlsfontsRun xlsfonts to check whether the names of the fonts that have just been installed can be listed. The name of the X core font is long, for example:

Code:X core font name
-misc-simsun-medium-r-normal--0-0-0-0-c-0-ascii-0
-misc-simsun-medium-r-normal--0-0-0-0-c-0-gb18030.2000-0
-misc-simsun-medium-r-normal--0-0-0-0-c-0-gb2312.1980-0
-misc-simsun-medium-r-normal--0-0-0-0-c-0-gbk-0
-misc-simsun-medium-r-normal--0-0-0-0-c-0-ibm-cp850
-misc-simsun-medium-r-normal--0-0-0-0-c-0-iso10646-1
-misc-simsun-medium-r-normal--0-0-0-0-c-0-iso8859-1
-misc-simsun-medium-r-normal--0-0-0-0-c-0-iso8859-15
-misc-simsun-medium-r-normal--0-0-0-0-c-0-koi8-r

If so, xmms can be used.

Prompt!The xlsfonts command must be executed in terminal of X. Otherwise, you must add the parameter-display displayname to specify displayname.

Use the fontconfig Program

Run FC-list to check whether the names of the fonts that have just been installed can be listed.

 

========================================================== ========================================

========================================================== ========================================

========================================================== ========================================

========================================================== ========================================

 

  Make Gentoo more elegant in Chinese and English Fonts Favorites

New article: quick installation of Gentoo| Old article: C/C ++ programming in Emacs



Make Gentoo more elegant in Chinese and English Fonts


Gentoo

First, we must copy simsun. TTC and tahoma. TTF tahoab. TTF under Widnows to the Gentoo font directory, and then
# mkfontscale
# mkfontdir
# fc-cache -f -v

Then we modify the fontconfig configuration file/etc/fonts. conf to advance the sequence of simsum in SANS and Serif, for example

<! --
Serif faces
-->
<Alias>
<Family> bitstream Vera serif </family>
<Family> Times </family>
<Family> Times New Roman </family>
<Family> Nimbus Roman no9 L </family>
<Family> simsun </family>
<Family> Luxi serif </family>
<Family> Kochi mincho </family>
<Family> ar PL sungtil GB </family>
<Family> ar PL mingti2l big5 </family>
<Family> baekmuk Batang </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> simsun </family>
<Family> Luxi sans </family>
<Family> Kochi Gothic </family>
<Family> ar PL kaitim GB </family>
<Family> ar PL kaitim big5 </family>
<Family> baekmuk dotum </family>
<Default> <family> sans-serif </family> </default>
</Alias>

(Omitted in the middle)

<Alias>
<Family> serif </family>
<Prefer>
<Family> bitstream Vera serif </family>
<Family> Times New Roman </family>
<Family> Nimbus Roman no9 L </family>
<Family> simsun </family>
<Family> Luxi serif </family>
<Family> Times </family>
<Family> Kochi mincho </family>
<Family> ar PL sungtil GB </family>
<Family> ar PL mingti2l big5 </family>
<Family> baekmuk Batang </family>
</Prefer>
</Alias>
<Alias>
<Family> sans-serif </family>
<Prefer>
<Family> bitstream Vera sans </family>
<Family> verdana </family>
<Family> Nimbus sans L </family>
<Family> simsun </family>
<Family> Luxi sans </family>
<Family> Arial </family>
<Family> Helvetica </family>
<Family> Kochi Gothic </family>
<Family> ar PL kaitim GB </family>
<Family> ar PL kaitim big5 </family>
<Family> baekmuk dotum </family>
</Prefer>
</Alias>

Start X and select "app font", "desktop font", and "window title Font" from "desktop"> "Preferences"> "font" as tahoma, therefore, the order of Chinese fonts is changed. When an English font cannot be recognized, simsun is automatically selected as the Chinese font.

Since the antialias of simsun is not disabled, the Chinese font display is still a little ugly. You can add the following code to/etc/fonts. conf to disable the AA Effect of simsun:

<! -- Disable the AA of simsun -->
<Match target = "font">
<Test qual = "any" name = "family">
<String> simsun </string>
</Test>
<Edit name = "antialias" mode = "Assign">
<Bool> false </bool>
</Edit>
</Match>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.