source: x/installing/tuning-fontconfig.xml@ d825fe23

10.1 11.0 11.1 11.2 11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since d825fe23 was 71df408, checked in by Pierre Labastie <pieere@…>, 4 years ago

Format the x/installing chapter

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@22865 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 30.2 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="tuning-fontconfig">
9 <?dbhtml filename="tuning-fontconfig.html"?>
10
11 <sect1info>
12 <othername>$LastChangedBy$</othername>
13 <date>$Date$</date>
14 </sect1info>
15
16 <title>Tuning Fontconfig</title>
17
18 <indexterm zone="tuning-fontconfig">
19 <primary sortas="g-tuning-fontconfig">Tuning Fontconfig</primary>
20 </indexterm>
21
22 <sect2 id='fontconfig-overview' xreflabel="Overview of Fontconfig">
23 <title>Overview of Fontconfig</title>
24
25<!-- do not add individual indexterm entries for items within this page, they
26 all belong in section G (others) and not only do they add noise in longindex,
27 the links all point to the top of the page. -->
28
29 <para>
30 If you only read text in English, and are happy with the common libre
31 fonts listed on the next page, you may never need to worry about the
32 details of how <application>fontconfig</application> works. But there are
33 many things which can be altered if they do not suit your needs.
34 </para>
35
36 <para>
37 Although this page is long, it barely scratches the surface and you will
38 be able to find many alternative views on the web (but please remember
39 that some things have changed over the years, for example the autohinter
40 is no longer the default). The aim here is to give you enough information
41 to understand the changes you are making.
42 </para>
43
44 <!-- use the existing wiki page for fontconfig -->
45 <para condition="html" role="usernotes">User Notes:
46 <ulink url='&blfs-wiki;/Fontconfig'/>
47 </para>
48 </sect2>
49
50 <sect2 role="configuration" id="xft-font-protocol" xreflabel="The Xft Font Protocol">
51 <title>The Xft Font Protocol</title>
52
53 <para>
54 The Xft font protocol provides antialiased font rendering through
55 <application>freetype</application>, and fonts are controlled from the
56 client side using <application>fontconfig</application> (except for
57 <xref linkend="rxvt-unicode"/> which can use fonts listed in
58 <filename>~/.Xresources</filename>, and <xref linkend="abiword"/> which
59 only uses the specified font). The default search path is <filename
60 class="directory">/usr/share/fonts</filename> and <filename
61 class="directory">~/.local/share/fonts</filename> although for the moment
62 the old and deprecated location <filename
63 class="directory">~/.fonts</filename> still works.
64 <application>Fontconfig</application> searches directories in its path
65 recursively and maintains a cache of the font characteristics in each
66 directory. If the cache appears to be out of date, it is ignored, and
67 information is fetched from the fonts themselves (that can take a few
68 seconds if you installed a lot of fonts).
69 </para>
70
71 <para>
72 If you've installed <application>Xorg</application> in any prefix
73 other than <filename class="directory">/usr</filename>, any
74 <application>X</application> fonts were not installed in a
75 location known to <application>Fontconfig</application>. Symlinks were
76 <!-- fonts-misc-ethiopic installs an OTF directory ! -->
77 created from the <filename class="directory">OTF</filename> and <filename
78 class="directory">TTF</filename> <application>X</application> font
79 directories to <filename
80 class="directory">/usr/share/fonts/X11-{OTF,TTF}</filename>. This allows
81 <application>Fontconfig</application> to use the OpenType and TrueType
82 fonts provided by <application>X</application>, although many people will
83 prefer to use more modern fonts.
84 </para>
85
86 <para>
87 <application>Fontconfig</application> uses names to define fonts.
88 Applications generally use generic font names such as "Monospace", "Sans"
89 and "Serif". <application>Fontconfig</application> resolves these names
90 to a font that has all characters that cover the orthography of the
91 language indicated by the locale settings.
92 </para>
93
94 </sect2>
95
96 <sect2 role="configuration" id="useful-commands" xreflabel="Useful Commands">
97 <title>Useful Commands</title>
98
99 <para>
100 The following commands may be helpful when working with fontconfig:
101 </para>
102
103 <para>
104 <command>fc-list | less</command> : show a list of all available fonts
105 (/path/to/filename: Font Name:style). If you installed a font more than
106 30 seconds ago but it does not show, then it or one of its directories is
107 not readable by your user.
108 </para>
109
110 <para>
111 <command>fc-match 'Font Name'</command> : will tell you which font will
112 be used if the named font is requested. Typically you would use this to
113 see what happens if a font you have not installed is requested, but you
114 can also use it if the system is giving you a different font from
115 what you expected (perhaps because <application>fontconfig</application>
116 does not agree that the font supports your language).
117 </para>
118
119 <para>
120 <command>fc-match -a 'Type' | less</command> : will provide a list of all
121 fonts which can be used for that type (Monospace, Sans, Serif). Note that
122 in-extremis <application>fontconfig</application> will take a glyph from
123 any available font, even if it is not of the specified type, and unless it
124 knows about the font's type it will assume it is Sans.
125 </para>
126
127 <para>
128 If you wish to know which font will be used for a string of text
129 (i.e. one or more glyphs, preceded by a space), paste the following
130 command and replace the <literal>xyz</literal> by the text you care
131 about:
132 </para>
133
134 <para>
135 <command>FC_DEBUG=4 pango-view --font=monospace -t xyz | grep
136 family</command> : this requires <xref linkend="pango"/> and <xref
137 linkend="imagemagick"/> - it will invoke <xref linkend="display"/>
138 to show the text in a tiny window, and after closing that the last
139 line of the output will show which font was chosen. This is
140 particularly useful for CJK languages, and you can also pass a
141 language, e.g. PANGO_LANGUAGE=en;ja (English, then assume Japanese)
142 or just zh-cn (or other variants - 'zh' on its own is not valid).
143 </para>
144
145 </sect2>
146
147 <sect2 role="configuration" id="the-various-files" xreflabel="The various files">
148 <title>The various files</title>
149
150 <para>
151 The main files are in <filename class="directory">/etc/fonts/conf.d/</filename>,
152 which was intended to be a directory populated by symlinks to some of the files
153 in <filename class="directory">/usr/share/fontconfig/conf.avail/</filename>.
154 But many people, and some packages, create the files directly. Each file name
155 must be in the form of two digits, a dash, somename.conf and they are read in
156 sequence.
157 </para>
158
159 <para>
160 By convention, the numbers are assigned as follows:
161 </para>
162
163 <itemizedlist>
164 <listitem>
165 <para>
166 00-09 extra font directories
167 </para>
168 </listitem>
169 <listitem>
170 <para>
171 10-19 system rendering defaults (antialising etc)
172 </para>
173 </listitem>
174 <listitem>
175 <para>
176 20-29 font rendering options
177 </para>
178 </listitem>
179 <listitem>
180 <para>
181 30-39 family substitution
182 </para>
183 </listitem>
184 <listitem>
185 <para>
186 40-49 map family to generic type
187 </para>
188 </listitem>
189 <listitem>
190 <para>
191 50-59 load alternate config files
192 </para>
193 </listitem>
194 <listitem>
195 <para>
196 60-69 generic aliases, map generic to family
197 </para>
198 </listitem>
199 <listitem>
200 <para>
201 70-79 adjust which fonts are available
202 </para>
203 </listitem>
204 <listitem>
205 <para>
206 80-89 match target scan (modify scanned patterns)
207 </para>
208 </listitem>
209 <listitem>
210 <para>
211 90-99 font synthesis
212 </para>
213 </listitem>
214 </itemizedlist>
215
216 <para>
217 You can also have a personal <filename>fonts.conf</filename> in
218 $XDG_CONFIG_HOME which is <filename
219 class="directory">~/.config/fontconfig/</filename>.
220 </para>
221
222 </sect2>
223
224 <sect2 role="configuration" id="rules-to-choose-a-font" xreflabel="The rules to choose a font">
225 <title>The rules to choose a font</title>
226
227 <para>
228 If the requested font is installed, and provided it contains the
229 codepoints <emphasis>required</emphasis> for the current language (in the
230 source, see the .orth files in the <filename
231 class="directory">fc-lang/</filename> directory), it will be used.
232 </para>
233
234 <para>
235 But if the document or page requested a font which is not installed
236 (or, occasionally, does not contain all the required codepoints) the
237 following rules come into play: First,
238 <filename>30-metric-aliases.conf</filename> is used to map aliases for
239 some fonts with the same metrics (same size, etc). After that, an
240 unknown font will be searched for in <filename>45-latin.conf</filename> -
241 if it is found it will be mapped as Serif or Monospace or Sans, otherwise
242 it will be assumed to be Sans. Then <filename>50-latin.conf</filename>
243 provides ordered lists of the fallbacks - <xref linkend="dejavu-fonts"/>
244 will be used if you installed them. Cyrillic and Greek appear to be
245 treated in the same way. There are similar files with a 65- prefix for
246 Persian and other non-latin writing systems. All of these files prefer
247 commercial fonts if they are present, although modern libre fonts are
248 often at least their equals.
249 </para>
250
251 <para>
252 Since fontconfig-2.12.5 there is also generic family matching for some
253 emoji and math fonts, see {45,60}-generic.conf.
254 </para>
255
256 <para>
257 In the rare cases where a font does not contain all the expected
258 codepoints, see 'Trial the First:' at <xref
259 linkend="I-stared-into-the-fontconfig"/> for the long details.
260 </para>
261
262 </sect2>
263
264 <sect2 role="configuration" id="hinting-and-antialising" xreflabel="Hinting and Anti-aliasing">
265 <title>Hinting and Anti-aliasing</title>
266
267 <para>
268 It is possible to change how, or if, fonts are hinted. The following
269 example file contains the default settings, but with comments. The
270 settings are very much down to the user's preferences and to the choice
271 of fonts, so a change which improves some pages may worsen others. The
272 preferred location for this file is:
273 <filename>~/.config/fontconfig/fonts.conf</filename>
274 </para>
275
276 <para>
277 To try out different settings, you may need to exit from Xorg and then
278 rerun <command>startx</command> so that all applications use the new
279 settings. And if you use Gnome or KDE their desktops can override these
280 changes. To explore the possibilities, create a file for your user:
281 </para>
282
283<screen><userinput>mkdir -pv ~/.config/fontconfig &amp;&amp;
284cat > ~/.config/fontconfig/fonts.conf &lt;&lt; "EOF"
285<literal>&lt;?xml version='1.0'?&gt;
286&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
287&lt;fontconfig&gt;
288
289 &lt;match target="font" &gt;
290 &lt;!-- autohint was the old automatic hinter when hinting was patent
291 protected, so turn it off to ensure any hinting information in the font
292 itself is used, this is the default --&gt;
293 &lt;edit mode="assign" name="autohint"&gt; &lt;bool&gt;false&lt;/bool&gt;&lt;/edit&gt;
294
295 &lt;!-- hinting is enabled by default --&gt;
296 &lt;edit mode="assign" name="hinting"&gt; &lt;bool&gt;true&lt;/bool&gt;&lt;/edit&gt;
297
298 &lt;!-- for the lcdfilter see http://www.spasche.net/files/lcdfiltering/ --&gt;
299 &lt;edit mode="assign" name="lcdfilter"&gt; &lt;const&gt;lcddefault&lt;/const&gt;&lt;/edit&gt;
300
301 &lt;!-- options for hintstyle:
302 hintfull: is supposed to give a crisp font that aligns well to the
303 character-cell grid but at the cost of its proper shape.
304
305 hintmedium: poorly documented, maybe a synonym for hintfull.
306 hintslight is the default: - supposed to be more fuzzy but retains shape.
307
308 hintnone: seems to turn hinting off.
309 The variations are marginal and results vary with different fonts --&gt;
310 &lt;edit mode="assign" name="hintstyle"&gt; &lt;const&gt;hintslight&lt;/const&gt;&lt;/edit&gt;
311
312 &lt;!-- antialiasing is on by default and really helps for faint characters
313 and also for 'xft:' fonts used in rxvt-unicode --&gt;
314 &lt;edit mode="assign" name="antialias"&gt; &lt;bool&gt;true&lt;/bool&gt;&lt;/edit&gt;
315
316 &lt;!-- subpixels are usually rgb, see
317 http://www.lagom.nl/lcd-test/subpixel.php --&gt;
318 &lt;edit mode="assign" name="rgba"&gt; &lt;const&gt;rgb&lt;/const&gt;&lt;/edit&gt;
319
320 &lt;!-- thanks to the Arch wiki for the lcd and subpixel links --&gt;
321 &lt;/match&gt;
322
323&lt;/fontconfig&gt;</literal>
324EOF</userinput></screen>
325
326 <para>
327 You will now need to edit the file in your preferred editor.
328 </para>
329
330 <para>
331 For more examples see the blfs-support thread which started at <ulink
332 url="http://lists.linuxfromscratch.org/pipermail/blfs-support/2016-September/078422.html">/2016-September/078422</ulink>,
333 particularly <ulink
334 url="http://lists.linuxfromscratch.org/pipermail/blfs-support/2016-September/078425.html">2016-September/078425</ulink>,
335 and the original poster's preferred solution at <ulink
336 url="http://lists.linuxfromscratch.org/pipermail/blfs-support/2016-November/078658.html">2016-November/078658</ulink>.
337 There are other examples in <xref linkend="arch-fontconfig"/> and <xref
338 linkend="gentoo-fontconfig"/>.
339 </para>
340
341 </sect2>
342
343 <sect2 role="configuration" id="disabling-bitmap-fonts" xreflabel="Disabling Bitmap fonts">
344 <title>Disabling Bitmap Fonts</title>
345
346 <para>
347 In previous versions of BLFS, the ugly old Xorg bitmap fonts were
348 installed. Now, many people will not need to install any of them. But if
349 for some reason you have installed one or more bitmap fonts, you can
350 prevent them being used by <application>fontconfig</application> by
351 creating the following file as the
352 <systemitem class="username">root</systemitem> user :
353 </para>
354
355<screen role="root"><userinput>cat > /etc/fonts/conf.d/70-no-bitmaps.conf &lt;&lt; "EOF"
356<literal>&lt;?xml version='1.0'?&gt;
357&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
358&lt;fontconfig&gt;
359&lt;!-- Reject bitmap fonts --&gt;
360 &lt;selectfont&gt;
361 &lt;rejectfont&gt;
362 &lt;pattern&gt;
363 &lt;patelt name="scalable"&gt;&lt;bool&gt;false&lt;/bool&gt;&lt;/patelt&gt;
364 &lt;/pattern&gt;
365 &lt;/rejectfont&gt;
366 &lt;/selectfont&gt;
367&lt;/fontconfig&gt;</literal>
368EOF</userinput></screen>
369
370 </sect2>
371
372 <sect2 role="configuration" id="adding-extra-directories" xreflabel="Adding extra font directories">
373 <title>Adding extra font directories</title>
374
375 <para>
376 Normally, system fonts and user fonts are installed in directories beneath
377 the locations specified in <xref linkend="xft-font-protocol"/> and there
378 is no obvious reason to put them elsewhere. However, a full BLFS install
379 of <xref linkend="texlive"/> puts many fonts in <filename
380 class="directory">/opt/texlive/&texlive-year;/texmf-dist/fonts/</filename>
381 in the <filename class="directory">opentype/</filename> and <filename
382 class="directory">truetype/</filename> subdirectories. Although pulling in
383 all of these files may appear useful (it allows you to use them in non
384 <application>TeX</application> programs), there are several problems with
385 such an approach:
386 </para>
387
388 <orderedlist>
389 <listitem>
390 <para>
391 There are hundreds of files, which makes selecting the font hard.
392 </para>
393 </listitem>
394 <listitem>
395 <para>
396 Some of the files do odd things, such as displaying semaphore flags
397 instead of ASCII letters, or mapping cyrillic codepoints to character
398 forms appropriate to Old Church Slavonic instead of the expected
399 current shapes: fine if that is what you need, but painful for normal
400 use.
401 </para>
402 </listitem>
403 <listitem>
404 <para>
405 Several fonts have multiple sizes and impenetrable short names, which
406 both make selecting the correct font even harder.
407 </para>
408 </listitem>
409 <listitem>
410 <para>
411 When a font is added to CTAN, it is accompanied by TeX packages to use
412 it in the old engines (<application>xelatex</application> does not
413 normally need this), and then the version is often frozen whilst the
414 font is separately maintained. Some of these fonts such as <xref
415 linkend="dejavu-fonts"/> are probably already installed on your BLFS
416 system in a newer version, and if you have multiple versions of a font
417 it is unclear which one will be used by
418 <application>fontconfig</application>.
419 </para>
420 </listitem>
421 </orderedlist>
422
423 <para>
424 However, it is sometimes useful to look at these fonts in non-TeX
425 applications, if only to see whether you wish to install a current
426 version. If you have installed all of <application>texlive</application>,
427 the following example will make one of the Arkandis Open Type fonts
428 available to other applications, and all three of the ParaType TrueType
429 fonts. Adjust or repeat the lines as desired, to either make all the
430 <filename class="directory">opentype/</filename> or <filename
431 class="directory">truetype</filename>fonts available, or to select
432 different font directories. As the <systemitem
433 class="username">root</systemitem> user:
434 </para>
435
436<screen role="root"><userinput>cat > /etc/fonts/conf.d/09-texlive.conf &lt;&lt; "EOF"
437<literal>&lt;?xml version='1.0'?&gt;
438&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
439&lt;fontconfig&gt;
440 &lt;dir&gt;/opt/texlive/&texlive-year;/texmf-dist/fonts/opentype/arkandis/berenisadf&lt;/dir&gt;
441 &lt;dir&gt;/opt/texlive/&texlive-year;/texmf-dist/fonts/truetype/paratype&lt;/dir&gt;
442&lt;/fontconfig&gt;</literal>
443EOF</userinput></screen>
444
445 <para>
446 If you do this, remember to change all instances of the year in that file
447 when you upgrade <application>texlive</application> to a later release.
448 </para>
449
450 </sect2>
451
452
453 <sect2 role="configuration" id="preferring-certain-fonts" xreflabel="Preferring certain fonts">
454 <title>Preferring certain fonts</title>
455
456 <para>
457 There are many reasons why people may wish to have pages which specify a
458 particular font use a different font, or prefer specific fonts in
459 Monospace or Sans or Serif. As you will expect, there a number of
460 different ways of achieving this.
461 </para>
462
463 <bridgehead renderas="sect3" id="fontconfig-user-docs"
464 xreflabel="fontconfig-user-docs">Fontconfig user docs</bridgehead>
465
466 <para>
467 <application>Fontconfig</application> installs user documentation that
468 includes an example 'User configuration file' which among other things
469 prefers <xref linkend="wenquanyi-zenhei"/> (a Sans font) if a
470 <emphasis>Serif</emphasis> font is requested for Chinese (this part
471 might be anachronistic unless you have non-free Chinese fonts, because
472 in <filename>65-nonlatin.conf</filename> this font is already among the
473 preferred fonts when Serif is specified for Chinese) and to prefer the
474 modern <xref linkend="VLGothic"/> font if a Sans font is specified on a
475 Japanese page (otherwise a couple of other fonts would be preferred if
476 they have been installed).
477 </para>
478
479 <para>
480 If you have installed the current version, the user documentation is
481 available in html, PDF and text versions at <filename
482 class="directory">/usr/share/doc/fontconfig-&fontconfig-version;/</filename>
483 : change the version if you installed a different one.
484 </para>
485
486 <bridgehead renderas="sect3" id="prefer-a-specific-font"
487 xreflabel="fontconfig-prefer-specific-font">Prefer a specific font</bridgehead>
488
489 <para>
490 As an example, if for some reason you wished to use the <ulink
491 url="https://www.fontsquirrel.com/fonts/nimbus-roman-no9-l">Nimbus Roman
492 No9 L</ulink> font wherever Times New Roman is referenced (it is
493 metrically similar, and preferred for Times Roman, but the Serif font
494 from <xref linkend="liberation-fonts"/> will be preferred for the Times
495 <emphasis>New</emphasis> Roman font if installed), as an individual user
496 you could install the font and then create the following file:
497 </para>
498
499<screen><userinput>mkdir -pv ~/.config/fontconfig/conf.d &amp;&amp;
500cat > ~/.config/fontconfig/conf.d/35-prefer-nimbus-for-timesnew.conf &lt;&lt; "EOF"
501<literal>&lt;?xml version='1.0'?&gt;
502&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
503&lt;fontconfig&gt;
504&lt;!-- prefer Nimbus Roman No9 L for Times New Roman as well as for Times,
505 without this Tinos and Liberation Serif take precedence for Times New Roman
506 before fontconfig falls back to whatever matches Times --&gt;
507 &lt;alias binding="same"&gt;
508 &lt;family&gt;Times New Roman&lt;/family&gt;
509 &lt;accept&gt;
510 &lt;family&gt;Nimbus Roman No9 L&lt;/family&gt;
511 &lt;/accept&gt;
512 &lt;/alias&gt;
513&lt;/fontconfig&gt;</literal>
514EOF</userinput></screen>
515
516 <para>
517 This is something you would normally do in an individual user's
518 settings, but the file in this case has been prefixed '35-' so that it
519 could, if desired, be used system-wide in <filename
520 class="directory">/etc/fonts/conf.d/</filename>.
521 </para>
522
523 <bridgehead renderas="sect3" id="prefer-chosen-CJK-fonts"
524 xreflabel="Prefer chosen CJK fonts">Prefer chosen CJK fonts</bridgehead>
525
526 <para>
527 The following example of a local configuration (i.e. one that applies
528 for all users of the machine) does several things:
529 </para>
530
531 <orderedlist>
532 <listitem>
533 <para>
534 If a Serif font is specified, it will prefer the <xref
535 linkend="UMing"/> variants, so that in the zh-cn, zh-hk and zh-tw
536 languages things should look good (also zh-sg which actually uses
537 the same settings as zh-cn) <emphasis>without</emphasis> affecting
538 Japanese.
539 </para>
540 </listitem>
541 <listitem>
542 <para>
543 It prefers the Japanese <xref linkend="IPAex"/> if they have been
544 installed (although <xref linkend="VLGothic"/> will take precedence
545 for (Japanese) Sans if it has also been installed.
546 </para>
547 </listitem>
548 <listitem>
549 <para>
550 Because <xref linkend="wenquanyi-zenhei"/> covers Korean Hangul
551 glyphs and is also preferred for Serif in
552 <filename>65-nonlatin.conf</filename>, if installed it will be used
553 by default for Korean Serif. To get a proper Serif font, the
554 UnBatang font is specified here - change that line if you installed
555 a different Serif font from the choice of <xref
556 linkend="Korean-fonts"/>.
557 </para>
558 </listitem>
559 <listitem>
560 <para>
561 The Monospace fonts are forced to the preferred Sans fonts. If the
562 text is in Korean then <xref linkend="wenquanyi-zenhei"/> will be
563 used.
564 </para>
565 </listitem>
566 </orderedlist>
567
568 <para>
569 In a non-CJK locale, the result is that suitable fonts will be used for
570 all variants of Chinese, Japanese and Hangul Korean. All other languages
571 should already work if a font is present. As the <systemitem
572 class="username">root</systemitem> user:
573 </para>
574
575<screen role="root"><userinput>cat > /etc/fonts/local.conf &lt;&lt; "EOF"
576<literal>&lt;?xml version='1.0'?&gt;
577&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
578&lt;fontconfig&gt;
579 &lt;alias&gt;
580 &lt;family&gt;serif&lt;/family&gt;
581 &lt;prefer&gt;
582 &lt;family&gt;AR PL UMing&lt;/family&gt;
583 &lt;family&gt;IPAexMincho&lt;/family&gt;
584 &lt;!-- WenQuanYi is preferred as Serif in 65-nonlatin.conf,
585 override that so a real Korean font can be used for Serif --&gt;
586 &lt;family&gt;UnBatang&lt;/family&gt;
587 &lt;/prefer&gt;
588 &lt;/alias&gt;
589 &lt;alias&gt;
590 &lt;family&gt;sans-serif&lt;/family&gt;
591 &lt;prefer&gt;
592 &lt;family&gt;WenQuanYi Zen Hei&lt;/family&gt;
593 &lt;family&gt;VL Gothic&lt;/family&gt;
594 &lt;family&gt;IPAexGothic&lt;/family&gt;
595 &lt;/prefer&gt;
596 &lt;/alias&gt;
597 &lt;alias&gt;
598 &lt;family&gt;monospace&lt;/family&gt;
599 &lt;prefer&gt;
600 &lt;family&gt;VL Gothic&lt;/family&gt;
601 &lt;family&gt;IPAexGothic&lt;/family&gt;
602 &lt;family&gt;WenQuanYi Zen Hei&lt;/family&gt;
603 &lt;/prefer&gt;
604 &lt;/alias&gt;
605&lt;/fontconfig&gt;</literal>
606EOF</userinput></screen>
607
608 </sect2>
609
610
611 <sect2 role="configuration" id="editing-old-style-conf-files"
612 xreflabel="Editing Old-Style conf files">
613 <title>Editing Old-style conf files</title>
614
615 <para>
616 Some fonts, particularly Chinese fonts, ship with conf files which can be
617 installed in <filename class="directory">/etc/fonts/conf.d</filename>.
618 However, if you do that and then use a terminal to run any command which
619 uses <application>fontconfig</application> you may see error messages such
620 as :
621 </para>
622
623 <para>
624 <literal>Fontconfig warning: "/etc/fonts/conf.d/69-odofonts.conf", line
625 14: Having multiple &lt;family&gt; in &lt;alias&gt; isn't supported and
626 may not work as expected</literal>.
627 </para>
628
629 <para>
630 In practice, these old rules do not work. For non-CJK users,
631 <application>fontconfig</application> will usually do a good job
632 <emphasis>without</emphasis> these rules. Their origin dates back to when
633 CJK users needed handcrafted bitmaps to be legible at small sizes, and
634 those looked ugly next to antialiased Latin glyphs - they preferred to
635 use the same CJK font for the Latin glyphs. There is a side-effect of
636 doing this : the (Serif) font is often also used for Sans, and in such a
637 situation the (English) text in <application>Gtk</application> menus will
638 use this font - compared to system fonts, as well as being serif it is
639 both faint and rather small. That can make it uncomfortable to read.
640 </para>
641
642 <para>
643 Nevertheless, these old conf files can be fixed if you wish to use them.
644 The following example is the first part of
645 <filename>64-arphic-uming.conf</filename> from <xref linkend="UMing"/> -
646 there are a lot more similar items which also need changing :
647 </para>
648
649 <para>
650 <literallayout>
651 &lt;match target="pattern"&gt;
652 &lt;test qual="any" name="lang" compare="contains"&gt;
653 &lt;string&gt;zh-cn&lt;/string&gt;
654 &lt;string&gt;zh-sg&lt;/string&gt;
655 &lt;/test&gt;
656 &lt;test qual="any" name="family"&gt;
657 &lt;string&gt;serif&lt;/string&gt;
658 &lt;/test&gt;
659 &lt;edit name="family" mode="prepend" binding="strong"&gt;
660 &lt;string&gt;AR PL UMing CN&lt;/string&gt;
661 &lt;/edit&gt;
662 &lt;/match&gt;</literallayout>
663 </para>
664
665 <para>
666 The process to correct this is straightforward but tedious - for every
667 item which produces an error message, using your editor (as the
668 <systemitem class="username">root</systemitem> user) edit the installed
669 file to repeat the whole block as many times as there are multiple
670 variables, then reduce each example to have only one of them. You may
671 wish to work on one error at a time, save the file after each fix, and
672 from a separate term run a command such as <command>fc-list 2>&amp;1 |
673 less</command> to see that the fix worked. For the block above, the fixed
674 version will be :
675 </para>
676
677 <para>
678 <literallayout>
679 &lt;match target="pattern"&gt;
680 &lt;test qual="any" name="lang" compare="contains"&gt;
681 &lt;string&gt;zh-cn&lt;/string&gt;
682 &lt;/test&gt;
683 &lt;test qual="any" name="family"&gt;
684 &lt;string&gt;serif&lt;/string&gt;
685 &lt;/test&gt;
686 &lt;edit name="family" mode="prepend" binding="strong"&gt;
687 &lt;string&gt;AR PL UMing CN&lt;/string&gt;
688 &lt;/edit&gt;
689 &lt;/match&gt;
690 &lt;match target="pattern"&gt;
691 &lt;test qual="any" name="lang" compare="contains"&gt;
692 &lt;string&gt;zh-sg&lt;/string&gt;
693 &lt;/test&gt;
694 &lt;test qual="any" name="family"&gt;
695 &lt;string&gt;serif&lt;/string&gt;
696 &lt;/test&gt;
697 &lt;edit name="family" mode="prepend" binding="strong"&gt;
698 &lt;string&gt;AR PL UMing CN&lt;/string&gt;
699 &lt;/edit&gt;
700 &lt;/match&gt;</literallayout>
701 </para>
702
703 </sect2>
704
705
706 <sect2 role="configuration" id="see-also" xreflabel="See Also">
707 <title>See Also</title>
708
709 <bridgehead renderas="sect3" id="I-stared-into-the-fontconfig"
710 xreflabel="I stared into the fontconfig">I stared into the fontconfig ...</bridgehead>
711
712 <para>
713 The blog entries by <ulink
714 url="https://eev.ee/blog/2015/05/20/i-stared-into-the-fontconfig-and-the-fontconfig-stared-back-at-me/">Eevee</ulink>
715 are particularly useful if <application>fontconfig</application> does not
716 think your chosen font supports your language, and for preferring some
717 non-MS Japanese fonts when an ugly MS font is already installed.
718 </para>
719
720 <bridgehead renderas="sect3" id="arch-fontconfig"
721 xreflabel="Fontconfig in the Arch wiki">Fontconfig in the Arch wiki</bridgehead>
722
723 <para>
724 Arch has a lot of information in its wiki at <ulink
725 url="https://wiki.archlinux.org/index.php/font_configuration">font_configuration</ulink>.
726 </para>
727
728 <bridgehead renderas="sect3" id="gentoo-fontconfig"
729 xreflabel="Fontconfig in the Gentoo wiki">Fontconfig in the Gentoo wiki</bridgehead>
730
731 <para>
732 Gentoo has some information in its wiki at <ulink
733 url="https://wiki.gentoo.org/wiki/Fontconfig">Fontconfig</ulink> although
734 a lot of the details (what to enable, and Infinality) are specific to
735 Gentoo.
736 </para>
737
738 </sect2>
739
740</sect1>
Note: See TracBrowser for help on using the repository browser.