source: x/installing/tuning-fontconfig.xml@ 805d241

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 xry111/llvm18 xry111/xf86-video-removal
Last change on this file since 805d241 was 3f2db3a6, checked in by Pierre Labastie <pierre.labastie@…>, 18 months ago

Remove sect1info tags

They only contain a date tag that is nowhere used.

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