Font-aliases

Still under construction

A bit of history

Font-aliases first appeared in version 16.8.4(?) to provide a more flexible way of changing theme fonts according to user needs. Prior to that, all font selection was specified by the theme in textclasses.cfg. Unfortunatly most themes didn't take into account the many locales that enlightenment was being ran in. The result was that many characters outside the standard ASCII set were not displayed properly -- if at all.


Why are they called aliases?

The reason they're called aliases is that instead of defining the font and size (such as "Vera/8") in a textclass item, you assign it a name and then just reference that "alias name" rather than the font itself.

By doing this, separate config files can now override font and size selection without disturbing text properties such as color and direction.


How it works

Without setting a custom file name, the font alias configuration files searched for are:

fonts.cfg
fonts.xft.cfg
fonts.pango.cfg
fonts.theme.cfg

Which one is used depends on compilation options and user settings. See the "post by Kim" in the "Font standards" forum thread for details.

What this means for themers is that by default the enlightenment [system wide] configuration is in control of theme fonts and will use either fonts.xft.cfg or fonts.pango.cfg depending on compilation options. Both Xft and Pango configurations use a well rounded Sans font installed on all modern systems. If for some reason your theme doesn't work well with the font sizes defined there, than you might want to copy the Xft and Pango font config files to your theme and modify the font sizes. Your copies will then take precidence and your theme will display properly. It's still best to use the "Sans" font though for good character support in all locales.

If you would like to do something more unique, however, then that's when fonts.theme.cfg should be used. If you have a specific TrueType font, place it in THEME/ttfont and then define your custom font configuration in THEME/fonts.theme.cfg. This file is used when e16 is set to use the theme font rather than system font.

Users override both theme and system fonts by defining what they want in either fonts.xft.cfg, fonts.pango.cfg, fonts.cfg or any other name they setup e16 to look for in ~/.e16/.

In order for a theme to work well with pre 1.0.0 versions of enlightenment, create a symbolic link fonts.cfg -> fonts.theme.cfg.


Alias naming convention

In order for users to have their own font alias config file in ~/.e16/ and have it affect all themes, there needs to be a standard in font alias names. Otherwise what a user defines may not match the font-aliasses defined in each themes textclasses.cfg file.

Below is a list of names used by fonts.xft.cfg and fonts.pango.cfg from the EROOT/config directory. Defining all of these (especially if you don't use them in textclasses.cfg) is not necessary, but using the names found in this list is most appropriate.

font-default
font-border
font-border-small
font-coords
font-dialog
font-dialog-hilite
font-epplet
font-epplet-small
font-epplet-medium
font-epplet-large
font-focus
font-iconbox
font-init
font-menu
font-pager
font-tooltip


The basics

Syntax for a font-aliases file is quite simple.

__FONT __BGN
  font-default  "xft:sans-8:bold"
__END

Line 1 begins the font alias definition
Line 2 defines the font alias
Line 3 ends the font alias definition

Other than defining more font aliases, this is all the syntax there is. There aren't any advanced or additional options.


Font sources

There are a number of sources that e16 can use fonts from. Below is a list of sources and the syntax required for the font alias definition.

Fnlib - no longer supported, don't use it.

TrueType - Theme embedded TrueType font file located in the THEME/ttfont directory. FontForge is a good program to display and edit TrueType fonts.

font-default "Arial/12"

X Font - Old school (Type 1) X font selection. Use xfontsel, xlsfonts and xfd to view and capture the syntax for these fonts.

font-default "-*-helvetica-*-r-*-*-10-*-*-*-*-*-*-*" /* normal */
font-default "-*-helvetica-*-r-*--10-*-*-*-*-*-*-*,-*-*-*-r-*--10-*-*-*-*-*-*-*" /* multibyte */

Xft - Modern X font rendering system. Supports Type 1, TrueType, OpenType, and others. fc-list and xfd can be used to display fonts on the system.

font-default "xft:sans-8:bold"

Pango - GTK based font rendering system.

font-default "pango:sans bold 8"
Syndicate content