Bring the anti-aliased font section up to reality with respect to

XFree86 4.3.0 and Gnome 2.

PR:		docs/51770
Submitted by:	Joe Marcus Clarke <marcus@freebsd.org>
This commit is contained in:
Murray Stokely 2003-05-05 03:06:14 +00:00
parent 6a1b90b827
commit 0a35ae7e21
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=16794

View file

@ -691,48 +691,76 @@ EndSection</programlisting>
</sect2> </sect2>
<sect2 id="antialias"> <sect2 id="antialias">
<sect2info>
<authorgroup>
<author>
<firstname>Joe Marcus</firstname>
<surname>Clarke</surname>
<contrib>Updated for XFree86 4.3 by </contrib>
<!-- May 2003 -->
</author>
</authorgroup>
</sect2info>
<title>Anti-Aliased Fonts</title> <title>Anti-Aliased Fonts</title>
<para>Starting with version 4.0.2, <application>XFree86</application> <para>Anti-aliasing has been available in
supports anti-aliased <application>XFree86</application> since 4.0.2. However, font
fonts. Currently, most software has not been updated to take configuration was cumbersome before the introduction of
advantage of this new functionality. However, Qt (the toolkit <application>XFree86</application> 4.3.0. Starting in version 4.3.0,
for the <application>KDE</application> desktop) does; so if all fonts in <filename>/usr/X11R6/lib/X11/fonts/</filename> and
<application>XFree86 4.0.2</application> is used <filename>~/.fonts/</filename> are automatically
(or higher), Qt 2.3 (or higher) and <application>KDE</application>, made available for anti-aliasing to Xft-aware applications. Not
all KDE/Qt applications can be made to use anti-aliased all applications are Xft-aware yet, but many have received Xft support.
fonts.</para> Examples of Xft-aware applications include Qt 2.3 and higher (the
toolkit for the <application>KDE</application> desktop),
Gtk+ 2.0 and higher (the toolkit for the
<application>GNOME</application> desktop), and Mozilla 1.2 and higher.
</para>
<para>To configure anti-aliasing, create (or edit, if <para>In order to control which fonts are anti-aliased, or to
it already exists) the file configure anti-aliasing properties, create (or edit, if it
<filename>/usr/X11R6/lib/X11/XftConfig</filename>. Several already exists) the file
advanced things can be done with this file; this section <filename>/usr/X11R6/etc/fonts/local.conf</filename>. Several
describes only the simplest possibilities.</para> adavanced features of the Xft font system can be tuned using
this file; this section describes only some simple
possibilities. For more details, please see
fonts-conf(5).</para>
<para>First, tell the X server about the fonts that are to be <para>This file must be in XML format. Pay careful attention to
anti-aliased. For each font directory, add a line similar case, and make sure all tags are properly closed. The file
to this:</para> begins with the usual XML header followed by a DOCTYPE
definition, and then the &lt;fontconfig&gt; tag:</para>
<programlisting>dir "/usr/X11R6/lib/X11/fonts/Type1"</programlisting> <programlisting>
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
&lt;fontconfig&gt;
</programlisting>
<para>Likewise for the other font directories (URW, TrueType, etc) <para>As previously stated, all fonts in
containing fonts to be anti-aliased. Anti-aliasing makes <filename>/usr/X11R6/lib/X11/fonts/</filename> as well as
sense only for scalable fonts (basically, Type1 and TrueType) so <filename>~/.fonts/</filename> are already made available to
do not include bitmap font directories here. The Xft-aware applications. If you wish to add another directory
directories included here can now be commented out outside of these two directory trees, add a line similar to the
of the <filename>XF86Config</filename> file.</para> following to
<filename>/usr/X11R6/etc/fonts/local.conf</filename>:</para>
<programlisting>&lt;dir&gt;/path/to/my/fonts&lt;/dir&gt;</programlisting>
<para>Anti-aliasing makes borders slightly fuzzy, which makes very <para>Anti-aliasing makes borders slightly fuzzy, which makes very
small text more readable and removes <quote>staircases</quote> from small text more readable and removes <quote>staircases</quote> from
large text, but can cause eyestrain if applied to normal text. To large text, but can cause eyestrain if applied to normal text. To
exclude point sizes between 9 and 13 from anti-aliasing, include exclude point sizes smaller than 14 point from anti-aliasing, include
these lines:</para> these lines:</para>
<programlisting>match <programlisting> &lt;match target="font"&gt;
any size > 8 &lt;test name="size" compare="less"&gt;
any size < 14 &lt;double&gt;14&lt;/double&gt;
edit &lt;/test&gt;
antialias = false;</programlisting> &lt;edit name="antialias" mode="assign"&gt;
&lt;bool&gt;false&lt;/bool&gt;
&lt;/edit&gt;
&lt;/match&gt;</programlisting>
<para>Spacing for some monospaced fonts may also be inappropriate <para>Spacing for some monospaced fonts may also be inappropriate
with anti-aliasing. This seems to be an issue with with anti-aliasing. This seems to be an issue with
@ -740,63 +768,92 @@ edit
this is to force the spacing for such fonts to be 100. Add the this is to force the spacing for such fonts to be 100. Add the
following lines:</para> following lines:</para>
<programlisting>match any family == "fixed" edit family =+ "mono"; <programlisting> &lt;match target="pattern" name="family"&gt;
match any family == "console" edit family =+ "mono";</programlisting> &lt;test qual="any" name="family"&gt;
&lt;string&gt;fixed&lt;/string&gt;
&lt;edit name="family" mode="assign"&gt;
&lt;string&gt;mono&lt;/string&gt;
&lt;/edit&gt;
&lt;/match&gt;
&lt;match target="pattern" name="family"&gt;
&lt;test qual="any" name="family"&gt;
&lt;string&gt;console&lt;/string&gt;
&lt;edit name="family" mode="assign"&gt;
&lt;string&gt;mono&lt;/string&gt;
&lt;/edit&gt;
&lt;/match&gt;</programlisting>
<para>(this aliases the other common names for fixed fonts as <para>(this aliases the other common names for fixed fonts as
<literal>"mono"</literal>), and then add:</para> <literal>"mono"</literal>), and then add:</para>
<programlisting>match any family == "mono" edit spacing = 100;</programlisting> <programlisting> &lt;match target="pattern" name="family"&gt;
&lt;test qual="any" name="family"&gt;
&lt;string&gt;mono&lt;/string&gt;
&lt;edit name="spacing" mode="assign"&gt;
&lt;int&gt;100&lt;/int&gt;
&lt;/edit&gt;
&lt;/match&gt; </programlisting>
<para>Supposing the <para>Once you have finished editing
<literal>Lucidux</literal> fonts as desired whenever <filename>local.conf</filename> make sure you end the file
monospaced fonts are required (these look nice, and do not seem with the &lt;/fontconfig&gt; tag. Not doing this will cause
to suffer from the spacing problem), replace that last your changes to be ignored.</para>
line with these:</para>
<programlisting>match any family == "mono" edit family += "LuciduxMono"; <para>The default font set that comes with
match any family == "Lucidux Mono" edit family += "LuciduxMono"; <application>XFree86</application> is not very
match any family == "LuciduxMono" edit family =+ "Lucidux Mono";</programlisting> desirable when it comes to anti-aliasing. A much better
set of default fonts can be found in the
<filename role="package">x11-fonts/bitstream-vera</filename>
port. This port will install a
<filename>/usr/X11R6/etc/fonts/local.conf</filename> file
if one does not exist already. If the file does exist,
the port will create a <filename>/usr/X11R6/etc/fonts/local.conf-vera
</filename> file. Merge the contents of this file into
<filename>/usr/X11R6/etc/fonts/local.conf</filename>, and the
Bitstream fonts will automatically replace the default
<application>XFree86</application> Serif, Sans Serif, and Monospaced
fonts.</para>
<para>(the last lines alias different equivalent family names).</para> <para>Finally, users can add their own settings via their personal
<filename>.fonts.conf</filename> files. To do this, each user should
<para>Finally, it is nice to allow users to add commands to this simply create a <filename>~/.fonts.conf</filename>. This file must
file, via their personal <filename>.xftconfig</filename> also be in XML format.</para>
files. To do this, add a last line:</para>
<programlisting>includeif "~/.xftconfig"</programlisting>
<para>One last point: with an LCD screen, sub-pixel sampling may be <para>One last point: with an LCD screen, sub-pixel sampling may be
desired. This basically treats the (horizontally separated) desired. This basically treats the (horizontally separated)
red, green and blue components separately to improve the horizontal red, green and blue components separately to improve the horizontal
resolution; the results can be dramatic. To enable this, add the resolution; the results can be dramatic. To enable this, add the
line somewhere in the <filename>XftConfig</filename> file:</para> line somewhere in the <filename>local.conf</filename> file:</para>
<programlisting>match edit rgba=rgb;</programlisting> <programlisting>
&lt;match target="font"&gt;
&lt;test qual="all" name="rgba"&gt;
&lt;const&gt;unknown&lt;/const&gt;
&lt;/test&gt;
&lt;edit name="rgba" mode="assign"&gt;
&lt;const&gt;rgb&lt;/const&gt;
&lt;/edit&gt;
&lt;/match&gt;
</programlisting>
<para>(depending on the sort of display, the last word may need to <note><para>Depending on the sort of display,
be changed from <quote>rgb</quote> to <quote>bgr</quote>, <quote>rgb</quote> may need to to <quote>bgr</quote>,
<quote>vrgb</quote> or <quote>vbgr</quote>: experiment and see which <quote>vrgb</quote> or <quote>vbgr</quote>: experiment and
works best.)</para> see which works best.</para></note>
<para>Anti-aliasing should be enabled the next time the X server is <para>Anti-aliasing should be enabled the next time the X
started. However, note that programs must know how to take server is started. However, programs must know how to take
advantage of it. At the present time, the toolkit advantage of it. At present, the Qt toolkit does,
Qt does, so the entire <application>KDE</application> environment so the entire <application>KDE</application> environment can
can use anti-aliased fonts use anti-aliased fonts (see <xref
(see <xref linkend="x11-wm-kde-antialias"> on linkend="x11-wm-kde-antialias"> on
<application>KDE</application> for <application>KDE</application> for details). Gtk+ and GNOME
details); there are patches for GTK+ to do the same, can also be made to use anti-aliasing via the
so if compiled against such a patched GTK+, the GNOME environment <quote>Font</quote> capplet (see <xref
and Mozilla can also use anti-aliased fonts. In fact, there linkend="x11-wm-gnome-antialias"> for details). By default,
is now a port called <filename role="package">x11/gdkxft</filename> Mozilla 1.2 and greater will automatically use anti-aliasing.
which allows one to use antialiased fonts without recompiling: see To disable this, rebuild Mozilla with the
<xref linkend="x11-wm-gnome-antialias"> for details.</para> <quote>-DWITHOUT_XFT</quote> flag.</para>
<para>Anti-aliasing is still new to FreeBSD and
<application>XFree86</application>;
configuring it should get easier with time, and it will soon be
supported by many more applications.</para>
</sect2> </sect2>
</sect1> </sect1>
@ -1104,12 +1161,12 @@ DisplayManager.requestPort: 0</screen>
<para>To install the <application>GNOME</application> package <para>To install the <application>GNOME</application> package
from the network, simply type:</para> from the network, simply type:</para>
<screen>&prompt.root; <userinput>pkg_add -r gnome</userinput></screen> <screen>&prompt.root; <userinput>pkg_add -r gnome2</userinput></screen>
<para>To build <application>GNOME</application> from source, use <para>To build <application>GNOME</application> from source, use
the ports tree:</para> the ports tree:</para>
<screen>&prompt.root; <userinput>cd /usr/ports/x11/gnome</userinput> <screen>&prompt.root; <userinput>cd /usr/ports/x11/gnome2</userinput>
&prompt.root; <userinput>make install clean</userinput></screen> &prompt.root; <userinput>make install clean</userinput></screen>
<para>Once <application>GNOME</application> is installed, <para>Once <application>GNOME</application> is installed,
@ -1150,47 +1207,24 @@ DisplayManager.requestPort: 0</screen>
<sect3 id="x11-wm-gnome-antialias"> <sect3 id="x11-wm-gnome-antialias">
<title>Anti-aliased fonts with GNOME</title> <title>Anti-aliased fonts with GNOME</title>
<para>While anti-aliased fonts made their first appearance on <para>Starting with version 4.0.2, <application>XFree86</application>
<application>XFree86</application> desktops in the supports anti-aliasing via its <quote>RENDER</quote> extension.
<application>KDE</application> environment and are supported there Gtk+ 2.0 and greater (the toolkit used by
in the standard installation, it is also possible to use them with <application>GNOME</application> can make use of this
GTK applications such as the <application>GNOME</application> functionality. Configuring anti-aliasing is described in
environment. The most straightforward way is probably by <xref linkend="antialias">. So, with up-to-date software,
using the <application>libgdkxft</application> library, in anti-aliasing is possible within the
the <filename role="package">x11/gdkxft</filename> port. After <application>GNOME</application> desktop. Just go to
installing this port, read the <guimenuitem>Applications</guimenuitem> -&gt;
<filename>/usr/X11R6/share/doc/gdkxft/README</filename> file <guimenuitem>Desktop Preferences</guimenuitem> -&gt;
carefully.</para> <guimenuitem>Font</guimenuitem>, and select either
<guibutton>Best shapes</guibutton>,
<para>Then, all that is needed is to tell GTK <guibutton>Best contrast</guibutton>, or
applications to look for their font-rendering functions in <guibutton>Subpixel smoothing (LCDs)</guibutton>. For a
<filename>libgdkxft.so</filename> before looking in the Gtk+ application that is not part of the
standard place, <filename>libgdk.so</filename>. This is <application>GNOME</application> desktop, set the
easily accomplished by setting an environment variable to environment variable <varname>GDK_USE_XFT</varname> to
point to the right place; with the Bourne shell <literal>1</literal> before launching the program.</para>
(<application>/bin/sh</application>) or similar shells, type
the command (to start <application>The Gimp</application>,
say)</para>
<screen>&prompt.user; <userinput>LD_PRELOAD=/usr/X11R6/lib/libgdkxft.so gimp</userinput></screen>
<para>and with csh and similar shells, type</para>
<screen>&prompt.user; <userinput>setenv LD_PRELOAD /usr/X11R6/lib/libgdkxft.so</userinput>
&prompt.user; <userinput>gimp</userinput></screen>
<para>Or, the commands</para>
<programlisting>LD_PRELOAD=/usr/X11R6/lib/libgdkxft.so
export LD_PRELOAD</programlisting>
<para>can be put into <filename>.xinitrc</filename>,
<filename>.xsession</filename> or in the appropriate
place(s) in
<filename>/usr/X11R6/lib/X11/xdm/Xsession</filename>,
depending on how X is normally started. However, this
short-cut may cause problems if Linux GTK binaries are
run.</para>
</sect3> </sect3>
</sect2> </sect2>