1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="x-setup">
|
---|
9 | <?dbhtml filename="xfree86-setup.html"?>
|
---|
10 |
|
---|
11 | <sect1info>
|
---|
12 | <othername>$LastChangedBy$</othername>
|
---|
13 | <date>$Date$</date>
|
---|
14 | </sect1info>
|
---|
15 |
|
---|
16 | <title>X Window System Components</title>
|
---|
17 |
|
---|
18 | <sect2 id='dri'>
|
---|
19 | <title>Checking Direct Rendering Infrastructure (DRI) Installation</title>
|
---|
20 |
|
---|
21 | <indexterm zone="x-setup dri">
|
---|
22 | <primary sortas="g-DRI">DRI</primary>
|
---|
23 | </indexterm>
|
---|
24 |
|
---|
25 | <para>DRI is a framework for allowing software to access graphics hardware
|
---|
26 | in a safe and efficient manner. It is installed in
|
---|
27 | <application>X</application> by default if you have a supported video card.
|
---|
28 | To check if DRI is installed properly, check the log file
|
---|
29 | <filename>/var/log/XFree86.0.log</filename> or
|
---|
30 | <filename>/var/log/Xorg.0.log</filename> for statements like:</para>
|
---|
31 |
|
---|
32 | <screen><literal>(II) R128(0): Direct rendering enabled</literal></screen>
|
---|
33 |
|
---|
34 | <para>From an <command>xterm</command>, run <command>glxinfo</command>
|
---|
35 | and look for the phrase:</para>
|
---|
36 |
|
---|
37 | <screen><computeroutput>direct rendering: Yes</computeroutput></screen>
|
---|
38 |
|
---|
39 | <para>You can also run the test program <command>glxgears</command>.
|
---|
40 | This program brings up a window with three gears turning. The
|
---|
41 | <command>xterm</command> will display how many frames were drawn every
|
---|
42 | five seconds, so this is a reasonable benchmark. The window is scalable,
|
---|
43 | and the frames drawn per second is highly dependent on the size of
|
---|
44 | the window.</para>
|
---|
45 |
|
---|
46 | <indexterm zone="x-setup dri">
|
---|
47 | <primary sortas="b-glxgears">glxgears</primary>
|
---|
48 | </indexterm>
|
---|
49 |
|
---|
50 | <indexterm zone="x-setup dri">
|
---|
51 | <primary sortas="b-glxinfo">glxinfo</primary>
|
---|
52 | </indexterm>
|
---|
53 |
|
---|
54 | <para>For troubleshooting problems, check the DRI Users Guide at
|
---|
55 | <ulink url="http://dri.sourceforge.net/doc/DRIuserguide.html"/>.</para>
|
---|
56 |
|
---|
57 | </sect2>
|
---|
58 |
|
---|
59 | <!-- ================================================== -->
|
---|
60 |
|
---|
61 | <sect2 id='fonts'>
|
---|
62 | <title>Setting up Fonts</title>
|
---|
63 |
|
---|
64 | <para>There are two font systems in the
|
---|
65 | <application>X Window System</application>. The first is the
|
---|
66 | core X font protocol, and the second is Xft. Toolkits that use the core
|
---|
67 | X font protocol include Xt, Xaw, Motif clones and GTK+-1.2. Toolkits that
|
---|
68 | use Xft include GTK+-2 and Qt and use <application>Fontconfig</application>
|
---|
69 | for control. Both font systems should be configured for proper font
|
---|
70 | coverage in the <application>X Window System</application>.</para>
|
---|
71 |
|
---|
72 | <indexterm zone="x-setup fonts">
|
---|
73 | <primary sortas="e-etc-X11-xorg-conf">/etc/X11/xorg.conf</primary>
|
---|
74 | </indexterm>
|
---|
75 |
|
---|
76 | <indexterm zone="x-setup fonts">
|
---|
77 | <primary sortas="e-etc-X11-XF86Config">/etc/X11/XF86Config</primary>
|
---|
78 | </indexterm>
|
---|
79 |
|
---|
80 | <sect3>
|
---|
81 | <title>Core X Font Protocol</title>
|
---|
82 |
|
---|
83 | <indexterm zone="x-setup fonts">
|
---|
84 | <primary sortas="g-core-x-font">Core X Font Protocol</primary>
|
---|
85 | </indexterm>
|
---|
86 |
|
---|
87 | <para>The core X font protocol finds fonts from the server configuration
|
---|
88 | file (<filename>xorg.conf</filename> or <filename>XF86Config</filename>).
|
---|
89 | If no font paths exist in the configurations file, the server will fall
|
---|
90 | back to an internal hard-coded path. Assuming the prefix for your
|
---|
91 | <application>X</application> installation is
|
---|
92 | <filename class="directory">/usr/X11R6</filename>, the core fonts will
|
---|
93 | reside in subdirectories of <filename
|
---|
94 | class="directory">/usr/X11R6/lib/X11/fonts</filename>. For each
|
---|
95 | directory in the path, the server reads three files:</para>
|
---|
96 |
|
---|
97 | <itemizedlist>
|
---|
98 | <listitem>
|
---|
99 | <para><filename>fonts.dir</filename> - maps font files to font
|
---|
100 | names; updated with <command>mkfontdir</command></para>
|
---|
101 | </listitem>
|
---|
102 | <listitem>
|
---|
103 | <para><filename>fonts.alias</filename> - defines aliases (such as
|
---|
104 | "9x18") for existing fonts</para>
|
---|
105 | </listitem>
|
---|
106 | <listitem>
|
---|
107 | <para><filename>fonts.scale</filename> - lists scalable fonts;
|
---|
108 | updated with <command>mkfontscale</command></para>
|
---|
109 | </listitem>
|
---|
110 | </itemizedlist>
|
---|
111 |
|
---|
112 | <para>The core X fonts protocol uses names such as
|
---|
113 | <systemitem>-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1</systemitem>.
|
---|
114 | These fonts are rendered by the <application>X</application> server
|
---|
115 | without antialiasing. The server itself uses the "cursor" font for
|
---|
116 | painting the mouse cursor, and the protocol specification requires the
|
---|
117 | font "fixed" to be available.</para>
|
---|
118 |
|
---|
119 | <para>Scalable fonts, such as Type1 and TrueType, are read from
|
---|
120 | <filename>fonts.scale</filename> files by the server. The core X font
|
---|
121 | system uses the "freetype" module for non-antialiased rendering of these
|
---|
122 | fonts. Ensure that the "freetype" module is loaded in the
|
---|
123 | <filename>XF86config</filename> or <filename>xorg.conf</filename>
|
---|
124 | file by adding it to the "Module" section:</para>
|
---|
125 |
|
---|
126 | <screen><literal>Section "Module"
|
---|
127 | ...
|
---|
128 | Load "freetype"
|
---|
129 | ...
|
---|
130 | EndSection</literal></screen>
|
---|
131 |
|
---|
132 | <para>The character set used is part of the font name, e.g. "-iso8859-1".
|
---|
133 | It is important that applications which support a non-English interface
|
---|
134 | specify the character set correctly so that the proper glyphs are used.
|
---|
135 | This can be controlled through the <application>X</application>
|
---|
136 | resources, which will be described later.</para>
|
---|
137 |
|
---|
138 | <para>In some cases, applications rely upon the fonts named "fixed" or
|
---|
139 | something like "9x18". In these cases, it is important that the
|
---|
140 | <filename>fonts.alias</filename> file specifies the correct character
|
---|
141 | set. Users of ISO-8859-<replaceable>X</replaceable> encodings where
|
---|
142 | <replaceable>X</replaceable> != 1 should modify the
|
---|
143 | <filename>/usr/lib/X11/fonts/misc/fonts.alias</filename> file by
|
---|
144 | replacing the "iso8859-1" string with the proper encoding name. This is
|
---|
145 | accomplished by running the following command as the <systemitem
|
---|
146 | class="username">root</systemitem> user, substituting the proper value
|
---|
147 | for <replaceable>[X]</replaceable>:</para>
|
---|
148 |
|
---|
149 | <screen role="root"><userinput>sed -i 's,iso8859-1\( \|$\),iso8859-<replaceable>[X]</replaceable>\1,g' \
|
---|
150 | /usr/lib/X11/fonts/{75dpi,100dpi,misc}/fonts.alias</userinput></screen>
|
---|
151 |
|
---|
152 | <para>Users of Cyrillic fonts have properly defined aliases in
|
---|
153 | <filename>/usr/lib/X11/fonts/cyrillic/fonts.alias</filename>. However,
|
---|
154 | this file will not be used unless the <filename
|
---|
155 | class="directory">/usr/lib/X11/fonts/cyrillic</filename> directory is
|
---|
156 | first in the font search path. Otherwise, the
|
---|
157 | <filename>/usr/lib/X11/fonts/misc/fonts.alias</filename> file will be
|
---|
158 | used.</para>
|
---|
159 |
|
---|
160 | </sect3>
|
---|
161 |
|
---|
162 | <sect3>
|
---|
163 | <title>Xft Font Protocol</title>
|
---|
164 |
|
---|
165 | <indexterm zone="x-setup fonts">
|
---|
166 | <primary sortas="g-truetype">TrueType Fonts</primary>
|
---|
167 | </indexterm>
|
---|
168 |
|
---|
169 | <para>Xft provides antialiased font rendering through
|
---|
170 | <application>Freetype</application>, and fonts are controlled from the
|
---|
171 | client side using <application>Fontconfig</application>. The default
|
---|
172 | search path is <filename class="directory">/usr/share/fonts</filename>
|
---|
173 | and <filename class="directory">~/.fonts</filename>.
|
---|
174 | When installing <application>X</application>, symlinks were created from
|
---|
175 | the <filename class="directory">OTF</filename> and <filename
|
---|
176 | class="directory">TTF</filename> <application>X</application> font
|
---|
177 | directories to <filename
|
---|
178 | class="directory">/usr/share/fonts/X11-{OTF,TTF}</filename>. This
|
---|
179 | prevents <application>Fontconfig</application> from using the poorly
|
---|
180 | rendered Type1 fonts or the non-scalable bitmapped fonts.</para>
|
---|
181 |
|
---|
182 | <para><application>Fontconfig</application> searches directories in its
|
---|
183 | path recursively and maintains a cache of the font characteristics in
|
---|
184 | <filename>fonts.cache-1</filename> files in each directory. If the cache
|
---|
185 | appears to be out of date, it is ignored, and information is (slowly)
|
---|
186 | fetched from the fonts themselves. This cache
|
---|
187 | can be regenerated using the <command>fc-cache</command> command at any
|
---|
188 | time.</para>
|
---|
189 |
|
---|
190 | <para><application>Fontconfig</application> uses names such as
|
---|
191 | "Monospace 12" to define fonts. Applications generally use generic font
|
---|
192 | names such as "Monospace", "Sans" and "Serif".
|
---|
193 | <application>Fontconfig</application> resolves these names to a font that
|
---|
194 | has all characters that cover the orthography of the language indicated
|
---|
195 | by the locale settings. Knowledge of these font names is included in
|
---|
196 | <filename>/etc/fonts/fonts.conf</filename>.</para>
|
---|
197 |
|
---|
198 | <para>Standard scalable fonts that come with <application>X</application>
|
---|
199 | provide very poor Unicode coverage. You may notice in applications that
|
---|
200 | use <application>Xft</application> that some characters appear as a box
|
---|
201 | with four binary digits inside. In this case, a font set with the
|
---|
202 | available glyphs has not been found. Other times, applications that
|
---|
203 | don't use other font families by default and don't accept substitutions
|
---|
204 | from <application>Fontconfig</application> will display blank lines when
|
---|
205 | the default font doesn't cover the orthography of the user's language.
|
---|
206 | This happens, e.g., with <application>Fluxbox</application> in the
|
---|
207 | ru_RU.KOI8-R locale.</para>
|
---|
208 |
|
---|
209 | <para>In order to provide greater Unicode coverage, it is recommended
|
---|
210 | that you install these fonts:</para>
|
---|
211 |
|
---|
212 | <itemizedlist>
|
---|
213 | <listitem>
|
---|
214 | <para><ulink url="http://dejavu.sourceforge.net/">DejaVu fonts</ulink>
|
---|
215 | - These fonts are replacements for the Bitstream Vera fonts and
|
---|
216 | provide Latin-based scripts with accents and Cyrillic glyphs.
|
---|
217 | <application>Fontconfig</application> does not know about the DejaVu
|
---|
218 | fonts by default, so <filename>/etc/fonts/fonts.conf</filename> will
|
---|
219 | have to be edited for it to be recognized by the generic names such
|
---|
220 | as "Sans". This will be described below.</para>
|
---|
221 | </listitem>
|
---|
222 | <listitem>
|
---|
223 | <para><ulink
|
---|
224 | url="http://download.savannah.nongnu.org/releases/freefont/">FreeFont</ulink>
|
---|
225 | - This set of fonts covers nearly every non-CJK character, but is not
|
---|
226 | visually pleasing. <application>Fontconfig</application> will use it
|
---|
227 | as a last resort to substitute generic font family names.</para>
|
---|
228 | </listitem>
|
---|
229 | <listitem>
|
---|
230 | <para><ulink
|
---|
231 | url="http://corefonts.sourceforge.net/">Microsoft Core fonts</ulink>
|
---|
232 | - These fonts provide slightly worse Unicode coverage than FreeFont,
|
---|
233 | but are better hinted. Be sure to read the license before using
|
---|
234 | them. <application>Fontconfig</application> knows about them by
|
---|
235 | default.</para>
|
---|
236 | </listitem>
|
---|
237 | <listitem>
|
---|
238 | <para><ulink
|
---|
239 | url="http://cle.linux.org.tw/fonts/FireFly">Firefly New Sung font</ulink>
|
---|
240 | - This font provides Chinese coverage. However,
|
---|
241 | <application>Fontconfig</application> does not know about this font
|
---|
242 | by default.</para>
|
---|
243 | </listitem>
|
---|
244 | <listitem>
|
---|
245 | <para><ulink
|
---|
246 | url="http://cle.linux.org.tw/fonts/Arphic">Arphic fonts</ulink> -
|
---|
247 | A similar set of Chinese fonts to the Firefly New Sung font.
|
---|
248 | <application>Fontconfig</application> knows about these fonts by
|
---|
249 | default and will substitute them for generic family names.</para>
|
---|
250 | </listitem>
|
---|
251 | <listitem>
|
---|
252 | <para><ulink
|
---|
253 | url="http://sourceforge.jp/projects/efont/">Kochi fonts</ulink> -
|
---|
254 | These provide Japanese characters, and
|
---|
255 | <application>Fontconfig</application> knows about these fonts by
|
---|
256 | default.</para>
|
---|
257 | </listitem>
|
---|
258 | <listitem>
|
---|
259 | <para><ulink
|
---|
260 | url="http://kldp.net/projects/baekmuk/">Baekmuk fonts</ulink>
|
---|
261 | - These fonts provide Korean coverage, and
|
---|
262 | <application>Fontconfig</application> knows about these fonts by
|
---|
263 | default.</para>
|
---|
264 | </listitem>
|
---|
265 | </itemizedlist>
|
---|
266 |
|
---|
267 | <para>The list above will not provide complete Unicode coverage. For
|
---|
268 | more information, please visit the <ulink
|
---|
269 | url="http://unifont.org/fontguide/">Unicode Font Guide</ulink>.</para>
|
---|
270 |
|
---|
271 | <para>As an example, consider the installation of the DejaVu fonts. From
|
---|
272 | the unpacked source directory, run the following commands as the
|
---|
273 | <systemitem class="username">root</systemitem> user:</para>
|
---|
274 |
|
---|
275 | <screen role="root"><userinput>install -v -d -m755 /usr/share/fonts/dejavu &&
|
---|
276 | install -v -m644 *.ttf /usr/share/fonts/dejavu &&
|
---|
277 | fc-cache -v /usr/share/fonts/dejavu</userinput></screen>
|
---|
278 |
|
---|
279 | <para>Earlier it was mentioned that <filename>/etc/fonts/fonts.conf</filename>
|
---|
280 | could be modified to use DejaVu using the default family names. Since
|
---|
281 | DejaVu is a replacement for Bitstream Vera fonts, we can substitute it
|
---|
282 | for that family. Visually inspect the <filename>fonts.conf</filename> to
|
---|
283 | see how fonts are grouped together under the generic family names and a
|
---|
284 | preference list is created. To replace Bitstream Vera with DejaVu, as the
|
---|
285 | <systemitem class="username">root</systemitem> user:</para>
|
---|
286 |
|
---|
287 | <screen role="root"><userinput>sed -i 's/<family>Bitstream Vera/<family>DejaVu/' /etc/fonts/fonts.conf</userinput></screen>
|
---|
288 |
|
---|
289 | <!--
|
---|
290 | <screen><userinput><command>sed -i -e '/^<\/fontconfig>/i\
|
---|
291 | <dir>/usr/X11R6/lib/X11/fonts/TTF</dir>\
|
---|
292 | <dir>/usr/X11R6/lib/X11/fonts/Type1</dir>' /etc/fonts/local.conf</command></userinput></screen>
|
---|
293 | -->
|
---|
294 |
|
---|
295 | <para condition="html" role="usernotes">User Notes:
|
---|
296 | <ulink url='&blfs-wiki;/XWindowSystemComponents'/></para>
|
---|
297 |
|
---|
298 | </sect3>
|
---|
299 |
|
---|
300 | </sect2>
|
---|
301 |
|
---|
302 | <!-- ================================================== -->
|
---|
303 |
|
---|
304 | <sect2>
|
---|
305 | <title>Setting up Keyboards</title>
|
---|
306 |
|
---|
307 | <para>In this version of <application>X</application>, non-Latin
|
---|
308 | keyboard layouts do not include Latin configurations as was previous
|
---|
309 | practice. To set up a keyboard for Latin and non-Latin input, change
|
---|
310 | the XkbLayout keyboard driver option in the InputDevice section
|
---|
311 | of the <filename>XF86Config</filename> or <filename>xorg.conf</filename>
|
---|
312 | file. For example:</para>
|
---|
313 |
|
---|
314 | <screen><literal>Section "InputDevice"
|
---|
315 | Identifier "Keyboard0"
|
---|
316 | Driver "Keyboard"
|
---|
317 | Option "XkbModel" "pc105"
|
---|
318 | Option "XkbLayout" "en_US,ru"
|
---|
319 | Option "XkbOptions" "grp:switch,grp:alt_shift_toggle,grp_led:scroll"
|
---|
320 | EndSection</literal></screen>
|
---|
321 |
|
---|
322 | <para>In this example, you can use the <keycap>Alt+Shift</keycap>
|
---|
323 | combination to switch between keyboard layouts and use the Scroll Lock
|
---|
324 | LED to indicate when the second layout is active.</para>
|
---|
325 |
|
---|
326 | </sect2>
|
---|
327 |
|
---|
328 | <!-- ================================================== -->
|
---|
329 |
|
---|
330 | <sect2 id='xdm'>
|
---|
331 | <title>Setting up XDM</title>
|
---|
332 |
|
---|
333 | <para><command>xdm</command> provides a graphical logon capability and
|
---|
334 | is normally set up in <filename>/etc/inittab</filename>. Most of the
|
---|
335 | information you need to customize <command>xdm</command> is found in
|
---|
336 | its man page. To execute <command>xdm</command> during bootup, change
|
---|
337 | the initdefault level to 5 and add the following lines to
|
---|
338 | <filename>/etc/inittab</filename>:</para>
|
---|
339 |
|
---|
340 | <indexterm zone="x-setup xdm">
|
---|
341 | <primary sortas="b-xdm">xdm</primary>
|
---|
342 | </indexterm>
|
---|
343 |
|
---|
344 | <screen><literal># Run xdm as a separate service
|
---|
345 | x:5:respawn:/usr/X11R6/bin/xdm -nodaemon</literal></screen>
|
---|
346 |
|
---|
347 | <para>If <application>Linux-PAM</application> is installed on your
|
---|
348 | system, you should create a PAM entry for <command>xdm</command> by
|
---|
349 | duplicating the <command>login</command> entry using the following
|
---|
350 | command:</para>
|
---|
351 |
|
---|
352 | <indexterm zone="x-setup xdm">
|
---|
353 | <primary sortas="e-etc-pam.d/xdm">/etc/pam.d/xdm</primary>
|
---|
354 | </indexterm>
|
---|
355 |
|
---|
356 | <screen role="root"><userinput>cp /etc/pam.d/login /etc/pam.d/xdm</userinput></screen>
|
---|
357 |
|
---|
358 | </sect2>
|
---|
359 |
|
---|
360 | <!-- ================================================== -->
|
---|
361 |
|
---|
362 | <sect2 id='x-resources'>
|
---|
363 | <title>Using X Resources</title>
|
---|
364 |
|
---|
365 | <para>There are many options that can be set in
|
---|
366 | <application>X</application> and <application>X</application>
|
---|
367 | clients via resources. Typically resources are set in the
|
---|
368 | <filename>~/.Xresources</filename> file.</para>
|
---|
369 |
|
---|
370 | <para>The layout of the <filename>~/.Xresources</filename> file
|
---|
371 | consists of a list of specifications in the form of</para>
|
---|
372 |
|
---|
373 | <indexterm zone="x-setup x-resources">
|
---|
374 | <primary sortas="e-AA.xresources">~/.Xresources</primary>
|
---|
375 | </indexterm>
|
---|
376 |
|
---|
377 | <screen><literal>object.subobject[.subobject...].attribute: value</literal></screen>
|
---|
378 |
|
---|
379 | <para>Components of a resource specification are linked together by
|
---|
380 | either <emphasis>tight</emphasis>, represented by a dot (.), or
|
---|
381 | <emphasis>loose</emphasis>, represented by an asterisk (*), bindings.
|
---|
382 | A tight binding indicates that the components on either side of the
|
---|
383 | dot must be directly next to each other as defined in a specific
|
---|
384 | implementation. An asterisk is a wildcard character that means that
|
---|
385 | any number of levels in a defined hierarchy can be between the components.
|
---|
386 | For example, X offers two special cursors: redglass and whiteglass. To
|
---|
387 | use one of these resources, you need to add the following line:</para>
|
---|
388 |
|
---|
389 | <screen><literal>Xcursor.theme: whiteglass</literal></screen>
|
---|
390 |
|
---|
391 | <para>However, you can specify the background for all clients with:</para>
|
---|
392 |
|
---|
393 | <screen><literal>*background: blue</literal></screen>
|
---|
394 |
|
---|
395 | <para>More specific resource variables will override less specific
|
---|
396 | names.</para>
|
---|
397 |
|
---|
398 | <para>Resource definitions can be found in the man pages for each
|
---|
399 | respective client.</para>
|
---|
400 |
|
---|
401 | <para>In order to load your resources, the <command>xrdb</command>
|
---|
402 | program must be called with the appropriate parameters. Typically,
|
---|
403 | the first time resources are loaded, you use:</para>
|
---|
404 |
|
---|
405 | <screen><userinput>xrdb -load <filename></userinput></screen>
|
---|
406 |
|
---|
407 | <para>To add resources to <application>X</application>'s database
|
---|
408 | in memory, use:</para>
|
---|
409 |
|
---|
410 | <screen><userinput>xrdb -merge <filename></userinput></screen>
|
---|
411 |
|
---|
412 | <para>The <command>xrdb</command> instruction is usually placed in
|
---|
413 | <filename>~/.xinitrc</filename> or <filename>~/.xsession</filename>.
|
---|
414 | To get more information, see the <command>xrdb</command> man page.</para>
|
---|
415 |
|
---|
416 | <indexterm zone="x-setup x-resources">
|
---|
417 | <primary sortas="b-xrdb">xrdb</primary>
|
---|
418 | </indexterm>
|
---|
419 |
|
---|
420 | </sect2>
|
---|
421 |
|
---|
422 | </sect1>
|
---|