Difference between revisions of "Fonts"

From ArchWiki
Jump to navigation Jump to search
m (OS X is now called macOS)
(→‎TrueType: libmono - cousine are sisters not mom&son)
Line 402: Line 402:
* [[Wikipedia:Consolas|Consolas]] ({{AUR|ttf-vista-fonts}}) - Windows programming font
* [[Wikipedia:Consolas|Consolas]] ({{AUR|ttf-vista-fonts}}) - Windows programming font
* [[Wikipedia:Courier New|Courier New]] ({{AUR|ttf-ms-fonts}})
* [[Wikipedia:Courier New|Courier New]] ({{AUR|ttf-ms-fonts}})
* Cousine ({{AUR|ttf-chromeos-fonts}} or {{AUR|ttf-google-fonts-git}}) - Chrome/Chromium OS replacement for Courier New (metric-compatible)
* Cousine ({{AUR|ttf-chromeos-fonts}} or {{AUR|ttf-google-fonts-git}}) - 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-fonts-git}})
* [[Wikipedia:Droid (font)|Droid Sans Mono]] ({{Pkg|ttf-droid}}, included in {{AUR|ttf-google-fonts-git}})
Line 410: Line 410:
* [[Wikipedia:Inconsolata|Inconsolata]] ({{Pkg|ttf-inconsolata}}, included in {{AUR|ttf-google-fonts-git}}) - Excellent programming font
* [[Wikipedia:Inconsolata|Inconsolata]] ({{Pkg|ttf-inconsolata}}, included in {{AUR|ttf-google-fonts-git}}) - Excellent programming font
* [[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}}) - Replacement for Courier New, based on Cousine (metric-compatible)
* [[Wikipedia:Liberation fonts|Liberation Mono]] ({{Pkg|ttf-liberation}}) - Replacement for Courier New, shares ancestry with Cousine (metric-compatible)
* [[Wikipedia:Lucida Typewriter|Lucida Typewriter]] (included in package {{AUR|jre}})
* [[Wikipedia:Lucida Typewriter|Lucida Typewriter]] (included in package {{AUR|jre}})
* [[Wikipedia:Monaco (typeface)|Monaco]] ({{AUR|ttf-monaco}}) - Popular programming font on OSX/Textmate
* [[Wikipedia:Monaco (typeface)|Monaco]] ({{AUR|ttf-monaco}}) - Popular programming font on OSX/Textmate

Revision as of 06:56, 8 October 2016

zh-CN:Fonts zh-TW:Fonts

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

Note that certain font licenses may impose some legal limitations.

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.


There are various methods for installing fonts.


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

Creating a package

You should give pacman the ability to manage your fonts, which is done by creating 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.

The family name of a font file can be aquired with the use of fc-query for example: fc-query -f '%{family[0]}\n' /path/to/file. The formatting is described in the FcPatternFormat(3) manual.

pkgdesc="Some description"
depends=(fontconfig xorg-font-utils)

package() {
  install -Dm644 $pkgname/font.otf "$pkgdir"/usr/share/fonts/family_name/font.otf
  install -Dm644 $pkgname/font_bold.otf "$pkgdir"/usr/share/fonts/family_name/font_bold.otf
post_install() {
  fc-cache -s

post_upgrade() {

post_remove() {

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. The files need to be readable by every user, use chmod to set the correct permissions (i.e. at least 0444 for files and 0555 for directories). To install fonts for only a single user, use ~/.local/share/fonts (~/.fonts/ is now deprecated).

For Xserver to load fonts directly (as opposed to the use of a font server) the directory for your newly added font must be added with a FontPath entry. This entry is located in the Files section of your Xorg configuration file (e.g. /etc/X11/xorg.conf or /etc/xorg.conf). See #Older applications for more detail.

Then update the fontconfig font cache: (usually unnecessary as software using the fontconfig library do this.)

$ fc-cache

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

Or if fonts were installed in a different sub-folders under the e.g. /usr/share/fonts:

$ for dir in * ; do if [  -d  "$dir"  ]; then cd "$dir";xset +fp "$PWD" ;mkfontscale; mkfontdir;cd .. ;fi; 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
Note: Many packages will automatically configure Xorg to use the font upon installation. If that is the case with your font, this step is not necessary.

This can also be set globally in /etc/X11/xorg.conf or /etc/X11/xorg.conf.d.

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/misc"
    FontPath    "/usr/share/fonts/truetype"
    FontPath    "/usr/share/fonts/TTF"
    FontPath    "/usr/share/fonts/util"

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 (after successful installation of the package) and runs as root to enable them system-wide.

# fc-cache
/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"

Console fonts

Note: This section is about the Linux console. For alternative console solutions offering more features (full Unicode fonts, modern graphics adapters etc.), see fbterm, KMSCON or similar projects.

By default, the virtual console uses the kernel built-in font with a CP437 character set,[1] but this can be easily changed.

The Linux console uses UTF-8 encoding by default, but because the standard VGA-compatible framebuffer is used, a console font is limited to either a standard 256, or 512 glyphs. If the font has more than 256 glyphs, the number of colours is reduced from 16 to 8. In order to assign correct symbol to be displayed to the given Unicode value, a special translation map, often called unimap, is needed. Nowadays most of the console fonts have the unimap built-in, historically it had to be loaded separately.

The kbd package provides tools to change virtual console font and font mapping. Available fonts are saved in the /usr/share/kbd/consolefonts/ directory, those ending with .psfu or .psfu.gz have a Unicode translation map built-in.

Keymaps, the connection between the key pressed and the character used by the computer, are found in the subdirectories of /usr/share/kbd/keymaps/, see Keyboard configuration in console for details.

Note: Replacing the font can cause issues with programs that expect a standard VGA-style font, such as those using line drawing graphics.

Previewing and testing

Tip: An organized library of images for previewing is available: Linux console fonts screenshots.

The available glyphs or letters in the font can also be viewed as a table with using showconsolefont:

$ showconsolefont

The setfont utility may be used to temporarily change the font, so that the user can consider its permanent use. Just pass the name of the font (they are located in /usr/share/kbd/consolefonts/). For example:

$ setfont lat2-16 -m 8859-2

Note that the font name is case-sensitive, so type it exactly as you see it. If the newly changed font is not suitable, a return to the default font with the following command (even if the console display is totally unreadable, this command will still work, just type the command "blindly"):

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

Persistent configuration

The FONT variable in /etc/vconsole.conf is used to set the font at boot, persistently for all consoles. See man 5 vconsole.conf for details.

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


It means that second part of ISO/IEC 8859 characters are used with size 16. You can change font size using other values (e.g. lat2-08). For the regions determined by 8859 specification, look at the Wikipedia table.

To use the specified font in early userspace, use the consolefont hook in /etc/mkinitcpio.conf. 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 Kernel mode setting#Early KMS start, [2] or other ways to setup your framebuffer before /etc/vconsole.conf is applied.

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 HTML documents with PNG images of all the fonts in the AUR and the official repositories: [3].

Ancient Scripts

  • ttf-ancient-fontsAUR - Font containing Unicode symbols for Aegean, Egyptian, Cuneiform, Anatolian, Maya, and Analecta scripts


Emoji and symbols

A section of the Unicode standard is designated for pictographic characters called "emoji".

  • emojione-color-fontAUR - a complete, independent, open-source emoji set focused on design correctness
  • twemoji-color-fontAUR - Twitter's open-sourced emoji glyphs
  • ttf-symbola - provides many Unicode symbols, including emoji, in outline style
  • noto-fonts-emoji - Google's own emoji font, like on Android or Google Hangouts. Some newer additions to Unicode appear to render poorly with Noto fonts.

Kaomoji are sometimes referred to as "Japanese emoticons" and are composed of characters from various character sets, including CJK and Indic fonts. For example, the following set of packages covers most of existing kaomoji: ttf-freefont, ttf-arphic-uming, and ttf-indic-otf.

Arabic & Urdu

  • ttf-amiriAUR - A classical Arabic typeface in Naskh style poineered by Amiria Press
  • ttf-qurancomplex-fontsAUR - Fonts by King Fahd Glorious Quran Printing Complex in al-Madinah al-Munawwarah
  • ttf-arabeyes-fontsAUR - Collection of free Arabic fonts
  • ttf-sil-lateefAUR - Unicode Arabic font from SIL
  • ttf-sil-scheherazadeAUR - Unicode Arabic font from SIL
  • ttf-urdufontsAUR - Urdu fonts (Jameel Noori Nastaleeq (+kasheeda), Nafees Web Naskh, PDMS Saleem Quran Font) and font configuration to set Jameel Noori Nastaleeq as default font for Urdu


Chinese, Japanese, Korean, Vietnamese

  • noto-fonts-cjk - Large collection of fonts which comprehensively support Simplified Chinese, Traditional Chinese, Japanese, and Korean, with a consistent design and look. It is currently a rebadged version of adobe-source-han-sans-otc-fonts.
  • adobe-source-han-sans-otc-fonts - Large collection of fonts which comprehensively support Simplified Chinese, Traditional Chinese, Japanese, and Korean, with a consistent design and look.
(Mainly) Chinese
  • adobe-source-han-sans-jp-fonts - Japanese OpenType/CFF fonts
  • 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.
  • 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.
  • ttf-hanazono - A free Japanese kanji font, style Mincho (serif).
  • ttf-vlgothicAUR - Japanese Gothic fonts. Default of Debian/Fedora/Vine Linux
  • 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).
  • ttf-koruriAUR - Japanese TrueType font obtained by mixing ttf-mplusAUR and Open Sans
  • ttf-monapoAUR - Japanese fonts to show 2channel Shift JIS art properly.


See also #Monospaced, #Sans-serif and #Serif.

  • otf-russkopisAUR - A free OpenType cursive font for Cyrillic script
  • ttf-paratypeAUR - Font family by ParaType: sans, serif, mono, extended cyrillic and latin, OFL license


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
  • ttf-mgopenAUR - Professional TrueType fonts from Magenta


  • culmusAUR - Nice collection of free Hebrew fonts


(This one contains a "look of disapproval" that might be more to your liking than the bdf-unifont one mentioned elsewhere in this document)



  • ttf-laoAUR - Lao TTF font (Phetsarath_OT)
  • ttf-lao-fontsAUR - Lao TTF fonts, both Unicode and non-Unicode for Windows


  • ttf-irfontsAUR - Iran Supreme Council of Information and Communication Technology (SCICT) standard Persian fonts series.
  • ttf-bornaAUR - Borna Rayaneh Persian B font series.
  • ttf-sinaAUR - Sina Pardazesh Persian font series.
  • ttf-yasAUR - The Yas Persian font series (with hollow zero).
  • ttf-x2AUR - Free fonts with support for Persian, Arabic, Urdu, Pashto, Dari, Uzbek, Kurdish, Uighur, old Turkish (Ottoman) and modern Turkish (Roman).
  • ttf-iran-nastaliqAUR - A free Unicode calligraphic Persian font created by Iran Supreme Council of Information and Communication Technology (SCICT).
  • ttf-vazirAUR, ttf-samimAUR, ttf-tanhaAUR, ttf-shabnamAUR, ttf-gandomAUR, ttf-parastooAUR - Beautiful Persian fonts made by Ali Rasti Kerdar.
  • ttf-persian-hm-xs2AUR - An improved and corrected font series derived from ttf-x2AUR Persian font series with Kashida feature.
  • ttf-persian-hm-ftxAUR - An improved and corrected font series derived from ttf-x2AUR Persian font series, Metafont and FarsiTeX fonts with Kashida feature.
  • ttf-iranian-sansAUR and ttf-iranian-serifAUR - A family of fonts, designed by support from Iranian National Initiative for Free and Open Source Software to provide a good looking and free font for Persian script.
  • persian-fontsAUR - Meta package for installing all Persian fonts in AUR.



  • ttf-tlwg - Collection of scalable Thai fonts



Metric-compatible fonts

See Metric-compatible fonts, which lists available alternatives for Microsoft fonts.

Apple macOS fonts


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

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

A comparison with images on Slant: What are the best programming fonts?

And a Stack Overflow question with some images: Recommended fonts for programming







Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: This section should be absorbed into the Monospace/Serif/Sans-Serif structure (Discuss in Talk:Fonts#)

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 does not 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">
     <family>Your favorite Latin Serif font name</family>
     <family>Your Chinese font name</family>
Tip: If you use a Chinese locale, set LC_LANG to und to make this work. Otherwise both English and Chinese text will be rendered in the Chinese font.

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

See also Font configuration#Replace or set default fonts.

Font alias

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.

Tips and tricks

List all installed fonts

You can use the following command to list all installed fonts that are available on your system.

$ fc-list

Lists installed fonts for a particular language

Applications and browsers select and display fonts depending upon fontconfig preferences and available font glyph for Unicode text. To list installed fonts for a particular language, issue a command fc-list :lang="two letter language code". For instance, to list installed Arabic fonts or fonts supporting Arabic glyph:

$ fc-list -f '%{file}\n' :lang=ar

Set terminal font on-the-fly

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Which terminals specifically support this method? Where is the documentation for the escape codes? (Discuss in Talk:Fonts#)

For terminal emulators that use Xresources, fonts can be set by using escape sequences. Specifically, echo \033]710;$font\007 to change the normal font (*font in ~/.Xresources), and replace 710 with 711, 712, and 713 to change the *boldFont, *italicFont, and *boldItalicFont, respectively.

$font can be anything the terminal emulator will support.

Application-specific font cache

Matplotlib (python-matplotlib or python2-matplotlib) uses its own font cache, so after updating fonts, be sure to remove $HOME/.matplotlib/fontList.cache, $HOME/.cache/matplotlib/fontList.cache, $HOME/.sage/matplotlib-1.2.1/fontList.cache, etc. so it will regenerate its cache and find the new fonts [4].

See also