source: x/installing/tuning-fontconfig.xml@ 88902ba7

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 9.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 88902ba7 was bee7026, checked in by Ken Moffat <ken@…>, 6 years ago

Typo, and reword to change period to comma. Reported by Ed Batalha.

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

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