mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / Fonts.mdwn
1 Here are some quick notes on working with fonts on Linux.
2
3 X Windows fonts
4 ===============
5
6 Fonts are managed by [fontconfig][].  For per-user fonts, you can
7 generally just drop your font into `~/.fonts/`, and it will be picked
8 up by X.  You can use `fc-list` to list fonts that X can find.
9
10     $ fc-list
11     Verdana:style=Regular,Normal,obyčejné,Standard,Κανονικά,…
12     ClassicHeavy:style=Light
13     Nimbus Sans L:style=Regular Italic
14     Shalom:style=Stick
15     …
16
17 For more details on a font, you can set the [format][]:
18
19     $ fc-list -f '%{family}\t%{file}\n'
20     Ann     /usr/share/fonts/freefonts/ans.pfb
21     Goudy-Old-Style /usr/share/fonts/freefonts/goudyob.pfb
22     Nimbus Roman No9 L      /usr/share/fonts/urw-fonts/n021003l.pfb
23     …
24
25 Or just use `--verbose`:
26
27     $ fc-list -v
28     Pattern has 15 elts (size 16)
29             family: "Ann"(s)
30             style: "Stone"(s)
31     …
32
33 You can use `xset` to query the font path for your current X server.
34
35     $ xset q
36     …
37     Font Path:
38       /usr/share/fonts/misc/,/usr/share/fonts/100dpi/,/usr/share/fonts/75dpi/,built-ins
39     …
40
41 I use [gucharmap][] to browse fonts and select unicode characters that
42 I haven't yet bound to the keyboard via [[Xmodmap]] or
43 [[XCompose|Compose_key]].  There are a number of nice fonts over at
44 the [Open Font Library][OFL].
45
46 Web fonts
47 =========
48
49 Modern desktop fonts are generally [TrueType][] or [OpenType][].  For
50 the web, where bandwidth is important, there is the [Web Open Font
51 Format][WOFF] (WOFF), which compresses the desktop formats.  I've
52 written a simple script ([[font-reduce]]) that uses FontForge to
53 convert subsets of fonts to WOFF for use on the web.
54
55 Console fonts
56 =============
57
58     $ setfont /usr/share/consolefonts/gr737b-9x16-medieval.psfu.gz
59
60 On [[Gentoo]] you can set the default in `/etc/conf.d/consolefont`.
61
62 Authoring fonts
63 ===============
64
65 The main open source tool seems to be [FontForge][].
66
67 Further reading
68 ===============
69
70 There are more details about [fonts on Linux][arch] on the Arch wiki
71 page.  Kevin Bowling also has some interesting notes about
72 [configuring fontconfig][KB].  Finally, Nice Web Type has notes about
73 [using fonts on the web][NWT].
74
75
76 [fontconfig]: http://fontconfig.org/
77 [format]: http://freedesktop.org/software/fontconfig/fontconfig-devel/fcpatternformat.html
78 [gucharmap]: http://live.gnome.org/Gucharmap
79 [OFL]: http://openfontlibrary.org/
80 [TrueType]: http://en.wikipedia.org/wiki/TrueType
81 [OpenType]: http://en.wikipedia.org/wiki/OpenType
82 [WOFF]: http://en.wikipedia.org/wiki/Web_Open_Font_Format
83 [FontForge]: http://fontforge.sourceforge.net/
84 [arch]: https://wiki.archlinux.org/index.php/Fonts
85 [KB]: http://www.kev009.com/wp/2009/12/getting-beautiful-fonts-in-gentoo-linux/
86 [NWT]: http://nicewebtype.com/notes/2009/10/30/how-to-use-css-font-face/