Font Weights in X11

I was messing with fonts for a website, and wound up curious what exactly was going on when you leave off the font type in css, or if you specify the default families, such as sans-serif. Sure in Firefox preferences, you could set sans-serif to be any font, but it defaults to 'sans-serif' which is not a real font at all but some kind of default. I looked all over the gnome preferences for some setting defining what sans-serif was with no luck.

A bunch of hunting around and research later, and I found the answer, in /etc/fonts/conf.d/ there are a bunch of xml rules files which tell X11 what to do.

Example: 60-latin.conf

                <family>sans-serif</family>
                <prefer>
                        <family>DejaVu Sans</family>
                        <family>Bitstream Vera Sans</family>
                        <family>Verdana</family>
                        <family>Arial</family>
                        <family>Albany AMT</family>
                        <family>Luxi Sans</family>
                        <family>Nimbus Sans L</family>
                        <family>Helvetica</family>
                </prefer>

So here we see that for latin fonts, sans-serif translates into the first-available from the list. DejaVu if you have it, Bitstream if you have that, etc down to Helvetica. Magic!


CategoryXwindowSystem

fontweightsinx11 (last edited 2011-04-08 00:12:23 by k.dejong)