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

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt perl-modules 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 c068b99 was c068b99, checked in by Ken Moffat <ken@…>, 7 years ago

Tuning Fontconfig - from fontconfig-2.12.5 some emoji and math fonts are recognized.

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

  • Property mode set to 100644
File size: 29.9 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 That 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>00-09 extra font directories</para>
166 </listitem>
167 <listitem>
168 <para>10-19 system rendering defaults (antialising etc)</para>
169 </listitem>
170 <listitem>
171 <para>20-29 font rendering options</para>
172 </listitem>
173 <listitem>
174 <para>30-39 family substitution</para>
175 </listitem>
176 <listitem>
177 <para>40-49 map family to generic type</para>
178 </listitem>
179 <listitem>
180 <para>50-59 load alternate config files</para>
181 </listitem>
182 <listitem>
183 <para>60-69 generic aliases, map generic to family</para>
184 </listitem>
185 <listitem>
186 <para>70-79 adjust which fonts are available</para>
187 </listitem>
188 <listitem>
189 <para>80-89 match target scan (modify scanned patterns)</para>
190 </listitem>
191 <listitem>
192 <para>90-99 font synthesis</para>
193 </listitem>
194 </itemizedlist>
195
196 <para>
197 You can also have a personal <filename>fonts.conf</filename> in
198 $XDG_CONFIG_HOME which is <filename
199 class="directory">~/.config/fontconfig/</filename>.
200 </para>
201
202 </sect2>
203
204 <sect2 role="configuration" id="rules-to-choose-a-font" xreflabel="The rules to choose a font">
205 <title>The rules to choose a font</title>
206
207 <para>
208 If the requested font is installed, and provided it contains the
209 codepoints <emphasis>required</emphasis> for the current language (in the
210 source, see the .orth files in the <filename
211 class="directory">fc-lang/</filename> directory), it will be used.
212 </para>
213
214 <para>
215 But if the document or page requested a font which is not installed
216 (or, occasionally, does not contain all the required codepoints) the
217 following rules come into play: First,
218 <filename>30-metric-aliases.conf</filename> is used to map aliases for
219 some fonts with the same metrics (same size, etc). After that, an
220 unknown font will be searched for in <filename>45-latin.conf</filename> -
221 if it is found it will be mapped as Serif or Monospace or Sans, otherwise
222 it will be assumed to be Sans. Then <filename>50-latin.conf</filename>
223 provides ordered lists of the fallbacks - <xref linkend="dejavu-fonts"/>
224 will be used if you installed them. Cyrillic and Greek appear to be
225 treated in the same way. There are similar files with a 65- prefix for
226 Persian and other non-latin writing systems. All of these files prefer
227 commercial fonts if they are present, although modern libre fonts are
228 often at least their equals.
229 </para>
230
231 <para>
232 Since fontconfig-2.12.5 there is also generic family matching for some
233 emoji and math fonts, see {45,60}-generic.conf.
234 </para>
235
236 <para>
237 In the rare cases where a font does not contain all the expected
238 codepoints, see 'Trial the First:' at <xref
239 linkend="I-stared-into-the-fontconfig"/> for the long details.
240 </para>
241
242 </sect2>
243
244 <sect2 role="configuration" id="hinting-and-antialising" xreflabel="Hinting and Anti-aliasing">
245 <title>Hinting and Anti-aliasing</title>
246
247 <para>
248 It is possible to change how, or if, fonts are hinted. The following
249 example file contains the default settings, but with comments. The
250 settings are very much down to the user's preferences and to the choice
251 of fonts, so a change which improves some pages may worsen others. The
252 preferred location for this file is:
253 <filename>~/.config/fontconfig/fonts.conf</filename>
254 </para>
255
256 <para>
257 To try out different settings, you may need to exit from Xorg and then
258 rerun <command>startx</command> so that all applications use the new
259 settings. And if you use Gnome or KDE their desktops can override these
260 changes. To explore the possibilities, create a file for your user:
261 </para>
262
263<screen><userinput>mkdir -pv ~/.config/fontconfig &amp;&amp;
264cat > ~/.config/fontconfig/fonts.conf &lt;&lt; "EOF"
265<literal>&lt;?xml version='1.0'?&gt;
266&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
267&lt;fontconfig&gt;
268
269 &lt;match target="font" &gt;
270 &lt;!-- autohint was the old automatic hinter when hinting was patent
271 protected, so turn it off to ensure any hinting information in the font
272 itself is used, this is the default --&gt;
273 &lt;edit mode="assign" name="autohint"&gt; &lt;bool&gt;false&lt;/bool&gt;&lt;/edit&gt;
274 &lt;!-- hinting is enabled by default --&gt;
275 &lt;edit mode="assign" name="hinting"&gt; &lt;bool&gt;true&lt;/bool&gt;&lt;/edit&gt;
276 &lt;!-- for the lcdfilter see http://www.spasche.net/files/lcdfiltering/ --&gt;
277 &lt;edit mode="assign" name="lcdfilter"&gt; &lt;const&gt;lcddefault&lt;/const&gt;&lt;/edit&gt;
278 &lt;!-- options for hintstyle:
279 hintfull: is supposed to give a crisp font that aligns well to the
280 character-cell grid but at the cost of its proper shape.
281 hintmedium: poorly documented, maybe a synonym for hintfull.
282 hintslight is the default: - supposed to be more fuzzy but retains shape.
283 hintnone: seems to turn hinting off.
284 The variations are marginal and results vary with different fonts --&gt;
285 &lt;edit mode="assign" name="hintstyle"&gt; &lt;const&gt;hintslight&lt;/const&gt;&lt;/edit&gt;
286 &lt;!-- antialiasing is on by default and really helps for faint characters
287 and also for 'xft:' fonts used in rxvt-unicode --&gt;
288 &lt;edit mode="assign" name="antialias"&gt; &lt;bool&gt;true&lt;/bool&gt;&lt;/edit&gt;
289 &lt;!-- subpixels are usually rgb, see
290 http://www.lagom.nl/lcd-test/subpixel.php --&gt;
291 &lt;edit mode="assign" name="rgba"&gt; &lt;const&gt;rgb&lt;/const&gt;&lt;/edit&gt;
292 &lt;!-- thanks to the Arch wiki for the lcd and subpixel links --&gt;
293 &lt;/match&gt;
294
295&lt;/fontconfig&gt;</literal>
296EOF</userinput></screen>
297
298 <para>
299 You will now need to edit the file in your preferred editor.
300 </para>
301
302 <para>
303 For more examples see the blfs-support thread which started at <ulink
304 url="http://lists.linuxfromscratch.org/pipermail/blfs-support/2016-September/078422.html">/2016-September/078422</ulink>,
305 particularly <ulink
306 url="http://lists.linuxfromscratch.org/pipermail/blfs-support/2016-September/078425.html">2016-September/078425</ulink>,
307 and the original poster's preferred solution at <ulink
308 url="http://lists.linuxfromscratch.org/pipermail/blfs-support/2016-November/078658.html">2016-November/078658</ulink>.
309 There are other examples in <xref linkend="arch-fontconfig"/> and <xref
310 linkend="gentoo-fontconfig"/>.
311 </para>
312
313 </sect2>
314
315 <sect2 role="configuration" id="disabling-bitmap-fonts" xreflabel="Disabling Bitmap fonts">
316 <title>Disabling Bitmap Fonts</title>
317
318 <para>
319 In previous versions of BLFS, the ugly old Xorg bitmap fonts were
320 installed. Now, many people will not need to install any of them. But if
321 for some reason you have installed one or more bitmap fonts, you can
322 prevent them being used by <application>fontconfig</application> by
323 creating the following file as the
324 <systemitem class="username">root</systemitem> user :
325 </para>
326
327<screen role="root"><userinput>cat > /etc/fonts/conf.d/70-no-bitmaps.conf &lt;&lt; "EOF"
328<literal>&lt;?xml version='1.0'?&gt;
329&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
330&lt;fontconfig&gt;
331&lt;!-- Reject bitmap fonts --&gt;
332 &lt;selectfont&gt;
333 &lt;rejectfont&gt;
334 &lt;pattern&gt;
335 &lt;patelt name="scalable"&gt;&lt;bool&gt;false&lt;/bool&gt;&lt;/patelt&gt;
336 &lt;/pattern&gt;
337 &lt;/rejectfont&gt;
338 &lt;/selectfont&gt;
339&lt;/fontconfig&gt;</literal>
340EOF</userinput></screen>
341
342 </sect2>
343
344 <sect2 role="configuration" id="adding-extra-directories" xreflabel="Adding extra font directories">
345 <title>Adding extra font directories</title>
346
347 <para>
348 Normally, system fonts and user fonts are installed in directories beneath
349 the locations specified in <xref linkend="xft-font-protocol"/> and there
350 is no obvious reason to put them elsewhere. However, a full BLFS install
351 of <xref linkend="texlive"/> puts many fonts in <filename
352 class="directory">/opt/texlive/&texlive-year;/texmf-dist/fonts/</filename>
353 in the <filename class="directory">opentype/</filename> and <filename
354 class="directory">truetype/</filename> subdirectories. Although pulling in
355 all of these files may appear useful (it allows you to use them in non
356 <application>TeX</application> programs), there are several problems with
357 such an approach:
358 </para>
359
360 <orderedlist>
361 <listitem>
362 <para>
363 There are hundreds of files, which makes selecting the font hard.
364 </para>
365 </listitem>
366 <listitem>
367 <para>
368 Some of the files do odd things, such as displaying semaphore flags
369 instead of ASCII letters, or mapping cyrillic codepoints to character
370 forms appropriate to Old Church Slavonic instead of the expected
371 current shapes: fine if that is what you need, but painful for normal
372 use.
373 </para>
374 </listitem>
375 <listitem>
376 <para>
377 Several fonts have multiple sizes and impenetrable short names, which
378 both make selecting the correct font even harder.
379 </para>
380 </listitem>
381 <listitem>
382 <para>
383 When a font is added to CTAN, it is accompanied by TeX packages to use
384 it in the old engines (<application>xelatex</application> does not
385 normally need this), and then the version is often frozen whilst the
386 font is separately maintained. Some of these fonts such as <xref
387 linkend="dejavu-fonts"/> are probably already installed on your BLFS
388 system in a newer version, and if you have multiple versions of a font
389 it is unclear which one will be used by
390 <application>fontconfig</application>.
391 </para>
392 </listitem>
393 </orderedlist>
394
395 <para>
396 However, it is sometimes useful to look at these fonts in non-TeX
397 applications, if only to see whether you wish to install a current
398 version. If you have installed all of <application>texlive</application>,
399 the following example will make one of the Arkandis Open Type fonts
400 available to other applications, and all three of the ParaType TrueType
401 fonts. Adjust or repeat the lines as desired, to either make all the
402 <filename class="directory">opentype/</filename> or <filename
403 class="directory">truetype</filename>fonts available, or to select
404 different font directories. As the <systemitem
405 class="username">root</systemitem> user:
406 </para>
407
408<screen role="root"><userinput>cat > /etc/fonts/conf.d/09-texlive.conf &lt;&lt; "EOF"
409<literal>&lt;?xml version='1.0'?&gt;
410&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
411&lt;fontconfig&gt;
412 &lt;dir&gt;/opt/texlive/&texlive-year;/texmf-dist/fonts/opentype/arkandis/berenisadf&lt;/dir&gt;
413 &lt;dir&gt;/opt/texlive/&texlive-year;/texmf-dist/fonts/truetype/paratype&lt;/dir&gt;
414&lt;/fontconfig&gt;</literal>
415EOF</userinput></screen>
416
417 <para>
418 If you do this, remember to change all instances of the year in that file
419 when you upgrade <application>texlive</application> to a later release.
420 </para>
421
422 </sect2>
423
424
425 <sect2 role="configuration" id="preferring-certain-fonts" xreflabel="Preferring certain fonts">
426 <title>Preferring certain fonts</title>
427
428 <para>
429 There are many reasons why people may wish to have pages which specify a
430 particular font use a different font, or prefer specific fonts in
431 Monospace or Sans or Serif. As you will expect, there a number of
432 different ways of achieving this.
433 </para>
434
435 <bridgehead renderas="sect3" id="fontconfig-user-docs"
436 xreflabel="fontconfig-user-docs">Fontconfig user docs</bridgehead>
437
438 <para>
439 <application>Fontconfig</application> installs user documentation that
440 includes an example 'User configuration file' which among other things
441 prefers <xref linkend="wenquanyi-zenhei"/> (a Sans font) if a
442 <emphasis>Serif</emphasis> font is requested for Chinese (this part
443 might be anachronistic unless you have non-free Chinese fonts, because
444 in <filename>65-nonlatin.conf</filename> this font is already among the
445 preferred fonts when Serif is specified for Chinese) and to prefer the
446 modern <xref linkend="VLGothic"/> font if a Sans font is specified on a
447 Japanese page (otherwise a couple of other fonts would be preferred if
448 they have been installed).
449 </para>
450
451 <para>
452 If you have installed the current version, the user documentation is
453 available in html, PDF and text versions at <filename
454 class="directory">/usr/share/doc/fontconfig-&fontconfig-version;/</filename>
455 : change the version if you installed a different one.
456 </para>
457
458 <bridgehead renderas="sect3" id="prefer-a-specific-font"
459 xreflabel="fontconfig-prefer-specific-font">Prefer a specific font</bridgehead>
460
461 <para>
462 As an example, if for some reason you wished to use the <ulink
463 url="https://www.fontsquirrel.com/fonts/nimbus-roman-no9-l">Nimbus Roman
464 No9 L</ulink> font wherever Times New Roman is referenced (it is
465 metrically similar, and preferred for Times Roman, but the Serif font
466 from <xref linkend="liberation-fonts"/> will be preferred for the Times
467 <emphasis>New</emphasis> Roman font if installed), as an individual user
468 you could install the font and then create the following file:
469 </para>
470
471<screen><userinput>mkdir -pv ~/.config/fontconfig/conf.d &amp;&amp;
472cat > ~/.config/fontconfig/conf.d/35-prefer-nimbus-for-timesnew.conf &lt;&lt; "EOF"
473<literal>&lt;?xml version='1.0'?&gt;
474&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
475&lt;fontconfig&gt;
476&lt;!-- prefer Nimbus Roman No9 L for Times New Roman as well as for Times,
477 without this Tinos and Liberation Serif take precedence for Times New Roman
478 before fontconfig falls back to whatever matches Times --&gt;
479 &lt;alias binding="same"&gt;
480 &lt;family&gt;Times New Roman&lt;/family&gt;
481 &lt;accept&gt;
482 &lt;family&gt;Nimbus Roman No9 L&lt;/family&gt;
483 &lt;/accept&gt;
484 &lt;/alias&gt;
485&lt;/fontconfig&gt;</literal>
486EOF</userinput></screen>
487
488 <para>
489 This is something you would normally do in an individual user's
490 settings, but the file in this case has been prefixed '35-' so that it
491 could, if desired, be used system-wide in <filename
492 class="directory">/etc/fonts/conf.d/</filename>.
493 </para>
494
495 <bridgehead renderas="sect3" id="prefer-chosen-CJK-fonts"
496 xreflabel="Prefer chosen CJK fonts">Prefer chosen CJK fonts</bridgehead>
497
498 <para>
499 The following example of a local configuration (i.e. one that applies
500 for all users of the machine) does several things:
501 </para>
502
503 <orderedlist>
504 <listitem>
505 <para>
506 If a Serif font is specified, it will prefer the <xref
507 linkend="UMing"/> variants, so that in the zh-cn, zh-hk and zh-tw
508 languages things should look good (also zh-sg which actually uses
509 the same settings as zh-cn) <emphasis>without</emphasis> affecting
510 Japanese.
511 </para>
512 </listitem>
513 <listitem>
514 <para>
515 It prefers the Japanese <xref linkend="IPAex"/> if they have been
516 installed (although <xref linkend="VLGothic"/> will take precedence
517 for (Japanese) Sans if it has also been installed.
518 </para>
519 </listitem>
520 <listitem>
521 <para>
522 Because <xref linkend="wenquanyi-zenhei"/> covers Korean Hangul
523 glyphs and is also preferred for Serif in
524 <filename>65-nonlatin.conf</filename>, if installed it will be used
525 by default for Korean Serif. To get a proper Serif font, the
526 UnBatang font is specified here - change that line if you installed
527 a different Serif font from the choice of <xref
528 linkend="Korean-fonts"/>.
529 </para>
530 </listitem>
531 <listitem>
532 <para>
533 The Monospace fonts are forced to the preferred Sans fonts. If the
534 text is in Korean then <xref linkend="wenquanyi-zenhei"/> will be
535 used.
536 </para>
537 </listitem>
538 </orderedlist>
539
540 <para>
541 In a non-CJK locale, the result is that suitable fonts will be used for
542 all variants of Chinese, Japanese and Hangul Korean. All other languages
543 should already work if a font is present. As the <systemitem
544 class="username">root</systemitem> user:
545 </para>
546
547<screen role="root"><userinput>cat > /etc/fonts/local.conf &lt;&lt; "EOF"
548<literal>&lt;?xml version='1.0'?&gt;
549&lt;!DOCTYPE fontconfig SYSTEM 'fonts.dtd'&gt;
550&lt;fontconfig&gt;
551 &lt;alias&gt;
552 &lt;family&gt;serif&lt;/family&gt;
553 &lt;prefer&gt;
554 &lt;family&gt;AR PL UMing&lt;/family&gt;
555 &lt;family&gt;IPAexMincho&lt;/family&gt;
556 &lt;!-- WenQuanYi is preferred as Serif in 65-nonlatin.conf,
557 override that so a real Korean font can be used for Serif --&gt;
558 &lt;family&gt;UnBatang&lt;/family&gt;
559 &lt;/prefer&gt;
560 &lt;/alias&gt;
561 &lt;alias&gt;
562 &lt;family&gt;sans-serif&lt;/family&gt;
563 &lt;prefer&gt;
564 &lt;family&gt;WenQuanYi Zen Hei&lt;/family&gt;
565 &lt;family&gt;VL Gothic&lt;/family&gt;
566 &lt;family&gt;IPAexGothic&lt;/family&gt;
567 &lt;/prefer&gt;
568 &lt;/alias&gt;
569 &lt;alias&gt;
570 &lt;family&gt;monospace&lt;/family&gt;
571 &lt;prefer&gt;
572 &lt;family&gt;VL Gothic&lt;/family&gt;
573 &lt;family&gt;IPAexGothic&lt;/family&gt;
574 &lt;family&gt;WenQuanYi Zen Hei&lt;/family&gt;
575 &lt;/prefer&gt;
576 &lt;/alias&gt;
577&lt;/fontconfig&gt;</literal>
578EOF</userinput></screen>
579
580 </sect2>
581
582
583 <sect2 role="configuration" id="editing-old-style-conf-files"
584 xreflabel="Editing Old-Style conf files">
585 <title>Editing Old-style conf files</title>
586
587 <para>
588 Some fonts, particularly Chinese fonts, ship with conf files which can be
589 installed in <filename class="directory">/etc/fonts/conf.d</filename>.
590 However, if you do that and then use a terminal to run any command which
591 uses <application>fontconfig</application> you may see error messages such
592 as :
593 </para>
594
595 <para>
596 <literal>Fontconfig warning: "/etc/fonts/conf.d/69-odofonts.conf", line
597 14: Having multiple &lt;family&gt; in &lt;alias&gt; isn't supported and
598 may not work as expected</literal>.
599 </para>
600
601 <para>
602 In practice, these old rules do not work. For non-CJK users,
603 <application>fontconfig</application> will usually do a good job
604 <emphasis>without</emphasis> these rules. Their origin dates back to when
605 CJK users needed handcrafted bitmaps to be legible at small sizes, and
606 those looked ugly next to antialiased Latin glyphs - they preferred to
607 use the same CJK font for the Latin glyphs. There is a side-effect of
608 doing this : the (Serif) font is often also used for Sans, and in such a
609 situation the (English) text in <application>Gtk</application> menus will
610 use this font - compared to system fonts, as well as being serif it is
611 both faint and rather small. That can make it uncomfortable to read.
612 </para>
613
614 <para>
615 Nevertheless, these old conf files can be fixed if you wish to use them.
616 The following example is the first part of
617 <filename>64-arphic-uming.conf</filename> from <xref linkend="UMing"/> -
618 there are a lot more similar items which also need changing :
619 </para>
620
621 <para>
622 <literallayout>
623 &lt;match target="pattern"&gt;
624 &lt;test qual="any" name="lang" compare="contains"&gt;
625 &lt;string&gt;zh-cn&lt;/string&gt;
626 &lt;string&gt;zh-sg&lt;/string&gt;
627 &lt;/test&gt;
628 &lt;test qual="any" name="family"&gt;
629 &lt;string&gt;serif&lt;/string&gt;
630 &lt;/test&gt;
631 &lt;edit name="family" mode="prepend" binding="strong"&gt;
632 &lt;string&gt;AR PL UMing CN&lt;/string&gt;
633 &lt;/edit&gt;
634 &lt;/match&gt;</literallayout>
635 </para>
636
637 <para>
638 The process to correct this is straightforward but tedious - for every
639 item which produces an error message, using your editor (as the
640 <systemitem class="username">root</systemitem> user) edit the installed
641 file to repeat the whole block as many times as there are multiple
642 variables, then reduce each example to have only one of them. You may
643 wish to work on one error at a time, save the file after each fix, and
644 from a separate term run a command such as <command>fc-list 2>&amp;1 |
645 less</command> to see that the fix worked. For the block above, the fixed
646 version will be :
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;/test&gt;
655 &lt;test qual="any" name="family"&gt;
656 &lt;string&gt;serif&lt;/string&gt;
657 &lt;/test&gt;
658 &lt;edit name="family" mode="prepend" binding="strong"&gt;
659 &lt;string&gt;AR PL UMing CN&lt;/string&gt;
660 &lt;/edit&gt;
661 &lt;/match&gt;
662 &lt;match target="pattern"&gt;
663 &lt;test qual="any" name="lang" compare="contains"&gt;
664 &lt;string&gt;zh-sg&lt;/string&gt;
665 &lt;/test&gt;
666 &lt;test qual="any" name="family"&gt;
667 &lt;string&gt;serif&lt;/string&gt;
668 &lt;/test&gt;
669 &lt;edit name="family" mode="prepend" binding="strong"&gt;
670 &lt;string&gt;AR PL UMing CN&lt;/string&gt;
671 &lt;/edit&gt;
672 &lt;/match&gt;</literallayout>
673 </para>
674
675 </sect2>
676
677
678 <sect2 role="configuration" id="see-also" xreflabel="See Also">
679 <title>See Also</title>
680
681 <bridgehead renderas="sect3" id="I-stared-into-the-fontconfig"
682 xreflabel="I stared into the fontconfig">I stared into the fontconfig ...</bridgehead>
683
684 <para>
685 The blog entries by <ulink
686 url="https://eev.ee/blog/2015/05/20/i-stared-into-the-fontconfig-and-the-fontconfig-stared-back-at-me/">Eevee</ulink>
687 are particularly useful if <application>fontconfig</application> does not
688 think your chosen font supports your language, and for preferring some
689 non-MS Japanese fonts when an ugly MS font is already installed.
690 </para>
691
692 <bridgehead renderas="sect3" id="arch-fontconfig"
693 xreflabel="Fontconfig in the Arch wiki">Fontconfig in the Arch wiki</bridgehead>
694
695 <para>
696 Arch has a lot of information in its wiki at <ulink
697 url="https://wiki.archlinux.org/index.php/font_configuration">font_configuration</ulink>.
698 </para>
699
700 <bridgehead renderas="sect3" id="gentoo-fontconfig"
701 xreflabel="Fontconfig in the Gentoo wiki">Fontconfig in the Gentoo wiki</bridgehead>
702
703 <para>
704 Gentoo has some information in its wiki at <ulink
705 url="https://wiki.gentoo.org/wiki/Fontconfig">Fontconfig</ulink> although
706 a lot of the details (what to enable, and Infinality) are specific to
707 Gentoo.
708 </para>
709
710 </sect2>
711
712</sect1>
Note: See TracBrowser for help on using the repository browser.