source: x/installing/tuning-fontconfig.xml@ 6bc10a26

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 8.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 6bc10a26 was 6bc10a26, checked in by DJ Lucas <dj@…>, 7 years ago

Fix minor typos in tuning-fontconfig page.

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

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