[Ubuntu] Plainly installs Chinese fonts

Source: Internet
Author: User
Tags aliases

Ubuntu 6.06 Dapper support for Chinese should always be good, including the default installation now contains the SCIM input method. However, the general installation of Ubuntu, although the ability to display, input Chinese, but always feel that the display of Chinese like Crooked Melon cracked jujube, very awkward. This is very helpless, and is not the fault of Linux, this is because there is almost no free Chinese font library to give us, we usually use the WinXP inside the song body, there are fangzheng typesetting system inside the Fangsong, the founder of the official documents in the song and so on, These fonts are developed by commercial companies to use in their own products, is copyrighted, so Linux can not be used. If you have not heard of the copyright of the font, the Internet search for "Hu Wanjin" bar, this man is a Microsoft engaged in font production of a staff, he made the copyright of the font is owned by Microsoft Company. Although our country is very concerned about the IT industry, but more attention to Windows, the open source community and free software support almost no, until today also did not invest in the development of a set of free fonts for everyone to use. But fortunately there are good comrades with communist convictions, providing us with a free alternative, now we can use round-body landscaping, as well as open source Wenquanyi Zen Hei (domain name 2) can be used.

This article is to refer to the use of XP with the font for Chinese beautification? Article, the practice of the installation of the text body, and the Ubuntu font system more in-depth understanding, so that after installing any font will not be afraid of.

First, prepare the font file

I always thought that if I had the right to use Windows XP (through an OEM), I would have the same access to the Windows product for my personal use only, which included the use of the fonts in it. Therefore, this article will copy the WinXP font to Linux under the practice, it should be non-infringement.

The fonts in Windows are generally stored in the C:\Windows\Fonts directory, and the fonts I copy to Linux are:

Simfang.ttf fangsong simhei.ttf blackbody simkai.ttf italic simsun.ttf Arial and new Arial, original filename simsun.ttctahoma.ttf Tahoma font Tahomabd.ttf Tahoma font Bold form Verdana.ttf Verdana font verdanab.ttf Verdana font in bold form Verdanai.ttf Verdana font italic Verdanaz.ttf Bold + italic form of Verdana font

The copied font files are placed in the /home/fwolf/tools/fonts directory.

Ii. adding fonts to the available fonts in Linux

First, link the font file to the directory where the fonts are stored

$ cd/usr/share/fonts$ ln-s/home/fwolf/tools/fonts xpfonts$ cd xpfonts$ mkfontscale$ Mkfontdir

This makes the same effect as copying the font to /usr/share/fonts a directory. The following two Mkfont commands are index information that generates the fonts contained in the Xpfonts directory. Then run the Fc-cache command to update the font cache:

$ fc-cache

Now, it should be said that Linux can use these newly installed Chinese fonts, look at the openoffic in the bar:

One of the Fangsong font name is fangsong_gb2312, bold is Simhei, italics is kaiti_gb2312, the song body is SimSun, the font name is not Chinese for the time being.

Third, modify the font rendering order of/etc/fonts/fonts.conf

Let's modify the contents of this file while analyzing the fonts.conf, and note that some comments (content between <– and –>) and insignificant or repetitive content I will skip and no longer explain.

<?xml version= "1.0"?> declares that this file is an XML document <! DOCTYPE fontconfig SYSTEM "FONTS.DTD" > XML Document Format declaration (DTD = document type define) <!--/etc/fonts/fonts.conf file to conf Igure System font Access--><fontconfig> XML file required root node
<!--do not EDIT the this   FILE.   IT'll be replaced when Fontconfig is UPDATED.   LOCAL changes BELONG in ' local.conf '.

The document prompts not to manually modify the fonts.conf, the personal settings can be written to local.conf file, and will be automatically read fonts.conf, but I do not know how to create this file, and so I know to publish it again, now take fonts.conf surgery, anyway, beforehand has made a backup.

   <dir>/usr/share/fonts</dir>   <dir>/usr/X11R6/lib/X11/fonts/Type1</dir> <dir>/ Usr/local/share/fonts</dir>   <dir>~/.fonts</dir>

Where all font files are stored, the first one is the directory where we just put the font file/usr/share/fonts.

<!--  Accept deprecated ' mono ' alias, replacing it with ' monospace '-   <match target= "pattern" >      <test qual= "any" name= "family" >         <string>mono</string>      </test>      <edit Name= "Family" mode= "assign" >         <string>monospace</string>      </edit>   </match >

Replace the alias mono in this file with the monospace, which is an automatic substitution declaration for XML that uses aliases to simplify writing or maintain compatibility with older versions. There are a few more replacements to be introduced.

<!--  Serif faces--    <alias>      <family>bitstream Vera serif</family>      < Family>vera Sans yuanti</family>                        <!--  added by lifesinger-->      <family>times</ family>      <family>times New roman</family>

The font order in which the serif font will be used. When you want to display the contents of the serif font, select the font from the list below and the matching order is top-down. You can see the already installed round body landscaping and then make the changes here. If we want to make the song body as the first choice, in the bitstream Vera serif font front Bishi plus a line on it.

As for what is the Serif font, as well as the Sans-serif font, you can look at the details of the fonts Sans Serif with Serif and Serif vs Sans Serif These two articles, explained in detail. I think it is more appropriate to call them a typeface or a word family, relative to the font.

The following Sans-serif faces, monospace faces segments are handled the same way.

<!--  If The font still has no generic name, add Sans-serif-   <match target= "pattern" >

Another three substitutions, probably meaning that if the above font match is not successful, try to replace it with the default font of Sans-serif, serif, monospace, and finally, if the substitution is unsuccessful, force the use of the Sans-serif font. (I don't know if that's the right thing to understand)

<!--  Some Asian fonts misadvertise themselves as monospaced when in  fact they is dual-spaced (half and full). C3/>this makes  FreeType very confused as it forces all widths to match.  Undo this magic by disabling the width forcing code-to-   <match target= "Font" >      <test name= "Family" > <string>GulimChe</string></test>      <edit name= "Globaladvance" ><bool>false</ Bool></edit>   </match>

Some Asian fonts actually use the equal-width font, but there is no clear declaration, this is to be compatible with this processing, to remain unchanged.

<!--   the bitstream Vera fonts has GASP entries suggesting that hinting being   disabled below 8 PPEM, but FreeType Ignores those, preferring to use the   data found in the instructed hints.  The initial Vera release   didn ' t include the right instructions in the ' Prep ' table. Fix this by   disabling hinting manually at smaller sizes (< 8PPEM)--

Fixed bitstream vera font at less than 8 points when the display problem, remain unchanged.

<!--  Load Local System customization file   <include ignore_missing= "yes" >local.conf</include> -

Load configuration file local.conf, the following ~/.fonts.conf is the same.

<!--  provide required aliases for standard names-->        <alias>                <family>serif</family >                <prefer>                        <family>bitstream Vera serif</family>

is another three series font alias, do not know this and the previous similar settings is how a relationship, probably the previous set is the alternative font, here is the recommended font? But as usual, we added our SimSun in.

<!--Artificial oblique for fonts without an italic or oblique version--

For fonts without italics, the processing method remains the same.

<!--synthetic emboldening for fonts does not has bold face available--

There is no way to handle fonts with bold characters.

<!--  These is the default Unicode chars that is expected to is blank in  fonts.  All other blank chars is assumed to being broken and  won ' t appear in the resulting charsets-

Encoding tables in Unicode encoding that should appear empty in all fonts remain unchanged.

<!--   Rescan configuration Every seconds when fcfontsetlist is called-

Check the settings file again every 30 seconds (see if the settings have changed), and stay the same.

At this point, the standard configuration file is over, and the major changes we need to make are complete. Restart X should be able to see the interface of the song Chinese. However, there are some other font processing settings that can be made in the fonts.conf, which are examples in the fonts.conf with the round-body landscaping, such as:

   <!--Win XP effect--><match target= "Font" >   <test name= "Family" ><string>vera Sans yuanti</ string></test>   <edit name= "Globaladvance" ><bool>false</bool></edit></ Match>

This is to indicate that in the Vera Sans yuanti font processing, the Globaladvance parameter is set to False, the other settings are more of this syntax, the specific meaning and effect I do not know:).

Four, Chinese font display optimization

In accordance with the above method configuration, the song can be displayed, but the font is somewhat hollow, then a simple way is to 系统->首选项->字体(system->preference->font) choose monochrome (monochrome), but so all the fonts include English fonts will have a little bit of small jagged, The alternative is to modify the fonts.conf, remove the anti-aliasing of the Arial, and replace the bold of the Arial body with bold. Add in fonts.conf:

<!--bold--><match target= "pattern" > <test name= "Family" in bold to replace the Arial body ></test> <test name= "Weight" compare= "More_eq" ><const>bold</const></test> < Edit Name= "Family" mode= "assign" ><string>SimHei</string></edit></match><!--off the Arial AA --><match target= "Font" > <test qual= "any" name= "family" ><string>simsun</string></ test> <edit name= "AntiAlias" mode= "Assign" ><bool>false</bool></edit></match>< !--troubleshoot problems that do not recognize Chinese font names--><match target= "pattern" > <test name= "Family" ><string> Arial </string> </test> <edit name= "Family" mode= "Assign" ><string>simsun</string></edit></match ><match target= "pattern" > <test name= "Family" ><string> new Arial </string></test> < Edit Name= "Family" mode= "Assign" ><string>simsun</string></Edit></match><match target= "pattern" > <test name= "Family" ><string> imitation _gb2312</string ></test> <edit name= "Family" mode= "Assign" ><string>fangsong_gb2312</string></edit ></match><match target= "pattern" > <test name= "Family" ><string> Italic _gb2312</string> </test> <edit name= "Family" mode= "Assign" ><string>kaiti_gb2312</string></edit></    Match><match target= "pattern" > <test name= "Family" ><string> blackbody </string></test> <edit name= "Family" mode= "Assign" ><string>SimHei</string></edit></match>

Why use bold to replace the bold of the Arial, because the italicized word body is not bold, Windows is also, but Windows adopted a more advanced methods to indirectly implement the bold of the song body.

Summary

The above is a simple Chinese font setting method, and my simple understanding of fonts.conf, hope to be useful to everyone, but also hope that the road warrior wrong and shortcomings. In addition, you can refer to a detailed Chinese landscaping scheme (FREETYPE/FONTCONFIG/XFT), the analysis is much more than I have.

[Ubuntu] Plainly installs Chinese fonts

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.