The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Fonts"
(infinality flag now moved to reetype) |
|||
(14 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
== Console Only Fonts == | |||
Console fonts for tty's are easily configurable, and testable. | |||
{{console|body= | |||
###i## cd /usr/share/consolefonts/ | |||
###i## ls #to display the font files | |||
###i## setfont default8x9 #sets the 8x9 default font (this will be tiny, and you may not like it) | |||
###i## setfont #returns the system to the system default font}} | |||
Once you determine the font you like make it the system default: | |||
== | {{file|name=/etc/conf.d/consolefont|lang=|desc=setting the system default font to the tiny text default8x9|body= | ||
=== | consolefont="default8x9" | ||
==== Default configuration | }} | ||
More console font packages exist in portage: | |||
{{console|body= | |||
###i## emerge media-fonts/terminus-font | |||
}} | |||
We suggest tiny console fonts so more information can be displayed from a single page. | |||
The readme files in /usr/share/consolefonts contain valuable information, make sure to go through them. | |||
{{file|name=/etc/conf.d/consolefont|lang=|desc=setting the system default font to the tiny text terminus font|body= | |||
consolefont="ter-112n"}} | |||
To set consolefonts as early as possible @ init: | |||
{{console|body= | |||
###i## rc-update add consolefont sysinit}} | |||
=== Default configuration === | |||
{{console|body= | |||
###i## eselect fontconfig enable 10-antialias.conf | ###i## eselect fontconfig enable 10-antialias.conf | ||
###i## eselect fontconfig enable 10-autohint.conf | ###i## eselect fontconfig enable 10-autohint.conf | ||
Line 27: | Line 47: | ||
###i## eselect fontconfig disable 10-sub-pixel-vbgr.conf | ###i## eselect fontconfig disable 10-sub-pixel-vbgr.conf | ||
###i## eselect fontconfig disable 10-sub-pixel-vrgb.conf | ###i## eselect fontconfig disable 10-sub-pixel-vrgb.conf | ||
###i## eselect fontconfig disable 10-unhinted.conf | ###i## eselect fontconfig disable 10-unhinted.conf}} | ||
===Linux configuration === | ===Linux configuration === | ||
Same as default configuration except: | Same as default configuration except: | ||
{{console|body= | |||
###i## eselect fontconfig enable 21-hinting-small-aquabase-slight.conf | ###i## eselect fontconfig enable 21-hinting-small-aquabase-slight.conf | ||
###i## eselect fontconfig enable 21-hinting-small-browallia-slight.conf | ###i## eselect fontconfig enable 21-hinting-small-browallia-slight.conf | ||
###i## eselect fontconfig enable 22-hinting-courier-italic-slight.conf | ###i## eselect fontconfig enable 22-hinting-courier-italic-slight.conf}} | ||
=== Infinality’s configuration === | === Infinality’s configuration === | ||
Same as default configuration except: | Same as default configuration except: | ||
{{console|body= | |||
###i## eselect fontconfig enable 15-hinting-tt-instructed-full.conf | ###i## eselect fontconfig enable 15-hinting-tt-instructed-full.conf | ||
###i## eselect fontconfig enable 20-hinting-small-fonts-slight.conf | ###i## eselect fontconfig enable 20-hinting-small-fonts-slight.conf | ||
Line 45: | Line 65: | ||
###i## eselect fontconfig enable 21-hinting-small-browallia-slight.conf | ###i## eselect fontconfig enable 21-hinting-small-browallia-slight.conf | ||
###i## eselect fontconfig enable 22-hinting-courier-italic-slight.conf | ###i## eselect fontconfig enable 22-hinting-courier-italic-slight.conf | ||
###i## eselect fontconfig enable 25-hinting-small-arial-black-slight.conf | ###i## eselect fontconfig enable 25-hinting-small-arial-black-slight.conf}} | ||
=== Windows configuration === | === Windows configuration === | ||
Same as default except: | Same as default except: | ||
{{console|body= | |||
###i## eselect fontconfig disable 10-autohint.conf | ###i## eselect fontconfig disable 10-autohint.conf | ||
###i## eselect fontconfig disable 10-hinting-slight.conf | ###i## eselect fontconfig disable 10-hinting-slight.conf | ||
Line 59: | Line 79: | ||
###i## eselect fontconfig enable 21-hinting-small-browallia-slight.conf | ###i## eselect fontconfig enable 21-hinting-small-browallia-slight.conf | ||
###i## eselect fontconfig enable 22-hinting-courier-italic-slight.conf | ###i## eselect fontconfig enable 22-hinting-courier-italic-slight.conf | ||
###i## eselect fontconfig enable 25-hinting-small-arial-black-slight.conf | ###i## eselect fontconfig enable 25-hinting-small-arial-black-slight.conf}} | ||
=== OSX configuration === | === OSX configuration === | ||
Same as default configuration except: | Same as default configuration except: | ||
{{console|body= | |||
###i## eselect fontconfig disable 10-autohint.conf | ###i## eselect fontconfig disable 10-autohint.conf | ||
###i## eselect fontconfig disable 10-hinting.conf | ###i## eselect fontconfig disable 10-hinting.conf | ||
###i## eselect fontconfig disable 10-hinting-slight.conf | ###i## eselect fontconfig disable 10-hinting-slight.conf | ||
###i## eselect fontconfig enable 10-unhinted.conf | ###i## eselect fontconfig enable 10-unhinted.conf | ||
###i## eselect fontconfig enable 15-hinting-tt-instructed-none.conf | ###i## eselect fontconfig enable 15-hinting-tt-instructed-none.conf}} | ||
== Freetype == | === Freetype === | ||
Freetype can be configured through environment variables (see | Freetype can be configured through environment variables (see {{f|/etc/env.d/99lcdfilter}} for a list of the variables and their description). Those variables can be overridden on a per-user basis by either redefining them in a startup file (such as {{f|~/.bash_profile}}) or by sourcing the {{f|/usr/lib/ft-settings.sh}} script with the desired style in parameter (you can, of course, source the script from a startup file). | ||
usage: | usage: | ||
{{console|body= | |||
###i## source /usr/lib/ft-settings.sh | |||
Possible styles: | Possible styles: | ||
default - Use default settings. A compromise that should please most people | default - Use default settings. A compromise that should please most people | ||
Line 92: | Line 113: | ||
sharpened - Full stem snapping, tweaks, and Windows-style sharpening | sharpened - Full stem snapping, tweaks, and Windows-style sharpening | ||
infinality - Settings used by Infinality | infinality - Settings used by Infinality | ||
}} | |||
== | |||
=== Infinality-Ultimate === | |||
A more extensive version of the infinality USE flag is the media-fonts/infinality-ultimate-meta package. This contains the [https://github.com/bohoomil/fontconfig-ultimate fontconfig-ultimate] patches and configuration to give you excellent quality rendering and replacements. This has the advantage of being actively maintained whereas the infinality patchset used by the freetype USE flag is not being updated any more. | |||
When this has been installed you should enable infinality in eselect and disable all others: | |||
{{console|body= ###i## eselect fontconfig list}} | |||
{{console|body= ###i## eselect fontconfig enable [number of infinality]}} | |||
Then enable one of the "ultimate" presets: | |||
{{console|body= ###i## eselect infinality list}} | |||
Then enable the "ultimate" lcdfilter: | |||
{{console|body= ###i## eselect lcdfilter list}} | |||
=== Simple Global Rules === | |||
It is possible to achieve good looking fonts without the infinality flag. The infinality patches are not maintained any more but patches are sent upstream from the previous maintainer (who works on fontconfig-ultimate now). Simple global replacement rules can be set up to guarantee that all fonts get a decent replacement. | |||
The following example uses the media-fonts/croscorefonts package as well as a few other some from media-fonts/crosextrafonts (this package is not currently in the funtoo tree but can be installed from the chromiumos overlay). Other fonts can be chosen here as desired but these particular fonts are metrically compatible with MS Fonts and are rendered particularly well. | |||
{{file|name=/etc/fonts/local.conf|desc= |body= | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |||
<fontconfig> | |||
<alias> | |||
<family>serif</family> | |||
<prefer><family>Tinos</family></prefer> | |||
</alias> | |||
<alias> | |||
<family>sans-serif</family> | |||
<prefer><family>Arimo</family></prefer> | |||
</alias> | |||
<alias> | |||
<family>sans</family> | |||
<prefer><family>Arimo</family></prefer> | |||
</alias> | |||
<alias> | |||
<family>monospace</family> | |||
<prefer><family>Cousine</family></prefer> | |||
</alias> | |||
<match> | |||
<test name="family"><string>Arial</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Arimo</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Helvetica</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Arimo</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Verdana</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Arimo</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Tahoma</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Arimo</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Times New Roman</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Tinos</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Times</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Tinos</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Consolas</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Cousine</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Courier New</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Cousine</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Calibri</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Carlito</string> | |||
</edit> | |||
</match> | |||
<match> | |||
<test name="family"><string>Cambria</string></test> | |||
<edit name="family" mode="assign" binding="strong"> | |||
<string>Caladea</string> | |||
</edit> | |||
</match> | |||
</fontconfig> | |||
}} | |||
Then enable the local.conf with {{console|body= ###i## eselect fontconfig list}} and then {{console|body= ###i## eselect fontconfig enable *number*}} | |||
=== Ugly Helvetica === | |||
Using infinality will not protect you from the ugly replacement for Helvetica, which is installed by {{c|media-fonts/font-adobe-100dpi}} and {{c | media-fonts/font-adobe-75dpi}}. This font is represented by files like {{c | /usr/share/fonts/100dpi/helvR12-ISO8859-1.pcf.gz}} and is immune to hinting; since the package {{c|media-fonts/font-adobe-100dpi}} is a dependency of {{c | x11-base/xorg-x11}} and since a lot of websites are using Helvetica, you will see this very ugly, not-hinted fonts on those. | |||
However, this can be avoided by using {{c | package.provided}} which tells portage not to update a particular package: | |||
{{console|body= | |||
###i## mkdir -p /etc/portage/profile | |||
###i## echo "media-fonts/font-adobe-100dpi-1.0.3" >> /etc/portage/profile/package.provided | |||
###i## echo "media-fonts/font-adobe-75dpi-1.0.3" >> /etc/portage/profile/package.provided | |||
###i## emerge -C media-fonts/font-adobe-100dpi | |||
###i## emerge -C media-fonts/font-adobe-75dpi | |||
}} | |||
After unmerging these packages you will need to restart applications like Firefox; then, the system should pickup sensible replacements for Helvetica such as *Liberation* which are defined in fontconfig by default. | |||
==== On a User Level ==== | |||
If you prefer to set this one a user level you could enable the user.conf in eselect instead of the local.conf and then do | |||
{{console|body= $##i## cp /etc/fonts/local.conf ~/.config/fontconfig/fonts.conf}} | |||
=== LibXft === | |||
It can be configured on a per-user basis in the {{f|~/.Xresources}} or {{f|~/.Xdefaults}} files: | |||
{{file|name=~/.Xdefaults|desc= |body= | {{file|name=~/.Xdefaults|desc= |body= | ||
Line 105: | Line 250: | ||
Xft.rgba: rgb | Xft.rgba: rgb | ||
}} | }} | ||
{{f|~/.Xdefaults}} is deprecated and {{f|~/.Xresources}} is recommended for usage in configuration. | |||
[[Category:HOWTO]] | [[Category:HOWTO]] |
Latest revision as of 13:32, September 20, 2019
Console Only Fonts
Console fonts for tty's are easily configurable, and testable.
root # cd /usr/share/consolefonts/ root # ls #to display the font files root # setfont default8x9 #sets the 8x9 default font (this will be tiny, and you may not like it) root # setfont #returns the system to the system default font
Once you determine the font you like make it the system default:
/etc/conf.d/consolefont
- setting the system default font to the tiny text default8x9consolefont="default8x9"
More console font packages exist in portage:
root # emerge media-fonts/terminus-font
We suggest tiny console fonts so more information can be displayed from a single page.
The readme files in /usr/share/consolefonts contain valuable information, make sure to go through them.
/etc/conf.d/consolefont
- setting the system default font to the tiny text terminus fontconsolefont="ter-112n"
To set consolefonts as early as possible @ init:
root # rc-update add consolefont sysinit
Default configuration
root # eselect fontconfig enable 10-antialias.conf root # eselect fontconfig enable 10-autohint.conf root # eselect fontconfig enable 10-hinting.conf root # eselect fontconfig enable 10-hinting-slight.conf root # eselect fontconfig enable 10-sub-pixel-rgb.conf root # eselect fontconfig enable 11-lcdfilter-default.conf root # eselect fontconfig enable 70-no-bitmaps.conf root # eselect fontconfig disable 10-hinting-full.conf root # eselect fontconfig disable 10-hinting-medium.conf root # eselect fontconfig disable 10-no-sub-pixel.conf root # eselect fontconfig disable 10-sub-pixel-bgr.conf root # eselect fontconfig disable 10-sub-pixel-vbgr.conf root # eselect fontconfig disable 10-sub-pixel-vrgb.conf root # eselect fontconfig disable 10-unhinted.conf
Linux configuration
Same as default configuration except:
root # eselect fontconfig enable 21-hinting-small-aquabase-slight.conf root # eselect fontconfig enable 21-hinting-small-browallia-slight.conf root # eselect fontconfig enable 22-hinting-courier-italic-slight.conf
Infinality’s configuration
Same as default configuration except:
root # eselect fontconfig enable 15-hinting-tt-instructed-full.conf root # eselect fontconfig enable 20-hinting-small-fonts-slight.conf root # eselect fontconfig enable 21-hinting-small-aquabase-slight.conf root # eselect fontconfig enable 21-hinting-small-browallia-slight.conf root # eselect fontconfig enable 22-hinting-courier-italic-slight.conf root # eselect fontconfig enable 25-hinting-small-arial-black-slight.conf
Windows configuration
Same as default except:
root # eselect fontconfig disable 10-autohint.conf root # eselect fontconfig disable 10-hinting-slight.conf root # eselect fontconfig enable 10-hinting-full.conf root # eselect fontconfig enable 15-hinting-non-tt-instructed-slight.conf root # eselect fontconfig enable 20-hinting-small-fonts-slight.conf root # eselect fontconfig enable 21-hinting-small-aquabase-slight.conf root # eselect fontconfig enable 21-hinting-small-browallia-slight.conf root # eselect fontconfig enable 22-hinting-courier-italic-slight.conf root # eselect fontconfig enable 25-hinting-small-arial-black-slight.conf
OSX configuration
Same as default configuration except:
root # eselect fontconfig disable 10-autohint.conf root # eselect fontconfig disable 10-hinting.conf root # eselect fontconfig disable 10-hinting-slight.conf root # eselect fontconfig enable 10-unhinted.conf root # eselect fontconfig enable 15-hinting-tt-instructed-none.conf
Freetype
Freetype can be configured through environment variables (see /etc/env.d/99lcdfilter
for a list of the variables and their description). Those variables can be overridden on a per-user basis by either redefining them in a startup file (such as ~/.bash_profile
) or by sourcing the /usr/lib/ft-settings.sh
script with the desired style in parameter (you can, of course, source the script from a startup file).
usage:
root # source /usr/lib/ft-settings.sh Possible styles: default - Use default settings. A compromise that should please most people osx - Simulate OSX rendering ubuntu - Simulate UBUNTU rendering linux - Generic Linux style - no snapping or certain other tweaks windows - Simulate Windows rendering vanilla - Just subpixel hinting Infinality styles: classic - Infinality rendering circa 2010. No snapping nudge - CLASSIC with lightly stem snapping and tweaks push - CLASSIC with medium stem snapping and tweaks shove - Full stem snapping and tweaks without sharpening sharpened - Full stem snapping, tweaks, and Windows-style sharpening infinality - Settings used by Infinality
Infinality-Ultimate
A more extensive version of the infinality USE flag is the media-fonts/infinality-ultimate-meta package. This contains the fontconfig-ultimate patches and configuration to give you excellent quality rendering and replacements. This has the advantage of being actively maintained whereas the infinality patchset used by the freetype USE flag is not being updated any more.
When this has been installed you should enable infinality in eselect and disable all others:
root # eselect fontconfig list
root # eselect fontconfig enable [number of infinality]
Then enable one of the "ultimate" presets:
root # eselect infinality list
Then enable the "ultimate" lcdfilter:
root # eselect lcdfilter list
Simple Global Rules
It is possible to achieve good looking fonts without the infinality flag. The infinality patches are not maintained any more but patches are sent upstream from the previous maintainer (who works on fontconfig-ultimate now). Simple global replacement rules can be set up to guarantee that all fonts get a decent replacement.
The following example uses the media-fonts/croscorefonts package as well as a few other some from media-fonts/crosextrafonts (this package is not currently in the funtoo tree but can be installed from the chromiumos overlay). Other fonts can be chosen here as desired but these particular fonts are metrically compatible with MS Fonts and are rendered particularly well.
/etc/fonts/local.conf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>serif</family>
<prefer><family>Tinos</family></prefer>
</alias>
<alias>
<family>sans-serif</family>
<prefer><family>Arimo</family></prefer>
</alias>
<alias>
<family>sans</family>
<prefer><family>Arimo</family></prefer>
</alias>
<alias>
<family>monospace</family>
<prefer><family>Cousine</family></prefer>
</alias>
<match>
<test name="family"><string>Arial</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Arimo</string>
</edit>
</match>
<match>
<test name="family"><string>Helvetica</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Arimo</string>
</edit>
</match>
<match>
<test name="family"><string>Verdana</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Arimo</string>
</edit>
</match>
<match>
<test name="family"><string>Tahoma</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Arimo</string>
</edit>
</match>
<match>
<test name="family"><string>Times New Roman</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Tinos</string>
</edit>
</match>
<match>
<test name="family"><string>Times</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Tinos</string>
</edit>
</match>
<match>
<test name="family"><string>Consolas</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Cousine</string>
</edit>
</match>
<match>
<test name="family"><string>Courier New</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Cousine</string>
</edit>
</match>
<match>
<test name="family"><string>Calibri</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Carlito</string>
</edit>
</match>
<match>
<test name="family"><string>Cambria</string></test>
<edit name="family" mode="assign" binding="strong">
<string>Caladea</string>
</edit>
</match>
</fontconfig>
Then enable the local.conf with
root # eselect fontconfig list
and then
root # eselect fontconfig enable *number*
Ugly Helvetica
Using infinality will not protect you from the ugly replacement for Helvetica, which is installed by media-fonts/font-adobe-100dpi
and media-fonts/font-adobe-75dpi
. This font is represented by files like /usr/share/fonts/100dpi/helvR12-ISO8859-1.pcf.gz
and is immune to hinting; since the package media-fonts/font-adobe-100dpi
is a dependency of x11-base/xorg-x11
and since a lot of websites are using Helvetica, you will see this very ugly, not-hinted fonts on those.
However, this can be avoided by using package.provided
which tells portage not to update a particular package:
root # mkdir -p /etc/portage/profile root # echo "media-fonts/font-adobe-100dpi-1.0.3" >> /etc/portage/profile/package.provided root # echo "media-fonts/font-adobe-75dpi-1.0.3" >> /etc/portage/profile/package.provided root # emerge -C media-fonts/font-adobe-100dpi root # emerge -C media-fonts/font-adobe-75dpi
After unmerging these packages you will need to restart applications like Firefox; then, the system should pickup sensible replacements for Helvetica such as *Liberation* which are defined in fontconfig by default.
On a User Level
If you prefer to set this one a user level you could enable the user.conf in eselect instead of the local.conf and then do
user $ cp /etc/fonts/local.conf ~/.config/fontconfig/fonts.conf
LibXft
It can be configured on a per-user basis in the ~/.Xresources
or ~/.Xdefaults
files:
~/.Xdefaults
Xft.antialias: 1
Xft.autohint: 0
Xft.dpi: 96
Xft.hinting: 1
Xft.hintstyle: hintfull
Xft.lcdfilter: lcddefault
Xft.rgba: rgb
~/.Xdefaults
is deprecated and ~/.Xresources
is recommended for usage in configuration.