Difference between revisions of "Fonts"

From ArchWiki
Jump to: navigation, search
(Font formats: Add sub title.)
(update HOOKS with 'block' in Console Fonts example)
(33 intermediate revisions by 23 users not shown)
Line 2: Line 2:
 
[[Category:Graphics and desktop publishing]]
 
[[Category:Graphics and desktop publishing]]
 
[[cs:Fonts]]
 
[[cs:Fonts]]
 +
[[de:Schriftarten]]
 
[[es:Fonts]]
 
[[es:Fonts]]
 
[[it:Fonts]]
 
[[it:Fonts]]
 +
[[ja:Fonts]]
 
[[ru:Fonts]]
 
[[ru:Fonts]]
 
[[tr:Yazıtipleri]]
 
[[tr:Yazıtipleri]]
Line 24: Line 26:
  
 
Most computer fonts used today are in either ''bitmap'' or ''outline'' data formats.  
 
Most computer fonts used today are in either ''bitmap'' or ''outline'' data formats.  
;Bitmap fonts:Store fixed images for each glyph in each typeface and point size.  
+
;Bitmap fonts: Consist of a matrix of dots or pixels representing the image of each glyph in each face and size.
;Outline or ''vector'' fonts: Store characters as instructions for drawing each glyph's lines and curves. Outline fonts scale smoothly in size over a wide range.
+
;Outline or ''vector'' fonts: Use Bézier curves, drawing instructions and mathematical formulae to describe each glyph, which make the character outlines scalable to any size.
  
 
=== Common extensions ===
 
=== Common extensions ===
Line 96: Line 98:
  
 
post_upgrade() {
 
post_upgrade() {
 +
  post_install
 +
}
 +
 +
post_remove() {
 
   post_install
 
   post_install
 
}
 
}
Line 106: Line 112:
 
To install fonts system-wide (available for all users), move the folder to the {{ic|/usr/share/fonts/}} directory.  To install fonts for only a single user, use {{ic|~/.fonts/}} instead.
 
To install fonts system-wide (available for all users), move the folder to the {{ic|/usr/share/fonts/}} directory.  To install fonts for only a single user, use {{ic|~/.fonts/}} instead.
  
Also you may need to update {{ic|/etc/X11/xorg.conf}} or {{ic|/etc/xorg.conf}} with the new directory. Search for {{ic|FontPath}} to find the correct location within the file to add your new path. See [[#Fonts with Xorg]] for more detail.
+
Also you may need to update {{ic|/etc/X11/xorg.conf}} or {{ic|/etc/xorg.conf}} with the new directory. Search for {{ic|FontPath}} to find the correct location within the file to add your new path. See [[#Fonts with X.Org]] for more detail.
  
 
Then update the fontconfig font cache:
 
Then update the fontconfig font cache:
Line 133: Line 139:
  
 
=== Pango Warnings ===
 
=== Pango Warnings ===
When [http://www.pango.org/ Pango] is in use on your system it will read from [http://fontconfig.org/wiki/ fontconfig] to sort out where to source fonts.
+
When [http://www.pango.org/ Pango] is in use on your system it will read from [http://www.freedesktop.org/wiki/Software/fontconfig fontconfig] to sort out where to source fonts.
  
 
  (process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common'
 
  (process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common'
Line 178: Line 184:
 
==Font packages==
 
==Font packages==
 
This is a selective list that includes many font packages from the [[AUR]] along with those in the official repositories. Fonts are tagged "Unicode" if they have wide Unicode support, see the project or Wikipedia pages for detail.
 
This is a selective list that includes many font packages from the [[AUR]] along with those in the official repositories. Fonts are tagged "Unicode" if they have wide Unicode support, see the project or Wikipedia pages for detail.
 +
 +
Github user Ternstor has created a python script that generates PNG images of all fonts in [http://ternstor.github.com/archfonts/extra.html extra], [http://ternstor.github.com/archfonts/community.html community] and the [http://ternstor.github.com/archfonts/aur.html AUR] so you can preview all the fonts below.
  
 
===Braille===
 
===Braille===
Line 196: Line 204:
 
=====(Mainly) Chinese=====
 
=====(Mainly) Chinese=====
 
*{{AUR|ttf-tw}} - Kai and Song traditional Chinese font from the Ministry of Education of Taiwan ''(AUR)''.
 
*{{AUR|ttf-tw}} - Kai and Song traditional Chinese font from the Ministry of Education of Taiwan ''(AUR)''.
*{{AUR|wqy-microhei}} - A Sans-Serif style high quality CJK outline font. ''(AUR)''
+
*{{Pkg|wqy-microhei}} - A Sans-Serif style high quality CJKV outline font.
 
*{{Pkg|wqy-zenhei}} - Hei Ti Style (sans-serif) Chinese Outline font embedded with bitmapped Song Ti (also supporting Japanese (partial) and Korean characters).
 
*{{Pkg|wqy-zenhei}} - Hei Ti Style (sans-serif) Chinese Outline font embedded with bitmapped Song Ti (also supporting Japanese (partial) and Korean characters).
 
*{{Pkg|ttf-arphic-ukai}} - ''Kaiti'' (brush stroke) Unicode font (enabling anti-aliasing is suggested)
 
*{{Pkg|ttf-arphic-ukai}} - ''Kaiti'' (brush stroke) Unicode font (enabling anti-aliasing is suggested)
Line 205: Line 213:
  
 
=====Japanese=====
 
=====Japanese=====
*{{AUR|otf-ipafont}} - Formal style Japanese Gothic (san-serif) and Mincho (serif) fonts set; one of the highest quality open source font. Default of openSUSE-ja. ''(AUR)''
+
*{{AUR|otf-ipafont}} - Formal style Japanese Gothic (sans-serif) and Mincho (serif) fonts set; one of the highest quality open source font. Default of openSUSE-ja. ''(AUR)''
 
*{{AUR|ttf-vlgothic}} - Japanese Gothic fonts. Default of Debian/Fedora/Vine Linux ''(AUR)''
 
*{{AUR|ttf-vlgothic}} - Japanese Gothic fonts. Default of Debian/Fedora/Vine Linux ''(AUR)''
*{{AUR|ttf-mplus}} - Modern Gothic style Japanese outline fonts. It includes all of Japanese Hiragana/Katakana, Basic Latin, Latin-1 Supplement, Latin Extended-A, IPA Extensions and most of Japanese Kanji, Greek, Cyrillic, Vietnamese with 7 weights (proportional) or 5 weights (monospace).
+
*{{AUR|ttf-mplus}} - Modern Gothic style Japanese outline fonts. It includes all of Japanese Hiragana/Katakana, Basic Latin, Latin-1 Supplement, Latin Extended-A, IPA Extensions and most of Japanese Kanji, Greek, Cyrillic, Vietnamese with 7 weights (proportional) or 5 weights (monospace). ''(AUR)''
 
*{{AUR|ttf-ipa-mona}}, {{AUR|ttf-monapo}} - Japanese fonts to show [http://en.wikipedia.org/wiki/2channel_Shift_JIS_art 2channel Shift JIS art] properly. ''(AUR)''
 
*{{AUR|ttf-ipa-mona}}, {{AUR|ttf-monapo}} - Japanese fonts to show [http://en.wikipedia.org/wiki/2channel_Shift_JIS_art 2channel Shift JIS art] properly. ''(AUR)''
*{{Pkg|ttf-sazanami}} - Japanese free TrueType font. This is outdated and not maintained any more, but may be defined as a fallback font on several environment.
+
*{{Pkg|ttf-sazanami}} - Japanese free TrueType font. This is outdated and not maintained any more, but may be defined as a fallback font on several environments.
  
 
=====Korean=====
 
=====Korean=====
Line 229: Line 237:
  
 
====Hebrew====
 
====Hebrew====
*{{AUR|culmus}} - Nice collection of free Hebrew fonts
+
*{{AUR|culmus}} - Nice collection of free Hebrew fonts ''(AUR)''
  
 
====Indic====
 
====Indic====
Line 247: Line 255:
 
*{{AUR|ttf-tamil}} - Tamil Unicode fonts (''AUR'')
 
*{{AUR|ttf-tamil}} - Tamil Unicode fonts (''AUR'')
  
====Thai====
 
*{{Pkg|ttf-thai}} - Font covering glyphs for Thai
 
 
====Tibetan====
 
====Tibetan====
 
*{{Pkg|ttf-tibetan-machine}} - Tibetan Machine TTFont
 
*{{Pkg|ttf-tibetan-machine}} - Tibetan Machine TTFont
Line 259: Line 265:
 
===Microsoft fonts===
 
===Microsoft fonts===
 
See [[MS Fonts]].
 
See [[MS Fonts]].
 +
 +
===Apple Mac OS X fonts===
 +
*{{AUR|ttf-mac}} - Mac OS X TrueType fonts. ''(AUR)''
  
 
===Monospaced===
 
===Monospaced===
Line 267: Line 276:
  
 
====TrueType====
 
====TrueType====
*[[Wikipedia:Andalé Mono|Andalé Mono]] ({{AUR|ttf-ms-fonts}})
+
* [[Wikipedia:Andalé Mono|Andalé Mono]] ({{AUR|ttf-ms-fonts}})
*Anka/Coder ({{AUR|ttf-anka-coder}})
+
* Anka/Coder ({{AUR|ttf-anka-coder}})
*Anonymous Pro ({{AUR|ttf-anonymous-pro}}, included in {{AUR|ttf-google-webfonts}})
+
* Anonymous Pro ({{AUR|ttf-anonymous-pro}}, included in {{AUR|ttf-google-webfonts}})
*[[Wikipedia:Bitstream Vera|Bitstream Vera Mono]] ({{Pkg|ttf-bitstream-vera}})
+
* [[Wikipedia:Bitstream Vera|Bitstream Vera Mono]] ({{Pkg|ttf-bitstream-vera}})
*[[Wikipedia:Consolas|Consolas]] ({{AUR|ttf-vista-fonts}})
+
* [[Wikipedia:Consolas|Consolas]] ({{AUR|ttf-vista-fonts}})
*[[Wikipedia:Courier New|Courier New]] ({{AUR|ttf-ms-fonts}})
+
* [[Wikipedia:Courier New|Courier New]] ({{AUR|ttf-ms-fonts}})
*Cousine ({{AUR|ttf-google-webfonts}}) - Chrome/Chromium OS replacement for Courier New (metric-compatible)
+
* Cousine ({{AUR|ttf-google-webfonts}}) - Chrome/Chromium OS replacement for Courier New (metric-compatible)
*[[Wikipedia:DejaVu fonts|DejaVu Sans Mono]] ({{Pkg|ttf-dejavu}}) - Unicode
+
* [[Wikipedia:DejaVu fonts|DejaVu Sans Mono]] ({{Pkg|ttf-dejavu}}) - Unicode
*[[Wikipedia:Droid (font)|Droid Sans Mono]] ({{Pkg|ttf-droid}}, included in {{AUR|ttf-google-webfonts}})
+
* [[Wikipedia:Droid (font)|Droid Sans Mono]] ({{Pkg|ttf-droid}}, included in {{AUR|ttf-google-webfonts}})
*Envy Code R ({{AUR|ttf-envy-code-r}})
+
* Envy Code R ({{AUR|ttf-envy-code-r}})
*[[Wikipedia:GNU FreeFont|FreeMono]] ({{Pkg|ttf-freefont}}) - Unicode
+
* [[Wikipedia:GNU FreeFont|FreeMono]] ({{Pkg|ttf-freefont}}) - Unicode
*[[Wikipedia:Inconsolata|Inconsolata]] ({{Pkg|ttf-inconsolata}})
+
* [[Wikipedia:Inconsolata|Inconsolata]] ({{Pkg|ttf-inconsolata}})
*[[Wikipedia:Inconsolata|Inconsolata-g]] ({{AUR|ttf-inconsolata-g}}) - adds some programmer-friendly modifications
+
* [[Wikipedia:Inconsolata|Inconsolata-g]] ({{AUR|ttf-inconsolata-g}}) - adds some programmer-friendly modifications
*[[Wikipedia:Liberation fonts|Liberation Mono]] ({{Pkg|ttf-liberation}}) - Alternative to Courier New (metric-compatible)
+
* [[Wikipedia:Liberation fonts|Liberation Mono]] ({{Pkg|ttf-liberation}}) - Alternative to Courier New (metric-compatible)
*[[Wikipedia:Lucida Console|Lucida Console]] ({{AUR|ttf-ms-fonts}})
+
* [[Wikipedia:Lucida Console|Lucida Console]] ({{AUR|ttf-ms-fonts}})
*[[Wikipedia:Lucida Typewriter|Lucida Typewriter]] (included in package {{Pkg|jre}})
+
* [[Wikipedia:Lucida Typewriter|Lucida Typewriter]] (included in package {{Pkg|jre}})
*[[Wikipedia:Monaco (typeface)|Monaco]] ({{Pkg|monaco-linux-font}})
+
* [[Wikipedia:Monaco (typeface)|Monaco]] ({{Pkg|monaco-linux-font}})
*Monofur ({{AUR|ttf-monofur}})
+
* Monofur ({{AUR|ttf-monofur}})
  
 
====Bitmap====
 
====Bitmap====
 
*Default 8x16
 
*Default 8x16
 
*Dina ({{Pkg|dina-font}})
 
*Dina ({{Pkg|dina-font}})
 +
*[http://font.gohu.org/ Gohu] ({{Pkg|gohu-font}})
 
*Lime ({{Pkg|artwiz-fonts}})
 
*Lime ({{Pkg|artwiz-fonts}})
 
*[[Wikipedia:ProFont|ProFont]] ({{Pkg|profont}})
 
*[[Wikipedia:ProFont|ProFont]] ({{Pkg|profont}})
 
*[[Wikipedia:Proggy Programming Fonts|Proggy Programming Fonts]] ({{AUR|proggyfonts}})
 
*[[Wikipedia:Proggy Programming Fonts|Proggy Programming Fonts]] ({{AUR|proggyfonts}})
 
*Proggy opti cyrillic ({{AUR|proggyopticyr-font}})
 
*Proggy opti cyrillic ({{AUR|proggyopticyr-font}})
*Tamsyn ({{AUR|tamsyn-font}})
+
*Tamsyn ({{Pkg|tamsyn-font}})
 
*[[Wikipedia:Terminus (typeface)|Terminus]] ({{Pkg|terminus-font}})
 
*[[Wikipedia:Terminus (typeface)|Terminus]] ({{Pkg|terminus-font}})
 
*Unifont (glyphs like (look of disapproval)) ({{Pkg|bdf-unifont}})
 
*Unifont (glyphs like (look of disapproval)) ({{Pkg|bdf-unifont}})
Line 343: Line 353:
 
===Unsorted===
 
===Unsorted===
 
<!--This section should be absorbed into the Monospace/Serif/Sans-Serif structure-->
 
<!--This section should be absorbed into the Monospace/Serif/Sans-Serif structure-->
*{{AUR|ttf-google-webfonts}} - a huge collection of free fonts (including ubuntu, inconsolata, droid, etc.) - Note: Your font dialog might get very long as >100 fonts will be added
+
*{{AUR|ttf-google-webfonts}} and {{AUR|ttf-google-webfonts-hg}} — a huge collection of free fonts (including ubuntu, inconsolata, droid, etc.) - Note: Your font dialog might get very long as >100 fonts will be added ''(AUR)''
*{{Pkg|ttf-mph-2b-damase}} - Covers full plane 1 and several scripts
+
*{{Pkg|ttf-mph-2b-damase}} Covers full plane 1 and several scripts
*{{AUR|ttf-symbola}} - Provides emoji and many many other symbols.
+
*{{AUR|ttf-symbola}} Provides emoji and many many other symbols. ''(AUR)''
*{{AUR|ttf-sil-fonts}} - Gentium, Charis, Doulos, Andika and Abyssinica from SIL ''(AUR)''
+
*{{AUR|ttf-sil-fonts}} Gentium, Charis, Doulos, Andika and Abyssinica from SIL ''(AUR)''
*{{Pkg|font-bh-ttf}} - X.Org Luxi fonts
+
*{{Pkg|font-bh-ttf}} X.Org Luxi fonts
*{{Pkg|ttf-cheapskate}} - Font collection from ''dustismo.com''
+
*{{Pkg|ttf-cheapskate}} Font collection from ''dustismo.com''
*{{Pkg|ttf-isabella}} - Calligraphic font based on the ''Isabella Breviary'' of 1497
+
*{{Pkg|ttf-isabella}} Calligraphic font based on the ''Isabella Breviary'' of 1497
*{{Pkg|ttf-junicode}} - Junius font containing almost complete medieval latin script glyphs
+
*{{Pkg|ttf-junicode}} Junius font containing almost complete medieval latin script glyphs
*arkpandorafonts {{AUR|ttf-arkpandora}} — Alternative to Arial and Times New Roman fonts
+
*arkpandorafonts {{AUR|ttf-arkpandora}} — Alternative to Arial and Times New Roman fonts ''(AUR)''
 
*{{Pkg|xorg-fonts-type1}} — IBM Courier and Adobe Utopia sets of [[Wikipedia:PostScript fonts|PostScript fonts]]
 
*{{Pkg|xorg-fonts-type1}} — IBM Courier and Adobe Utopia sets of [[Wikipedia:PostScript fonts|PostScript fonts]]
  
 
==Console fonts==
 
==Console fonts==
  
The console, meaning a terminal running with no ''X'' Window System, uses the ASCII character set as the default. This font and the keymap used are easily changed.
+
The console, meaning a terminal running with no X Window System, uses the ASCII character set as the default. This font and the keymap used are easily changed.
  
 
A console font is limited to either 256 or 512 characters. The fonts are found in {{ic|/usr/share/kbd/consolefonts/}}.
 
A console font is limited to either 256 or 512 characters. The fonts are found in {{ic|/usr/share/kbd/consolefonts/}}.
  
''Keymaps, ''the connection between the key pressed and the character used by the computer, are found in the subdirectories of {{ic|/usr/share/kbd/keymaps/}}.
+
Keymaps, the connection between the key pressed and the character used by the computer, are found in the subdirectories of {{ic|/usr/share/kbd/keymaps/}}.
  
 
=== Previewing and testing ===
 
=== Previewing and testing ===
Line 366: Line 376:
 
An organized library of images for previewing is available at http://alexandre.deverteuil.net/consolefonts/consolefonts.html.
 
An organized library of images for previewing is available at http://alexandre.deverteuil.net/consolefonts/consolefonts.html.
  
Moreover, the user can use {{ic|setfont}} to temporarily change the font and be able to consider its use as the default. The available ''glyphs ''or letters in the font can also be viewed as a table with the command {{ic|showconsolefont}}.
+
Moreover, the user can use {{ic|setfont}} to temporarily change the font and be able to consider its use as the default. The available glyphs, or letters in the font can also be viewed as a table with the command {{ic|showconsolefont}}.
  
 
If the newly changed font is not suitable, a return to the default font is done by issuing the command {{ic|setfont}} without any arguments. If the console display is totally unreadable, this command will still work—the user just types in {{ic|setfont}} while "working blind."
 
If the newly changed font is not suitable, a return to the default font is done by issuing the command {{ic|setfont}} without any arguments. If the console display is totally unreadable, this command will still work—the user just types in {{ic|setfont}} while "working blind."
Line 391: Line 401:
 
==== Examples ====
 
==== Examples ====
 
For displaying characters such as ''Č, ž, đ, š'' or ''Ł, ę, ą, ś'' using the font {{ic|lat2-16.psfu.gz}}:
 
For displaying characters such as ''Č, ž, đ, š'' or ''Ł, ę, ą, ś'' using the font {{ic|lat2-16.psfu.gz}}:
  CONSOLEFONT="lat2-16"
+
  FONT=lat2-16
 
It means that second part of ISO/IEC 8859 characters are used with size 16. You can change font size using other values like lat2-08...16. For the regions determined by 8859 specification, look at the [http://en.wikipedia.org/wiki/ISO/IEC_8859#The_Parts_of_ISO.2FIEC_8859 Wikipedia]. You can use a Terminus font which is recommended if you work a lot in console without X server. ter-216b for example is latin-2 part, size 16, bold. ter-216n is the same but normal weight. Terminus fonts have sizes up to 32.
 
It means that second part of ISO/IEC 8859 characters are used with size 16. You can change font size using other values like lat2-08...16. For the regions determined by 8859 specification, look at the [http://en.wikipedia.org/wiki/ISO/IEC_8859#The_Parts_of_ISO.2FIEC_8859 Wikipedia]. You can use a Terminus font which is recommended if you work a lot in console without X server. ter-216b for example is latin-2 part, size 16, bold. ter-216n is the same but normal weight. Terminus fonts have sizes up to 32.
  
 
Now, set the proper keymap, for lat2-16 it will be:
 
Now, set the proper keymap, for lat2-16 it will be:
  CONSOLEMAP="8859-2"
+
  FONT_MAP=8859-2
  
 
To use the specified font in early userspace, that is, early in the bootup process, add the {{ic|consolefont}} hook to {{ic|/etc/mkinitcpio.conf}}:
 
To use the specified font in early userspace, that is, early in the bootup process, add the {{ic|consolefont}} hook to {{ic|/etc/mkinitcpio.conf}}:
  HOOKS="base udev autodetect pata scsi sata filesystems '''consolefont''' '''keymap'''"
+
  HOOKS="base udev autodetect modconf block filesystems usbinput fsck '''consolefont''' '''keymap'''"
  
 
Then rebuild the image:
 
Then rebuild the image:
Line 406: Line 416:
  
 
See [[Mkinitcpio#HOOKS]] for more information.
 
See [[Mkinitcpio#HOOKS]] for more information.
 +
 +
If the fonts seems to not change on boot, or change only temporarily, it is most likely that they got reset when graphics driver was initialized and console was switched to framebuffer. To avoid this, load your graphics driver earlier. See for example [[KMS#Early_KMS_start]] or other ways to setup your framebuffer before {{ic|/etc/vconsole.conf}} gets applied.
  
 
==== Boot Error ====
 
==== Boot Error ====
Line 416: Line 428:
 
Fontconfig automatically chooses a font that matches the current requirement. That is to say, if one is looking at a window containing English and Chinese for example, it will switch to another font for the Chinese text if the default one doesn't support it.
 
Fontconfig automatically chooses a font that matches the current requirement. That is to say, if one is looking at a window containing English and Chinese for example, it will switch to another font for the Chinese text if the default one doesn't support it.
  
Fontconfig lets every user configure the order they want via {{ic|~/.fonts.conf}}.
+
Fontconfig lets every user configure the order they want via {{ic|$XDG_CONFIG_HOME/fontconfig/fonts.conf}}.
 
If you want a particular Chinese font to be selected after your favorite Serif font, your file would look like this:
 
If you want a particular Chinese font to be selected after your favorite Serif font, your file would look like this:
  <?xml version="1.0"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+
  <?xml version="1.0"?>
 +
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
 
  <fontconfig>
 
  <fontconfig>
 
  <alias>
 
  <alias>
Line 432: Line 445:
  
 
== Font alias ==
 
== Font alias ==
In Linux there are several fonts that are aliases to other fonts so that programs will be using similar fonts. The most common ones are {{ic|sans}} for a font of the sans type, {{ic|sans-serif}} for a font of the sans-serif type and {{ic|monospace}} for a monospaced font. However which fonts these are aliased to may vary and often doesn't show in font management tools like those found in KDE and other desktop environments.
+
In Linux there are several font aliases which represent other fonts in order that applications may use similar fonts. The most common aliases are: {{ic|serif}} for a font of the serif type (e.g. DejaVu Serif); {{ic|sans-serif}} for a font of the sans-serif type (e.g. DejaVu Sans); and {{ic|monospace}} for a monospaced font (e.g. DejaVu Sans Mono). However, the fonts which these aliases represent may vary and the relationship is often not shown in font management tools such as those found in KDE and other desktop environments.
  
To reverse the alias and find which fonts the aliases are representing run:
+
To reverse an alias and find which font it is representing, run:
  fc-match monospace
+
  $ fc-match monospace
  VeraMono.ttf: "Bitstream Vera Sans Mono" "Roman"
+
  DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
  
In this case VeraMono.ttf is the font the monospace alias is representing.
+
In this case {{ic|DejaVuSansMono.ttf}} is the font represented by the monospace alias.

Revision as of 00:39, 4 January 2013

From Wikipedia:

A computer font (or font) is an electronic data file containing a set of glyphs, characters, or symbols such as dingbats.

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary text Template:Article summary heading Template:Article summary wiki: Font setup and beautification Template:Article summary wiki: Fonts specific to Sun's Java machine Template:Article summary wiki: Adding Microsoft fonts and mimicking Windows' font settings Template:Article summary end

Font formats

Most computer fonts used today are in either bitmap or outline data formats.

Bitmap fonts
Consist of a matrix of dots or pixels representing the image of each glyph in each face and size.
Outline or vector fonts
Use Bézier curves, drawing instructions and mathematical formulae to describe each glyph, which make the character outlines scalable to any size.

Common extensions

  • bdf and bdf.gz – bitmap fonts, bitmap distribution format and gzip compressed bdf
  • pcf and pcf.gz – bitmaps, portable compiled font and gzip compressed pcf
  • psf, psfu, psf.gz and psfu.gz – bitmaps, PC screen font, PC screen font Unicode and the gzipped versions (not compatible with X.Org)
  • pfa and pfb – outline fonts, PostScript font ASCII and PostScript font binary. PostScript fonts carry built-in printer instructions.
  • ttf – outline, TrueType font. Originally designed as a replacement for the PostScript fonts.
  • otf – outline, OpenType font. TrueType with PostScript typographic instructions.

For most purposes, the technical differences between TrueType and OpenType can be ignored, some fonts with a ttf extension are actually OpenType fonts.

Other formats

The typesetting application, TeX, and its companion font software, Metafont, render characters using their own methods. Some of the file extensions used for fonts by these two programs are *pk, *gf, mf and vf.

FontForge, a font editing application, can store fonts in its native text-based format, sfd, spline font database.

The SVG format also has its own font description method.

Installation

There are various methods for installing fonts.

Pacman

Fonts and font collections in the enabled repositories can be installed using pacman. Available fonts may be found by using:

$ pacman -Ss font

Or to search for ttf fonts only:

$ pacman -Ss ttf

Some fonts like terminus are installed in /usr/share/fonts/local, which is not added to the font path by default. By adding the following lines to ~/.xinitrc the fonts can be used in X11:

xset +fp /usr/share/fonts/local
xset fp rehash

Creating a package

If you want to give pacman the ability to manage your fonts, you can create an Arch package. These can also be shared with the community in the AUR. Here is an example of how to create a basic package. To learn more about building packages, read PKGBUILD.

pkgname=ttf-fontname
pkgver=1.0
pkgrel=1
depends=('fontconfig' 'xorg-font-utils')
pkgdesc="custom fonts"
arch=('any')
source=(http://someurl.org/$pkgname.tar.bz2)
install=$pkgname.install

build()
{
  mkdir -p $pkgdir/usr/share/fonts/TTF
  cp $srcdir/$pkgname/*.ttf $pkgdir/usr/share/fonts/TTF
}

This PKGBUILD assumes the fonts are TrueType. An install file (ttf-fontname.install) will also need to be created to update the font cache:

post_install() {
  echo -n "Updating font cache... "
  fc-cache -fs >/dev/null
  mkfontscale /usr/share/fonts/TTF /usr/share/fonts/Type1
  mkfontdir /usr/share/fonts/TTF /usr/share/fonts/Type1
  echo "done"
}

post_upgrade() {
  post_install
}

post_remove() {
  post_install
}

Manual installation

The recommended way of adding fonts that are not in the repositories to your system is described in #Creating a package. This gives pacman the ability to remove or update them at a later time. Fonts can alternately be installed manually as well.

To install fonts system-wide (available for all users), move the folder to the /usr/share/fonts/ directory. To install fonts for only a single user, use ~/.fonts/ instead.

Also you may need to update /etc/X11/xorg.conf or /etc/xorg.conf with the new directory. Search for FontPath to find the correct location within the file to add your new path. See #Fonts with X.Org for more detail.

Then update the fontconfig font cache:

$ fc-cache -vf

Older applications

With older applications that do not support fontconfig (e.g. GTK+ 1.x applications, and xfontsel) the index will need to be created in the font directory:

$ mkfontscale
$ mkfontdir

Or to include more than one folder with one command:

$ for dir in /font/dir1/ /font/dir2/; do xset +fp $dir; done && xset fp rehash

At times the X server may fail to load the fonts directory and you will need to rescan all the fonts.dir files:

# xset +fp /usr/share/fonts/misc # Inform the X server of new directories
# xset fp rehash                # Forces a new rescan

To check that the font(s) is included:

$ xlsfonts | grep fontname

Pango Warnings

When Pango is in use on your system it will read from fontconfig to sort out where to source fonts.

(process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common'
(process:5741): Pango-WARNING **: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin'

If you are seeing errors similar to this and/or seeing blocks instead of characters in your application then you need to add fonts and update the font cache. This example uses the ttf-liberation fonts to illustrate the solution and runs as root to enable them system-wide.

# pacman -S ttf-liberation
  -- output abbreviated, assumes installation succeeded -- 

# fc-cache -vfs
/usr/share/fonts: caching, new cache contents: 0 fonts, 3 dirs
/usr/share/fonts/TTF: caching, new cache contents: 16 fonts, 0 dirs
/usr/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs
/var/cache/fontconfig: cleaning cache directory   
fc-cache: succeeded

You can test for a default font being set like so:

# fc-match
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"

Fonts with X.Org

In order for Xorg to find and use your newly installed fonts, you must add the font paths to /etc/X11/xorg.conf (another X.Org configuration file may work too).

Here is an example of the section that must be added to /etc/X11/xorg.conf. Add or remove paths based on your particular font requirements.

# Let X.Org know about the custom font directories
Section "Files"
    FontPath    "/usr/share/fonts/100dpi"
    FontPath    "/usr/share/fonts/75dpi"
    FontPath    "/usr/share/fonts/cantarell"
    FontPath    "/usr/share/fonts/cyrillic"
    FontPath    "/usr/share/fonts/encodings"
    FontPath    "/usr/share/fonts/local"
    FontPath    "/usr/share/fonts/misc"
    FontPath    "/usr/share/fonts/truetype"
    FontPath    "/usr/share/fonts/TTF"
    FontPath    "/usr/share/fonts/util"
EndSection

Font packages

This is a selective list that includes many font packages from the AUR along with those in the official repositories. Fonts are tagged "Unicode" if they have wide Unicode support, see the project or Wikipedia pages for detail.

Github user Ternstor has created a python script that generates PNG images of all fonts in extra, community and the AUR so you can preview all the fonts below.

Braille

International users

Arabic

Birman

Chinese, Japanese, Korean, Vietnamese

(Mainly) Chinese
  • ttf-twAUR - Kai and Song traditional Chinese font from the Ministry of Education of Taiwan (AUR).
  • wqy-microhei - A Sans-Serif style high quality CJKV outline font.
  • wqy-zenhei - Hei Ti Style (sans-serif) Chinese Outline font embedded with bitmapped Song Ti (also supporting Japanese (partial) and Korean characters).
  • ttf-arphic-ukai - Kaiti (brush stroke) Unicode font (enabling anti-aliasing is suggested)
  • ttf-arphic-uming - Mingti (printed) Unicode font
  • opendesktop-fonts - New Sung font, previously is ttf-fireflysung package
  • wqy-bitmapfont - Bitmapped Song Ti (serif) Chinese font
  • ttf-hannom - Chinese and Vietnamese TrueType font
Japanese
  • otf-ipafontAUR - Formal style Japanese Gothic (sans-serif) and Mincho (serif) fonts set; one of the highest quality open source font. Default of openSUSE-ja. (AUR)
  • ttf-vlgothicAUR - Japanese Gothic fonts. Default of Debian/Fedora/Vine Linux (AUR)
  • ttf-mplusAUR - Modern Gothic style Japanese outline fonts. It includes all of Japanese Hiragana/Katakana, Basic Latin, Latin-1 Supplement, Latin Extended-A, IPA Extensions and most of Japanese Kanji, Greek, Cyrillic, Vietnamese with 7 weights (proportional) or 5 weights (monospace). (AUR)
  • ttf-ipa-monaAUR, ttf-monapoAUR - Japanese fonts to show 2channel Shift JIS art properly. (AUR)
  • ttf-sazanami - Japanese free TrueType font. This is outdated and not maintained any more, but may be defined as a fallback font on several environments.
Korean

Cyrillic

Also see #Monospace, #Sans and #Serif

Greek

Almost all Unicode fonts contain the Greek character set (polytonic included). Some additional font packages, which might not contain the complete Unicode set but utilize high quality Greek (and Latin, of course) typefaces are:

  • otf-gfsAUR - Selection of OpenType fonts from the Greek Font Society (AUR)
  • ttf-mgopenAUR - Professional TrueType fonts from Magenta (AUR)

Hebrew

  • culmusAUR - Nice collection of free Hebrew fonts (AUR)

Indic

(This one contains a "look of disapproval" that might be more to your liking than the bdf-unifont one mentioned elsewhere in this document)
  • lohit-font - Indic TrueType fonts from Fedora Project (containing Oriya Fonts and more) (AUR)

Khmer

Sinhala

Tamil

Tibetan

Math

Microsoft fonts

See MS Fonts.

Apple Mac OS X fonts

  • ttf-macAUR - Mac OS X TrueType fonts. (AUR)

Monospaced

Here are some suggestions. Every user has their own favorite, so experiment to find yours. If you're in a hurry, you read Dan Benjamin's blog post: Top 10 Programming Fonts.

Here's a long list of fonts by Trevor Lowing: http://www.lowing.org/fonts/.

TrueType

Bitmap

Sans-serif

Script

Serif

Unsorted

Console fonts

The console, meaning a terminal running with no X Window System, uses the ASCII character set as the default. This font and the keymap used are easily changed.

A console font is limited to either 256 or 512 characters. The fonts are found in /usr/share/kbd/consolefonts/.

Keymaps, the connection between the key pressed and the character used by the computer, are found in the subdirectories of /usr/share/kbd/keymaps/.

Previewing and testing

An organized library of images for previewing is available at http://alexandre.deverteuil.net/consolefonts/consolefonts.html.

Moreover, the user can use setfont to temporarily change the font and be able to consider its use as the default. The available glyphs, or letters in the font can also be viewed as a table with the command showconsolefont.

If the newly changed font is not suitable, a return to the default font is done by issuing the command setfont without any arguments. If the console display is totally unreadable, this command will still work—the user just types in setfont while "working blind."

Note that setfont only works on the console currently being used. Any other consoles, active or inactive, remain unaffected.

Examples

Change the font. This example is distinctive:

$ setfont /usr/share/kbd/consolefonts/gr737b-9x16-medieval.psfu.gz

Or change the font to one with 512 glyphs and set the keymap to ISO 8859-5 using the -m option:

$ setfont /usr/share/kbd/consolefonts/LatArCyrHeb-16.psfu.gz -m 8859-5

Then issue commands that send text to the display, perhaps view a manpage and try vi or nano, and view the table of glyphs with the command, showconsolefont.

Return to the default font with:

$ setfont

Changing the default font

To change the default font, the FONT= and FONT_MAP= settings in /etc/vconsole.conf (this file may need to be created) must be altered. Again, the fonts can be found in /usr/share/kbd/consolefonts/ directory and keymaps can be found in the subdirectories of /usr/share/kbd/keymaps/.

Examples

For displaying characters such as Č, ž, đ, š or Ł, ę, ą, ś using the font lat2-16.psfu.gz:

FONT=lat2-16

It means that second part of ISO/IEC 8859 characters are used with size 16. You can change font size using other values like lat2-08...16. For the regions determined by 8859 specification, look at the Wikipedia. You can use a Terminus font which is recommended if you work a lot in console without X server. ter-216b for example is latin-2 part, size 16, bold. ter-216n is the same but normal weight. Terminus fonts have sizes up to 32.

Now, set the proper keymap, for lat2-16 it will be:

FONT_MAP=8859-2

To use the specified font in early userspace, that is, early in the bootup process, add the consolefont hook to /etc/mkinitcpio.conf:

HOOKS="base udev autodetect modconf block filesystems usbinput fsck consolefont keymap"

Then rebuild the image:

# mkinitcpio -p linux
Note: The above steps must be repeated for each kernel if more than one kernel package is installed.

See Mkinitcpio#HOOKS for more information.

If the fonts seems to not change on boot, or change only temporarily, it is most likely that they got reset when graphics driver was initialized and console was switched to framebuffer. To avoid this, load your graphics driver earlier. See for example KMS#Early_KMS_start or other ways to setup your framebuffer before /etc/vconsole.conf gets applied.

Boot Error

If "Loading Console Font" fails at boot time, this is probably because you didn't choose a valid font during your Arch Linux install.

To get rid of this message, simply empty the CONSOLEFONT variable in /etc/rc.conf. It will fallback on default font at boot.

Fallback font order with X11

Fontconfig automatically chooses a font that matches the current requirement. That is to say, if one is looking at a window containing English and Chinese for example, it will switch to another font for the Chinese text if the default one doesn't support it.

Fontconfig lets every user configure the order they want via $XDG_CONFIG_HOME/fontconfig/fonts.conf. If you want a particular Chinese font to be selected after your favorite Serif font, your file would look like this:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
   <family>serif</family>
   <prefer>
     <family>Your favorite Latin Serif font name</family>
     <family>Your Chinese font name</family>
   </prefer>
 </alias>
</fontconfig>

You can add a section for Sans-serif and monospaced as well. For more informations, have a look at the fontconfig manual.

Font alias

In Linux there are several font aliases which represent other fonts in order that applications may use similar fonts. The most common aliases are: serif for a font of the serif type (e.g. DejaVu Serif); sans-serif for a font of the sans-serif type (e.g. DejaVu Sans); and monospace for a monospaced font (e.g. DejaVu Sans Mono). However, the fonts which these aliases represent may vary and the relationship is often not shown in font management tools such as those found in KDE and other desktop environments.

To reverse an alias and find which font it is representing, run:

$ fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"

In this case DejaVuSansMono.ttf is the font represented by the monospace alias.