Linux Desktop System font configuration details (ii)

Source: Internet
Author: User
Tags config deprecated number sign linux

Font configuration Combat

Next, take Fedora 20 as an example and configure it to display the correct effect yourself. Currently, the tool for configuring fonts on Linux systems is fontconfig.

Why the Fontconfig?

Thanks to this era, once chaotic font configuration method has finally been Fontconfig Unified Lake. In Linux, font configuration has been fragmented, chaotic, xserver, Xft, GTK, GTK2, Qt and so on their respective configuration means, the font engine also has Type1, FreeType and so on. Currently, you can assume that you need only configure Fontconfig in your Linux system.

Xorg's official website documents: xorg has two font systems, one font system is Xserver font system, the other is xft, and Xorg official suggested that all the interface Library developers preferred xft font system; For the font engine, Now only FreeType is left, and Type1 's function has been merged into the FreeType. Freedesktop.org's official website contains xft, FreeType, and fontconfig documents, albeit briefly, But also mentioned: Xft1.0 and previous versions, need to xftconfig file to configure the font, from Xft1.1 later, all use Fontconfig to configure the font; Fontconfig's documentation says it is only responsible for font configuration, not for font display.

So, configure the fonts in Linux, we only use to ignore Fontconfig, still have questions?

Learning Fontconfig

The best way to learn fontconfig is to read the man fonts.conf manual page, and second, to read the configuration file in the/ETC/FONTS/CONF.D directory and learn from the example.

Fontconfig's function is to help the application to select the font and guide the display of the font (can only say the guide, because the specific display by xft, FreeType, etc.), with what strategy to select the font and what options to display fonts, through the configuration file to specify. Fontconfig the configuration file two times, the first time the application passed to the Fontconfig font list (called pattern) to operate, by adding, removing, replacing the pattern in the font name, so that the application to get the appropriate font The second time, the font has been selected to operate, then generally do not change the font name, but the anti-aliasing (antialias), fine tuning (hinting), Automatic fine tuning (autohint), fine-tuning level (Hintstyle) and pixel smoothing (RGBA) and other properties to control.

Fontconfig configuration file syntax, this does not need me to nag here, look at man fonts.conf the man page can be, it is not difficult, it's a lot of elements, such as match, Target, test, edit, String, bool, double, The const, and so on, itself is self explanatory, see this word to know what it means. Its principle is to each <match...>...</match>, through <test...>...</test> to select the elements to edit, and then use <EDIT...> </edit> to edit the element.

Configure Fedora 20

Fontconfig first read the configuration file is/etc/fonts/fonts.conf, then, according to/etc/fonts/fonts.conf inside the <include>...</include> Information to load the other configuration files. Fedora 20 defaults to loading all files in the/ETC/FONTS/CONF.D directory. Of course, there are too many files in the/ETC/FONTS/CONF.D directory, introducing a lot of unnecessary complexity. For me this kind of pursuit of simplicity, I directly changed it, let/ETC/FONTS/CONF.D file to hell, from my own home directory fonts.conf.d directory load configuration file bar. As shown below, I commented out the 71st line and added the 72nd line:

The following is a formal start to write the configuration file.

Step one: Change the nonstandard font classification name to the standard font category naming

The English font classification has serif, Sans-serif and monospace, the Chinese classification has "the song Body" and "the Blackbody", but we cannot guarantee that other people when requests the font the spelling is accurate, for instance may spell "sans serif" or "the Sans", "the Mono" and so on , Chinese may also be written in the traditional "song", "Black" or pinyin "Songti", "Heiti" and so on, in order to the simplicity of the configuration file, these non-standard classification name to first replace the standard classification name.

The standardization of the English classification name/etc/fonts/fonts.conf This main configuration file (which is the file that I screenshot above) has done, its complete code is as follows:

  1<?xml version= "1.0"?> 2<!  DOCTYPE fontconfig System "FONTS.DTD" > 3 <!--/etc/fonts/fonts.conf file to configure system font access-->
  4<fontconfig> 5 6 <!--7 Don't EDIT this FILE.
  8 IT would be replaced when Fontconfig is UPDATED.
 9 local CHANGES belong in ' local.conf '.  Of the intent of this standard configuration ' is ' to being adequate for most.      If you are have a reasonably normal environment have found problems with this configuration, they are probably 14  Things that others would also want fixed. Please submit a problems to the Fontconfig Bugzilla system located at fontconfig.org  Rmal ' make install ' procedure for fontconfig be to-replace any existing fonts.conf file with the new version.
 Place no local customizations in local.conf which this file references. Keith Packard--> <!--Font directory list--> 26<dir>/usr/share/fonts</dir> 27<dir>/usr/share/x11/fonts/type1</dir><dir>/ usr/share/x11/fonts/ttf</dir><dir>/usr/local/share/fonts</dir> 28<dir prefix= "XDG" >fonts </dir> <!--The following element is removed in the future--> 30<dir>~/.fonts</dir> 31 <!--Accept deprecated ' mono ' alias, replacing it with ' monospace '--> 35<match-target= ' pattern ' > 36<test qual= "Any" name= "family" > 37<string>mono</string> 38</test> 39<edit name= "Family" Mode= "Assign" binding= "Same" > 40<string>monospace</string> 41</edit> 42</match> < !--Accept Alternate ' sans serif ' spelling, replacing it with ' Sans-serif '--> 47<match ' target= ' pattern ' ; 48<test qual= "Any" name= "family" > 49<string>sans serif</string> 50</test> 51<edit "Name=" Family "mode=" assign "binding=" Same "> 52<string>sAns-serif</string> 53</edit> 54</match> <!--Accept deprecated ' sans ' alias, replacing it With ' Sans-serif ',--> 59<match target= "pattern" > 60<test qual= "any" name= "Family" > 61<string> sans</string> 62</test> 63<edit name= "Family" mode= "assign" binding= "Same" > 64<string> Sans-serif</string> 65</edit> 66</match> <!--Load Local System customization file 70--& Gt <!--<include ignore_missing= "yes" >fonts.conf.d</incllude>--> 72<include ignore_missing= " Yes >~/fonts.conf.d</include>--> <!--Font Cache directory list 76&LT;CACHEDIR&GT;/VAR/CACHE/FO ntconfig</cachedir> 77<cachedir prefix= "XDG" >fontconfig</cachedir> <!--the following element   would be removed in the future--> 79<cachedir>~/.fontconfig</cachedir> 81<config> <!--83 These are the default Unicode chars that are Expected to is blank in fonts.  All other blank chars are assumed to is broken and won ' t appear in the resulting charsets (-->) 88<int>0x0020</int> <!----> 89<int>0x00a0</int> <!--no-break Space--> 90 <int>0x00AD</int> <!--SOFT hyphen--> 91<int>0x034f</int> <!--combining grapheme JOI NER--> 92<int>0x0600</int> <!--ARABIC number SIGN--> 93<int>0x0601</int> <!--A Rabic SIGN Sanah--> 94<int>0x0602</int> <!--ARABIC FOOTNOTE MARKER--> 95<int>0x0603</i nt> <!--ARABIC SIGN safha--> 96<int>0x06dd</int> <!--ARABIC end of AYAH--> 97<int&gt ;0x070f</int> <!--SYRIAC abbreviation MARK--> 98<int>0x115f</int> <!--HANGUL Choseong FIL LER--> 99<int>0x1160</int> <!--HANGUL Jungseong Filler-->100<int>0x1680</int> <!--ogham space MARK-->101<int>0x17b4</int> <!--khmer Vowel inherent AQ-->102&lt ;int>0x17b5</int> <!--Khmer Vowel inherent AA-->103<int>0x180e</int> <!--MONGOLIAN VOW EL SEPARATOR-->104<int>0x2000</int> <!--EN QUAD-->105<int>0x2001</int> <!--EM  QUAD-->106<int>0x2002</int> <!--EN space-->107<int>0x2003</int> <!--EM spaces  -->108<int>0x2004</int> <!--three-per-em space-->109<int>0x2005</int> <!-- Four-per-em-->110<int>0x2006</int> <!--six-per-em space-->111<int>0x2007</int > <!--FIGURE space-->112<int>0x2008</int> <!--punctuation spaces-->113<int>0x2009& lt;/int> <!--THIN-->114<int>0x200a</int> <!--HAIR space-->115<int>0x200b&lt ;/int> <!--ZERO WIDTH SPACE-->116<int>0x200c</int> <!--ZERO WIDTH non-joiner-->117<int>0x200d</int> <!- -ZERO WIDTH JOINER-->118<int>0x200e</int> <!--left-to-right MARK-->119<int>0x200f</i nt> <!--right-to-left MARK-->120<int>0x2028</int> <!--line SEPARATOR-->121<int>0x 2029</int> <!--PARAGRAPH SEPARATOR-->122<int>0x202a</int> <!--left-to-right Embedding--  >123<int>0x202B</int> <!--right-to-left embedding-->124<int>0x202c</int> <!-- POP directional formatting-->125<int>0x202d</int> <!--left-to-right OVERRIDE-->126<int>   0x202e</int> <!--right-to-left OVERRIDE-->127<int>0x202f</int> <!--narrow NO-BREAK space -->128<int>0x205f</int> <!--MEDIUM Mathematical space-->129<int>0x2060</int> < !--WORD JOINER-->130<int>0x2061</int> <!--FUNCTION application-->131<int>0x2062</int> <!--invisible times--&  Gt;132<int>0x2063</int> <!--invisible SEPARATOR-->133<int>0x206a</int> <!-- Inhibit symmetric swapping-->134<int>0x206b</int> <!--ACTIVATE symmetric swapping-->135<int >0x206C</int> <!--inhibit ARABIC FORM shaping-->136<int>0x206d</int> <!--ACTIVATE ARAB IC FORM Shaping-->137<int>0x206e</int> <!--national DIGIT SHAPES-->138<int>0x206f</in T> <!--nominal DIGIT SHAPES-->139<int>0x2800</int> <!--Braille pattern BLANK-->140<i nt>0x3000</int> <!--ideographic space-->141<int>0x3164</int> <!--HANGUL filler--> 142<int>0xfeff</int> <!--ZERO WIDTH no-break space-->143<int>0xffa0</int> <!--HALF WIDTH HANGUL Filler-->144<int>0xfff9</int> <!--interlinear ANNOTATION ANCHOR-->145<int>0xfffa</int> <!-- Interlinear ANNOTATION SEPARATOR-->146<int>0xfffb</int> <!--interlinear ANNOTATION Terminator--&G t;147</blank>148 <!--149 rescan configuration every seconds when Fcfontsetlist is called-->151<re Scan>152<int>30</int>153</rescan>154</config>155156</fontconfig>

/etc/fonts/fonts.conf

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.