[91caf42] | 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="postlfs-console-fonts" xreflabel="About Console Fonts">
|
---|
| 9 | <?dbhtml filename="console-fonts.html"?>
|
---|
| 10 |
|
---|
| 11 |
|
---|
| 12 | <title>About Console Fonts</title>
|
---|
| 13 |
|
---|
| 14 | <indexterm zone="postlfs-console-fonts">
|
---|
| 15 | <primary sortas="a-console-fonts">console-fonts</primary>
|
---|
| 16 | </indexterm>
|
---|
| 17 |
|
---|
| 18 | <para>
|
---|
| 19 | An LFS system can be used without a graphical desktop, and unless or until
|
---|
| 20 | you install <xref linkend="x-window-system"/> you will have to work in the
|
---|
| 21 | console. Most, if not all, PCs boot with an 8x16 font - whatever the actual
|
---|
| 22 | screen size. There are a few things you can do to alter the display on the
|
---|
| 23 | console. Most of them involve changing the font, but the first alters the
|
---|
| 24 | commandline used by grub.
|
---|
| 25 | </para>
|
---|
| 26 |
|
---|
| 27 | <sect2 id="grub-video">
|
---|
| 28 | <title>Setting a smaller screen size in grub</title>
|
---|
| 29 |
|
---|
| 30 | <indexterm zone="postlfs-console-fonts grub-video">
|
---|
| 31 | <primary sortas="e-boot-grub-grub-cfg">/boot/grub/grub.cfg</primary>
|
---|
| 32 | </indexterm>
|
---|
| 33 |
|
---|
| 34 | <para>
|
---|
| 35 | Modern screens often have a lot more pixels then the screens used in the
|
---|
| 36 | past. If your screen is 1600 pixels wide, an 8x16 font will give you 200
|
---|
| 37 | columns of text - unless your monitor is enormous, the text will be tiny.
|
---|
| 38 | One of the ways to work around this is to tell grub to use a smaller size,
|
---|
| 39 | such as 1024x768 or 800x600 or even 640x480. Even if your screen does not
|
---|
| 40 | have a 4:3 aspect ratio, this should work.
|
---|
| 41 | </para>
|
---|
| 42 |
|
---|
| 43 | <para>
|
---|
| 44 | To try this, you can reboot and edit grub's command-line to insert a
|
---|
| 45 | 'video=' parameter between the 'root=/dev/sdXn' and 'ro', for example
|
---|
| 46 | <literal>root=/dev/sda2 video=1024x768 ro</literal> based on the
|
---|
[f0dc9578] | 47 | example in LFS section 10.4.4 :
|
---|
[50836740] | 48 | <ulink url="&lfs-root;/chapter10/grub.html"/>.
|
---|
[91caf42] | 49 | </para>
|
---|
| 50 |
|
---|
| 51 | <para>
|
---|
| 52 | If you decide that you wish to do this, you can then (as the
|
---|
| 53 | <systemitem class="username">root</systemitem> user) edit
|
---|
| 54 | <filename>/boot/grub/grub.cfg</filename>.
|
---|
| 55 | </para>
|
---|
| 56 |
|
---|
| 57 | </sect2>
|
---|
| 58 |
|
---|
| 59 | <sect2 id="psf-fonts">
|
---|
| 60 | <title>Using the standard psf fonts</title>
|
---|
| 61 |
|
---|
| 62 | <indexterm zone="postlfs-console-fonts psf-fonts">
|
---|
| 63 | <primary sortas="g-usr-share-consolefonts">/usr/share/consolefonts</primary>
|
---|
| 64 | </indexterm>
|
---|
| 65 |
|
---|
| 66 | <para>
|
---|
| 67 | In LFS the <application>kbd</application> package is used. The fonts it
|
---|
| 68 | provides are PC Screen Fonts, usually called PSF, and they were installed
|
---|
| 69 | into <filename class="directory">/usr/share/consolefonts</filename>. Where
|
---|
| 70 | these include a unicode mapping table, the file suffix is often changed to
|
---|
| 71 | <literal>.psfu</literal> although packages such as
|
---|
| 72 | <application>terminus-font</application> (see below) do not add the 'u'.
|
---|
| 73 | These fonts are usually compressed with gzip to save space, but that is
|
---|
| 74 | not essential.
|
---|
| 75 | </para>
|
---|
| 76 |
|
---|
| 77 | <para>
|
---|
| 78 | The initial PC text screens had 8 colours, or 16 colours if the bright
|
---|
| 79 | versions of the original 8 colours were used. A PSF font can include up
|
---|
| 80 | to 256 characters (technically, glyphs) while allowing 16 colours, or up
|
---|
| 81 | to 512 characters (in which case, the bright colours will not be
|
---|
| 82 | available). Clearly, these console fonts cannot be used to display CJK
|
---|
| 83 | text - that would need thousands of available glyphs.
|
---|
| 84 | </para>
|
---|
| 85 |
|
---|
| 86 | <para>
|
---|
| 87 | Some fonts in <application>kbd</application> can cover more than 512
|
---|
| 88 | codepoints ('characters'), with varying degrees of fidelity: unicode
|
---|
| 89 | contains several whitespace codepoints which can all be mapped to a space,
|
---|
| 90 | varieties of dashes can be mapped to a minus sign, smart quotes can map to
|
---|
| 91 | the regular ASCII quotes rather than to whatever is used for "codepoint
|
---|
| 92 | not present or invalid", and those cyrillic or greek letters which look
|
---|
| 93 | like latin letters can be mapped onto them, so 'A' can also do duty for
|
---|
| 94 | cyrillic A and greek Alpha, and 'P' can also do duty for cyrillic ER and
|
---|
| 95 | greek RHO. Unfortunately, where a font has been created from a BDF file
|
---|
[342d139a] | 96 | (the method in terminus and Debian's <ulink
|
---|
[91caf42] | 97 | url="https://packages.debian.org/jessie/utils/console-setup">console-setup
|
---|
[d353fdd] | 98 | </ulink>) such mapping of additional codepoints onto an existing glyph is
|
---|
| 99 | not always done, although the terminus ter-vXXn fonts do this well.
|
---|
[91caf42] | 100 | </para>
|
---|
| 101 |
|
---|
| 102 | <para>
|
---|
| 103 | There are over 120 combinations of font and size in
|
---|
| 104 | <application>kbd</application>: often a font is provided at several
|
---|
| 105 | character sizes, and sometimes varieties cover different subsets of
|
---|
| 106 | unicode. Most are 8 pixels wide, in heights from 8 to 16 pixels, but there
|
---|
| 107 | are a few which are 9 pixels wide, some others which are 12x22, and even
|
---|
| 108 | one (<filename>latarcyrheb-sun32.psfu</filename>) which has been scaled up
|
---|
| 109 | to 16x32. Using a bigger font is another way of making text on a large
|
---|
| 110 | screen easier to read.
|
---|
| 111 | </para>
|
---|
| 112 |
|
---|
| 113 | </sect2>
|
---|
| 114 |
|
---|
| 115 | <sect2 id="testing-fonts">
|
---|
| 116 | <title>Testing different fonts</title>
|
---|
| 117 |
|
---|
| 118 | <para>
|
---|
| 119 | You can test fonts as a normal user. If you have a font which has not been
|
---|
| 120 | installed, you can load it with :
|
---|
| 121 | </para>
|
---|
| 122 |
|
---|
| 123 | <screen><userinput>setfont /path/to/yourfont.ext</userinput></screen>
|
---|
| 124 |
|
---|
| 125 | <para>
|
---|
| 126 | For the fonts already installed you only need the name, so using
|
---|
| 127 | <filename>gr737a-9x16.psfu.gz</filename> as an example:
|
---|
| 128 | </para>
|
---|
| 129 |
|
---|
| 130 | <screen><userinput>setfont gr737a-9x16</userinput></screen>
|
---|
| 131 |
|
---|
| 132 | <para>
|
---|
| 133 | To see the glyphs in the font, use:
|
---|
| 134 | </para>
|
---|
| 135 |
|
---|
| 136 | <screen><userinput>showconsolefont</userinput></screen>
|
---|
| 137 |
|
---|
| 138 | <para>
|
---|
| 139 | If the font looks as if it might be useful, you can then go on to test it
|
---|
| 140 | more thoroughly.
|
---|
| 141 | </para>
|
---|
| 142 |
|
---|
| 143 | <para>
|
---|
[32b15287] | 144 | When you find a font which you wish to use, as the
|
---|
[91caf42] | 145 | <systemitem class="username">root</systemitem> user) edit
|
---|
| 146 | <phrase revision="sysv">
|
---|
| 147 | <filename>/etc/sysconfig/console</filename> as described in
|
---|
[f0dc9578] | 148 | LFS section 9.6.5
|
---|
| 149 | <ulink url="&lfs-root;/chapter09/usage.html"/>.</phrase>
|
---|
[91caf42] | 150 | <phrase revision="systemd">
|
---|
| 151 | <filename>/etc/vconsole.conf</filename> as described in
|
---|
[f0dc9578] | 152 | LFS section 9.6
|
---|
[50836740] | 153 | <ulink url="&lfs-root;/chapter09/console.html"/>.</phrase>.
|
---|
[91caf42] | 154 | </para>
|
---|
| 155 |
|
---|
| 156 | <para>
|
---|
| 157 | For fonts not supplied with the <application>kbd</application> package
|
---|
| 158 | you will need to optionally compress it / them with
|
---|
| 159 | <command>gzip</command> and then install it / them as the
|
---|
| 160 | <systemitem class="username">root</systemitem> user.
|
---|
| 161 | </para>
|
---|
| 162 |
|
---|
| 163 | </sect2>
|
---|
| 164 |
|
---|
| 165 | <!-- after that, psf-tools -->
|
---|
| 166 |
|
---|
| 167 | <sect2 id="psf-tools">
|
---|
| 168 | <title>Editing fonts using psf-tools</title>
|
---|
| 169 |
|
---|
| 170 | <indexterm zone="postlfs-console-fonts psf-tools">
|
---|
| 171 | <primary sortas="a-psftools">psftools</primary>
|
---|
| 172 | </indexterm>
|
---|
| 173 |
|
---|
| 174 | <para>
|
---|
| 175 | Although some console fonts are created from BDF files, which is a text
|
---|
| 176 | format with hex values for the pixels in each row of the character, there
|
---|
| 177 | are more-modern tools available for editing psf fonts. The
|
---|
[cd29bc9] | 178 | <ulink url="https://www.seasip.info/Unix/PSF/">psftools</ulink> package
|
---|
[91caf42] | 179 | allows you to dump a font to a text representation with a dash for a
|
---|
| 180 | pixel which is off (black) and a hash for a pixel which is on (white).
|
---|
| 181 | You can then edit the text file to add more characters, or reshape them,
|
---|
| 182 | or map extra codepoints onto them, and then create a new psf font with
|
---|
| 183 | your changes.
|
---|
| 184 | </para>
|
---|
| 185 |
|
---|
| 186 | </sect2>
|
---|
| 187 |
|
---|
[d353fdd] | 188 | <!-- finally, link to terminus and link to it from above -->
|
---|
[91caf42] | 189 | <sect2 id="terminus-font">
|
---|
| 190 | <title>Using fonts from Terminus-font</title>
|
---|
| 191 |
|
---|
| 192 | <indexterm zone="postlfs-console-fonts terminus-font">
|
---|
| 193 | <primary sortas="a-terminus-font">terminus-font</primary>
|
---|
| 194 | </indexterm>
|
---|
| 195 |
|
---|
| 196 | <para>
|
---|
| 197 | The <ulink
|
---|
[17aa21c] | 198 | url="https://terminus-font.sourceforge.net/">Terminus Font</ulink> package
|
---|
[91caf42] | 199 | provides fixed-width bitmap fonts designed for long (8 hours and more per
|
---|
| 200 | day) work with computers. Under 'Character variants' on that page is a
|
---|
| 201 | list of patches (in the <filename class="directory">alt/</filename>
|
---|
| 202 | directory). If you are using a graphical browser to look at that page, you
|
---|
| 203 | can see what the patches do, e.g. 'll2' makes 'l' more visibly different
|
---|
| 204 | from 'i' and '1'.
|
---|
| 205 | </para>
|
---|
| 206 |
|
---|
| 207 | <para>
|
---|
| 208 | By default <application>terminus-fonts</application> will try to create
|
---|
| 209 | several types of font, and it will fail if <command>bdftopcf</command>
|
---|
| 210 | from <xref linkend="xorg7-app"/> has not been installed. The configure
|
---|
| 211 | script is only really useful if you go on to install
|
---|
| 212 | <emphasis>all</emphasis> the fonts (console and X11 bitmap) to the
|
---|
| 213 | correct directories, as in a distro. To build only the PSF fonts and
|
---|
| 214 | their dependencies, run:
|
---|
| 215 | </para>
|
---|
| 216 |
|
---|
| 217 | <screen><userinput>make psf</userinput></screen>
|
---|
| 218 |
|
---|
| 219 | <para>
|
---|
| 220 | This will create more than 240 ter-*.psf fonts. The 'b' suffix indicates
|
---|
| 221 | bright, 'n' indicates normal. You can then test them to see if any fit
|
---|
| 222 | your requirements. Unless you are creating a distro, there seems little
|
---|
| 223 | point in installing them all.
|
---|
| 224 | </para>
|
---|
| 225 |
|
---|
| 226 | <para>
|
---|
| 227 | As an example, to install the last of these fonts, you can gzip it and
|
---|
| 228 | then as the
|
---|
| 229 | <systemitem class="username">root</systemitem> user:
|
---|
| 230 | </para>
|
---|
| 231 |
|
---|
| 232 | <screen><userinput>install -v -m644 ter-v32n.psf.gz /usr/share/consolefonts</userinput></screen>
|
---|
| 233 |
|
---|
| 234 | </sect2>
|
---|
| 235 |
|
---|
| 236 |
|
---|
| 237 | <!-- then svn up, add changelog, do the propsets, create wiki page -->
|
---|
| 238 | </sect1>
|
---|