# Fonts and Linux ## Contents - [Configuration Files](#configuration-files) - [Remapping Fonts](#remapping-fonts) - [Whitelisting and Blacklisting](#whitelisting-and-blacklisting) - [Disable Hinting](#disable-hinting) - [LCD Optimization](#lcd-optimization) - [Local Fonts](#local-fonts) - [Luxi Sans](#luxi-sans) - [gVim Fonts](#gvim-fonts) - [LightDM Fonts](#lightdm-fonts) - [References](#references) ## Configuration Files The exact location of the configuration depends on which release of which distro and the Desktop Environment being used. | Distro | Location | | ---------------- | ------------------------------- | | Fedora 17- | ~/.fonts.conf | | Fedora 18+, Arch | ~/.config/fontconfig/fonts.conf | ## Remapping Fonts This will remap Courier to Liberation Mono and Caladea to Carlito - Google Fonts have a habit of "stealing" these typefaces resulting in unexpected fonts when browsing the general web. Substitute **DejaVu Sans Mono** for Liberation Mono for a similar result depending on your desktop. ``` false Courier Liberation Mono Courier Liberation Mono false Caladea Carlito ``` ## Whitelisting and Blacklisting The element `` is used in conjunction with the `` and `` elements to selectively whitelist or blacklist fonts from the resolve list and match requests. The simplest and most typical use case it to reject one font that is needed to be installed, however is getting matched for a generic font query that is causing problems within application user interfaces. First obtain the Family name as listed in the font itself: ``` $ fc-scan .fonts/lklug.ttf --format='%{family}\n' LKLUG ``` Then use that Family name in a `` stanza: ``` LKLUG ``` Typically when both elements are combined, `` is first used on a more general matching glob to reject a large group (such as a whole directory), then `` is used after it to whitelist individual fonts out of the larger blacklisted group. ``` /usr/share/fonts/OTF/* Monaco ``` ## Disable Hinting Chrome in XFCE can have issues with hinting resulting in bad display for instance, it might be handy to disable hinting: ``` false ``` ## LCD Optimization Assuming a standard RGB subpixel ordering: ``` true false true hintslight rgb lcddefault false ``` ## Local Fonts Keeping fonts locally in your home directory: - Make a new directory in your home called `.fonts` (note leading `.`) - Copy the downloaded TTF file into this directory - Change directory to .fonts (`cd ~/.fonts/`) - Run the command: `mkfontscale` (creates fonts.scale) - Run the command: `mkfontdir` (creates fonts.dir) - Run the command: `fc-cache -fv ~/.fonts` (rebuilds local cache) - Test with: `fc-cache` ## Luxi Sans This disappeared with Fedora 8 due to [licensing issues](https://fedoraproject.org/wiki/Luxi_fonts), Google for this file and unpack it to get the TTF files you can install in your [home directory](#Local_Fonts). - `xorg-x11-fonts-truetype-7.2-3.fc8.noarch.rpm` ## gVim Fonts A snippet for your `~/.vimrc` to map the editing font in [gVim](http://www.vim.org/): ``` ~/.vimrc " GVIM preferences if has("gui_running") let os=substitute(system('uname'), '\n', '', '') if os == 'Darwin' || os == 'Mac' set guifont=Menlo:h16 elseif os == 'Linux' set guifont=Monospace\ 12 endif endif ``` ## LightDM Fonts The typical config file is `/etc/lightdm/lightdm-gtk-greeter.conf`: ``` /etc/lightdm/lightdm-gtk-greeter.conf [greeter] font-name=Luxi Sans 12 xft-antialias=true xft-hintstyle=hintnone xft-rgba=rgb ``` ## References -