1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
ttf-console-fonts, by B. Watson <yalhcru@gmail.com>.
Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
ttf-console-fonts is a collection of Linux console fonts, converted from
various TrueType fonts found in a typical Linux install.
No TTF fonts are included here. Instead, the ones installed on your system
(usually in /usr/share/fonts/TTF) are used. Also, I don't include prebuilt
console fonts because I'm not so sure the licensing allows it (dammit,
I'm a doc... uh, programmer, not a lawyer).
The name is slightly misleading: obviously the console doesn't support
TTF, only bitmap fonts in PSF format. What this package does is convert
various TTFs into the PSF (aka .psfu) bitmapped font format used by
the kernel.
Notice that these are framebuffer fonts. Pretty much everyone these
days is likely to be using the framebuffer console (thanks to kernel
modesetting and Xorg's requirement for it). If you're somehow still using
a VGA textmode console, only fonts 8 or 9 pixels wide are supported.
For this package, that means the ones with "8x" in their filenames.
If the converted fonts don't look the same to you on the console as the
original fonts do in X, that's because X and most modern X applications
do subpixel rendering for antialiasing. The Linux console doesn't support
this at all.
Another difference between TTF and console fonts: only 512 glyphs are
allowed per console font. This means Unicode support will be limited.
The generated fonts include the full ASCII set, plus Latin-1 (aka
ISO-8859-1) and at least partial support for Latin-2. If your requirements
are different, change SETS in conv.sh (read the bdf2psf documentation,
and possibly the source code, to understand how this stuff works). One
useful piece of information: the same glyph can represent more than one
Unicode codepoint (if they have the same appearance, e.g. C in Latin
and Cyrillic).
Requirements:
- bdf2psf
- otf2bdf
- psftools
For Slackware, the above are available on SlackBuilds.org. For Debian
or Ubuntu, try apt-getting them.
"Core system" requirements (included in Slackware, may need installing
if you're on Debian/etc):
- fontconfig
- freetype2
- perl
- stuff like coreutils and bash
- whatever fonts are listed in the file 'fonts', of course.
To build the fonts, simply run "make". If you get errors, especially
"command not found" or "no such file or directory", you're missing a
requirement (see above).
After they're built, the fonts will have filenames like:
dejavusansmono-8x12.psfu.gz
The "8x12" is the pixel size (NOT the point size).
If you're running in the console, you can test out the fonts by loading
them with "setfont". If the results look OK, you can install the fonts via
"make install" (if you're making a distro package, DESTDIR is supported).
On Slackware, you can edit /etc/rc.d/rc.font to set the default system
font to whichever one you like best. Don't forget to make rc.font
executable. I have no idea how to set the default console font on other
distributions (sorry).
If you want to try converting other fonts, edit the file "fonts". The font
names there are whatever "fc-list" calls the font. You can probably use
wildcards or inexact matches (fc-list is pretty user-friendly). Whatever
fonts you choose *must* be TrueType or OpenType (.ttf or .otf). They
also *must* be "monospace" or "fixed width". Trying to convert
proportional/variable-width fonts will "work", but the result won't be
very pleasing to look at.
If you don't like the sizes I picked, you can set SIZES in the
environment. It's a space-separated list of point sizes. Example:
SIZES="6 9 12 15" make
Don't get too crazy with the cheez-wiz: the kernel (or at least the
setfont command) has a font height limit of 32 rows. And in my testing, I
found that fonts 31 or 32 rows tall would load, but displayed incorrectly.
The practical limit (for my system at least) seems to be 30.
The point sizes might be a bit different than they are in X. This is
because Xorg's Xrandr extension is smart enough to know your monitor's
actual DPI, and will scale TTFs to the correct size. The otf2bdf utility
used here could theoretically do the same thing, but it doesn't: it
just assumes 100x100 DPI. If your monitor doesn't have square pixels,
this will be even more noticeable.
If you're wondering how many rows/columns of text each font will give you,
the calculation is simple enough: find out your framebuffer resolution
(e.g. by running 'fbset' with no arguments), and divide the width of
the fb by the width of the font (e.g. 1920/15 = 128, throw away any
remainder). Do the same calculation for the height (e.g. 1080/27 = 40).
Or, you could just load the font, then:
kill -WINCH $$; echo $COLUMNS $LINES
|