首页 > 代码库 > Linux字体配置

Linux字体配置

    字体配置文件,系统的在/etc/font/fonts.conf 也可以使用/etc/font/conf.d/52-fonts.conf

  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 <!-- Font directory list -->
  7 
  8     <dir>/usr/share/fonts</dir>
  9     <dir>/usr/local/share/fonts</dir>
 10     <dir prefix="xdg">fonts</dir>
 11 
 12 <!-- Font cache directory list -->
 13     <cachedir>/var/cache/fontconfig</cachedir>
 14     <cachedir prefix="xdg">fontconfig</cachedir>
 15 
 16 <!-- Rescan configuration every 30 seconds when FcFontSetList is called -->
 17     <config>
 18         <rescan>
 19             <int>300</int>
 20         </rescan>
 21     </config>
 22 
 23 <!-- Accept deprecated ‘sans‘ alias, replacing it with ‘sans-serif‘ -->
 24     <match target="pattern">
 25         <test qual="any" name="family">
 26             <string>sans</string>
 27         </test>
 28         <edit name="family" mode="assign" binding="same">
 29             <string>sans-serif</string>
 30         </edit>
 31     </match>
 32 
 33 <!-- Accept deprecated ‘mono‘ alias, replacing it with ‘monospace‘ -->
 34     <match target="pattern">
 35         <test qual="any" name="family">
 36             <string>mono</string>
 37         </test>
 38         <edit name="family" mode="assign" binding="same">
 39             <string>monospace</string>
 40         </edit>
 41     </match>
 42 
 43 <!-- Accept alternate ‘sans serif‘ spelling, replacing it with ‘sans-serif‘ -->
 44     <match target="pattern">
 45         <test qual="any" name="family">
 46             <string>sans serif</string>
 47         </test>
 48         <edit name="family" mode="assign" binding="same">
 49             <string>sans-serif</string>
 50         </edit>
 51     </match>
 52 
 53 <!-- DPI and hinting -->
 54     <match target="pattern">
 55         <edit name="dpi" mode="assign">
 56             <double>96</double>
 57         </edit>
 58     </match>
 59     
 60     <match target="font">
 61         <edit name="hinting" mode="assign">
 62             <bool>true</bool>
 63         </edit>
 64     </match>
 65     
 66     <match target="font">
 67         <edit name="autohint" mode="assign">
 68             <bool>false</bool>
 69         </edit>
 70     </match>
 71     
 72     <match target="font">
 73         <edit name="hintstyle" mode="assign">
 74             <const>hintmedium</const>
 75         </edit>
 76     </match>
 77   
 78     <match target="font">
 79         <edit name="antialias" mode="assign">
 80             <bool>true</bool>
 81         </edit>
 82     </match>
 83   
 84     <match target="font">
 85         <edit name="rgba" mode="assign">
 86             <const>rgb</const>
 87         </edit>
 88     </match>
 89   
 90     <match target="font">
 91         <edit name="lcdfilter" mode="assign">
 92             <const>lcdlight</const>
 93         </edit>
 94     </match>
 95   
 96     <edit name="embeddedbitmap">
 97         <bool>false</bool>
 98     </edit>
 99     
100     <edit name="embolden">
101         <bool>false</bool>
102     </edit>
103     
104 <!-- Synthetic fonts -->    
105     <match target="font">
106         <test name="slant" compare="eq"><const>roman</const></test>
107         <test name="slant" compare="not_eq" target="pattern"><const>roman</const></test>
108         <edit name="slant"><const>oblique</const></edit>
109         <edit name="matrix">
110             <times>
111                 <name>matrix</name>
112                 <matrix>
113                     <double>1</double><double>0.2</double>
114                     <double>0</double><double>1</double>
115                 </matrix>
116             </times>
117         </edit>
118     </match>
119 
120     <match target="font">
121         <test name="weight" compare="less"><int>105</int></test>
122         <test name="weight" compare="more" target="pattern"><int>105</int></test>
123         <edit name="weight"><const>bold</const></edit>
124         <edit name="embolden"><bool>true</bool></edit>
125     </match>
126 
127 <!-- Classify English fonts -->
128 <!--
129   Serif faces
130  -->
131     <alias>
132         <family>Bitstream Vera Serif</family>
133         <accept><family>serif</family></accept>
134     </alias>
135     <alias>
136         <family>DejaVu Serif</family>
137         <accept><family>serif</family></accept>
138     </alias>
139     <alias>
140         <family>Liberation Serif</family>
141         <accept><family>serif</family></accept>
142     </alias>
143     <alias>
144         <family>Times New Roman</family>
145         <accept><family>serif</family></accept>
146     </alias>
147     <alias>
148         <family>Times</family>
149         <accept><family>serif</family></accept>
150     </alias>
151     <alias>
152         <family>Nimbus Roman No9 L</family>
153         <accept><family>serif</family></accept>
154     </alias>
155     <alias>
156         <family>Luxi Serif</family>
157         <accept><family>serif</family></accept>
158     </alias>
159     <alias>
160         <family>Thorndale AMT</family>
161         <accept><family>serif</family></accept>
162     </alias>
163     <alias>
164         <family>Thorndale</family>
165         <accept><family>serif</family></accept>
166     </alias>
167     <alias>
168         <family>Georgia</family>
169         <accept><family>serif</family></accept>
170     </alias>
171     <alias>
172         <family>Garamond</family>
173         <accept><family>serif</family></accept>
174     </alias>
175     <alias>
176         <family>Palatino Linotype</family>
177         <accept><family>serif</family></accept>
178     </alias>
179     <alias>
180         <family>Trebuchet MS</family>
181         <accept><family>serif</family></accept>
182     </alias>
183 <!--
184   Sans-serif faces
185  -->
186     <alias>
187         <family>Bitstream Vera Sans</family>
188         <accept><family>sans-serif</family></accept>
189     </alias>
190     <alias>
191         <family>DejaVu Sans</family>
192         <accept><family>sans-serif</family></accept>
193     </alias>
194     <alias>
195         <family>Liberation Sans</family>
196         <accept><family>sans-serif</family></accept>
197     </alias>
198     <alias>
199         <family>Arial</family>
200         <accept><family>sans-serif</family></accept>
201     </alias>
202     <alias>
203         <family>Helvetica</family>
204         <accept><family>sans-serif</family></accept>
205     </alias>
206     <alias>
207         <family>Verdana</family>
208         <accept><family>sans-serif</family></accept>
209     </alias>
210     <alias>
211         <family>Albany AMT</family>
212         <accept><family>sans-serif</family></accept>
213     </alias>
214     <alias>
215         <family>Albany</family>
216         <accept><family>sans-serif</family></accept>
217     </alias>
218     <alias>
219         <family>Nimbus Sans L</family>
220         <accept><family>sans-serif</family></accept>
221     </alias>
222     <alias>
223         <family>Luxi Sans</family>
224         <accept><family>sans-serif</family></accept>
225     </alias>
226     <alias>
227         <family>Tahoma</family>
228         <accept><family>sans-serif</family></accept>
229     </alias>
230 <!--
231   Monospace faces
232  -->
233      <alias>
234         <family>Bitstream Vera Sans Mono</family>
235         <accept><family>monospace</family></accept>
236     </alias>
237     <alias>
238         <family>DejaVu Sans Mono</family>
239         <accept><family>monospace</family></accept>
240     </alias>
241     <alias>
242         <family>Liberation Mono</family>
243         <accept><family>monospace</family></accept>
244     </alias>
245     <alias>
246         <family>Inconsolata</family>
247         <accept><family>monospace</family></accept>
248     </alias>
249     <alias>
250         <family>Courier New</family>
251         <accept><family>monospace</family></accept>
252     </alias>
253     <alias>
254         <family>Courier</family>
255         <accept><family>monospace</family></accept>
256     </alias>
257     <alias>
258         <family>Andale Mono</family>
259         <accept><family>monospace</family></accept>
260     </alias>
261     <alias>
262         <family>Luxi Mono</family>
263         <accept><family>monospace</family></accept>
264     </alias>
265     <alias>
266         <family>Cumberland AMT</family>
267         <accept><family>monospace</family></accept>
268     </alias>
269     <alias>
270         <family>Cumberland</family>
271         <accept><family>monospace</family></accept>
272     </alias>
273     <alias>
274         <family>Nimbus Mono L</family>
275         <accept><family>monospace</family></accept>
276     </alias>
277 <!--
278   Fantasy faces
279  -->
280      <alias>
281         <family>Impact</family>
282         <accept><family>fantasy</family></accept>
283     </alias>
284     <alias>
285         <family>Copperplate Gothic Std</family>
286         <accept><family>fantasy</family></accept>
287     </alias>
288     <alias>
289         <family>Cooper Std</family>
290         <accept><family>fantasy</family></accept>
291     </alias>
292     <alias>
293         <family>Bauhaus Std</family>
294         <accept><family>fantasy</family></accept>
295     </alias>
296 <!--
297   Cursive faces
298   -->
299     <alias>
300         <family>ITC Zapf Chancery Std</family>
301         <accept><family>cursive</family></accept>
302     </alias>
303     <alias>
304         <family>Zapfino</family>
305         <accept><family>cursive</family></accept>
306     </alias>
307     <alias>
308         <family>Comic Sans MS</family>
309         <accept><family>cursive</family></accept>
310     </alias>
311 
312 <!-- Unclassified as sans serif -->
313     <match target="pattern">
314         <test qual="all" name="family" compare="not_eq">
315             <string>sans-serif</string>
316         </test>
317         <test qual="all" name="family" compare="not_eq">
318             <string>serif</string>
319         </test>
320         <test qual="all" name="family" compare="not_eq">
321             <string>monospace</string>
322         </test>
323         <test qual="all" name="family" compare="not_eq">
324             <string>宋体</string>
325         </test><test qual="all" name="family" compare="not_eq">
326             <string>黑体</string>
327         </test>
328         <edit name="family" mode="append_last">
329             <string>sans-serif</string>
330         </edit>
331     </match>
332 
333 <!-- Prefer fonts --> 
334     <alias binding="strong">
335         <family>serif</family>
336         <prefer>
337             <family>Noto Sans Regular</family>
338             <family>Times New Roman</family>
339             <family>宋体</family>
340         </prefer>
341     </alias>
342     <alias binding="strong">
343         <family>sans-serif</family>
344         <prefer>
345             <family>Arial</family>
346             <family>Verdana</family>
347             <family>Bitstream Vera Sans</family>
348             <family>DejaVu Sans</family>
349             <family>Albany AMT</family>
350             <family>Luxi Sans</family>
351             <family>Nimbus Sans L</family>
352             <family>Helvetica</family>
353             <family>Lucida Sans Unicode</family>
354             <family>BPG Glaho International</family> 
355             <family>Tahoma</family> 
356             <family>微软雅黑</family>
357         </prefer>
358     </alias>
359     <alias binding="strong">
360         <family>monospace</family>
361         <prefer>
362             <family>DejaVu Sans Mono</family>
363             <family>Courier New</family>
364             <family>Bitstream Vera Sans Mono</family>
365             <family>Inconsolata</family>
366             <family>Andale Mono</family>
367             <family>Cumberland AMT</family>
368             <family>Luxi Mono</family>
369             <family>Nimbus Mono L</family>
370             <family>Courier</family>
371             <family>微软雅黑</family>
372         </prefer>
373     </alias>
374     <alias binding="strong">
375         <family>宋体</family>
376         <prefer>
377             <family>AR PL UMing CN</family>
378             <family>AR PL UMing HK</family>
379             <family>AR PL UMing TW</family>
380             <family>AR PL UMing TW MBE</family>
381         </prefer>
382     </alias>
383     <alias binding="strong">
384         <family>黑体</family>
385         <prefer>
386             <family>微软雅黑</family>
387         </prefer>
388     </alias>
389 <!--
390   Fantasy faces
391  -->
392      <alias>
393         <family>fantasy</family>
394         <prefer>
395             <family>Impact</family>
396             <family>Copperplate Gothic Std</family>
397             <family>Cooper Std</family>
398             <family>Bauhaus Std</family>
399         </prefer>
400     </alias>
401 <!--
402   Cursive faces
403   -->
404     <alias>
405         <family>cursive</family>
406         <prefer>
407             <family>Comic Sans MS</family>
408             <family>ITC Zapf Chancery Std</family>
409             <family>Zapfino</family>
410         </prefer>
411     </alias>
412 
413 <!-- Chinese bitmap -->
414     <match target="pattern">
415         <test name="family" compare="contains">
416             <string>AR PL UMing</string>
417         </test>
418         <edit name="family" mode="prepend" binding="strong">
419             <string>WenQuanYi Bitmap Song</string>
420         </edit>
421     </match>
422     <match target="pattern">
423         <test name="family">
424             <string>文泉驿正黑</string>
425         </test>
426         <edit name="family" mode="prepend" binding="strong">
427             <string>文泉驿点阵正黑</string>
428         </edit>
429     </match>
430     <match target="pattern">
431         <test name="family">
432             <string>文泉驿等宽正黑</string>
433         </test>
434         <edit name="family" mode="prepend">
435             <string>文泉驿点阵正黑</string>
436         </edit>
437     </match>
438   <match target="font">
439     <test name="family"> 
440       <string>文泉驿点阵正黑</string>
441     </test>
442     <test compare="less_eq" name="pixelsize">
443       <double>16</double>
444     </test>
445     <test compare="more_eq" name="pixelsize">
446       <double>12</double>
447     </test>
448     <edit name="antialias">
449         <bool>false</bool>
450     </edit>
451   </match>
452 
453 </fontconfig>

 

Linux字体配置