Wikia

How To Wiki

How to install and use X-Windows fonts

Talk0
1,811pages on
this wiki



Like any operation system and any graphical (GUI) system, X-Windows uses fonts. You can install and configure fonts for most window managers and programs. You can set fonts for most text based console programs and GUI programs.

X-Windows font system is configured in two systems. The Core X fonts are the older font system for fonts in the X-Windows System, and Fontconfig is the new system for fonts in X-Windows. Both are used in all X-Windows systems.

For simple instruction on installing fonts

See: Quick font installation

X-Windows font typesEdit

  • Common font types
    • Bitmap fonts
      • Binary distribution format *.bdf
      • Portable Compiled Font (*.pcf or *.pcf.gz)
      • Server normal format *.snf (obsolete)
    • TrueType, freetype or opentype
      • (*.ttf)
      • *.ttc
      • Open Type Font Format (*.otf)
    • Type 1
      • Adobe Type 1 PostScript Font Binary (*.pfb)
      • Adobe Type 1 PostScript Font ASCII (*.pfa)
      • Adobe/Outlined Font Metrics (*.afm)
      • CID-keyed font, or CIDFont
    • Speedo
      • Bitstream Speedo outline font format (*.spd)

Core X fonts (old system)Edit

The core X fonts are the older font system for fonts in the X-Windows System. Even though is the old system, its is still used, and is necessary for many functions.

Software
Programs for listing/viewing/installing fonts
  • fc-cache: creates fonts.cache1
    • Source code:
    • Gentoo: emerge


format format conversion software


Font installation software


Font viewing software


Listing installed fontsEdit

The program xlsfonts can be used for listing all installed fonts, as well as their properties

  • To install xlsfonts
    • This may already be install with your X install
    • From source: to be added
    • Gentoo: emerge x11-apps/xlsfonts
  • Listing installed fonts
    • Execute: xlsfonts
  • Listing font directory
    • Execute: xset q


Understanding font namesEdit

X font names are extremely confusing to decipher. This section helps to explain them [2]


  • Examples of font name:
    • -adobe-new century schoolbook-medium-r-normal—8-80-75-75-p-50-iso8859-15
    • -misc-fixed-bold-r-normal—0-0-100-100-c-0-iso8859-10
    • -misc-fixed-medium-r-normal—18-120-100-100-c-90-iso8859-1
    • 6x13
    • 6x13bold
    • kana14


  • Basic format: the accuracy of this should be checked
    • -[foundry]-[family]-[weight]-[slant]-[setwidth]-[style]-[pixelSize]-
      [pointSize]-[Xresolution]-[Yresolution]-[spacing]-[averageWidth]-[registry]-
      [encoding]
  • Description of font variables:
    • foundry
      • Description: fonts group
      • Examples: adobe, fixed
    • family
      • Description: fonts name
      • Examples: fixed, times, courier
    • weight:
      • Description: boldness
      • Examples: normal, bold
    • slant
      • Description: slant
      • Examples
        • o=none
        • r=
    • setwidth
      • Description:
      • Examples:
    • style
      • Description:
      • Examples:
    • pixelSize
      • Description: font size
      • Examples: 8, 10, 12
    • pointSize
      • Description: font size
      • Examples: 120
    • Xresolution
      • Description: resolution
      • Examples: 72,100
    • Yresolution
      • Description: resolution
      • Examples: 72,100
    • spacing
      • Description:
      • Examples:
    • averageWidth
      • Description: widths of characters vary, this is the average
      • Examples:
    • registry
      • Description:
      • Examples:
    • encoding
      • Description: character set [3]
      • Examples:
        • iso8859-1 (Latin 1 - Western Europe)
        • iso8859-2 (Latin 2 - Central and Eastern Europe)
        • iso8859-3 (Latin 3 - Esperanto and Maltese)
        • iso8859-4 (Latin 4 - superseded by Latin 6)
        • iso8859-5 (Cyrillic)
        • iso8859-6 (Arabic)
        • iso8859-7 (Greek)
        • iso8859-8 (Hebrew)
        • iso8859-9 (Latin 5 - Latin 1 with Turkish, not Icelandic)
        • iso8859-10 (Latin 6 - Nordic languages, replaces Latin 4)

Printing font locationEdit

  • xset q
    prints 'Font Path' among other things

Display fontEdit

Xfd-font-viewer-screenshot
xfd - font viewer screenshot
ZyMOSAdded by ZyMOS

xfd -fa "10x20"

Listing font propertiesEdit

Installing fontsEdit

Installing bitmap, type1, and freetype fonts.

Install bitmap fontsEdit

Bitmap font come of the BDF format and somewhat more efficient binary PCF format

Converting BFD to PCF files is recommended [4]

  • Converting fonts
    • Execute: bfdtopcf font_name.bdf
  • Compressing fonts
    • Execute: gzip font_name.pcf
  • Resulting file name
    • font_name.pcf.gz
Installing bitmap fonts
  • Execute the following commands, with the dir you wish
    • mkdir /usr/local/share/fonts/bitmap/
    • cp *.pcf.gz /usr/local/share/fonts/bitmap/
    • mkfontdir /usr/local/share/fonts/bitmap/
  • Refresh font cache


fonts.scale are not created for bitmap fonts.


Install Type1 fontsEdit

Make sure Type1 fonts are enabled

    • Test.....
    • To Enable
      • Add the following to Modules section /etc/X11/xorg.conf
        • Load "type1"


  • Make a directory in /usr/share/fonts/ or where ever you wish
    • Example: mkdir /usr/share/fonts/Type1/
  • Make indexes
    • Creating fonts.dir
      • Execute: mkfontdir /usr/share/fonts/Type1/
    • Creating fonts.scale
      • Execute: mkfontscale /usr/share/fonts/Type1/
  • Refresh font cache

Install freetype (truetype) fontsEdit

You can ether create a new directory for adding new fonts, or use a previous directory. If you use a previous font directory in the font path, then it only takes two steps to load the font.

Making a new freetype directory
  • Make a directory in /usr/share/fonts/ or where ever you wish
    • Example: mkdir /usr/share/fonts/freetype/
  • Copy fonts to directory
  • Make indexes
    • Creating fonts.dir
      • Execute: mkfontdir /usr/share/fonts/freetype/


Add font's directory to font


To add any new fonts to a previously used directory
  • Copy fonts to the directory
  • Execute: fc-cache
  • Restart any programs you wish to use the new fonts


Refresh font cacheEdit

  • Temporary
    •  % xset fp+ /usr/local/lib/X11/fonts/TrueType
    •  % xset fp rehash
  • Permanently
  • Execute the following
    1. xset fp+ /usr/share/fonts/TTF/
    2. xset fp rehash
    3. fc-cache
  • Restart any program that you want to use the new fonts

Testing fontsEdit

% xterm -fn -ETL-Fixed-Medium-R-Normal—14-140-72-72-C-70-ISO8859-1 &


Fontconfig (new font system)Edit

[5]

Font namesEdit

Font name in the newer system are much more readable than the old system

  • Format
  • <families>-<point sizes>:<name1>=<values1>:<name2>=<values2>...
  • Examples
Name Meaning
Times-12 12 point Times Roman
Times-12:bold 12 point Times Bold
Courier:italic Courier Italic in the default size
Monospace:matrix=1 .1 0 1 The users preferred monospace font with artificial obliquing
  • Common families of fonts
    • Bitstream Charter
    • Bitstream Vera family
    • Century Schoolbook
    • Luxi family
    • Nimbus family
    • URW Palladio
    • URW Bookman
    • URW Chancery
    • URW Gothic
    • Utopia

Listing installed fontsEdit

If you wish to see the installed fonts on you system, fc-list is the program you want to use. Gnome, KDE, etc. have their own graphical programs.


List all fonts installed

  • Execute: fc-list
    • Example output
Nimbus Sans L:style=Regular Italic
URW Palladio L:style=Roman
Century Schoolbook L:style=Bold Italic
Fixed:style=Bold
Nimbus Sans L:style=Bold
Times:style=Bold Italic
URW Chancery L:style=Medium Italic
Nimbus Roman No9 L:style=Regular
Century Schoolbook L:style=Bold
Century Schoolbook L:style=Italic
...

Installing FontsEdit

Simple font installationEdit

The simple installation is the same as the old system's font installation.


See Install freetype (truetype) fonts


fontconfig configurationEdit

Configuration of fontconfig is fairly complex and usually unnecessary for most users.


Config files
  • /etc/fonts/fonts.dtd
    a DTD that describes the format of the configuration files.
  • /etc/fonts/fonts.conf and ~/.fonts.conf
    the conventional location for per-user font configuration, although the actual location is specified in the global fonts.conf file.
  • See also: /etc/fonts/conf.d/* and /etc/fonts/conf.avail/*


Configuration

fonts.conf is the main configure for fontconfig. It allows specify parameters for many fonts, such as alias. The file is written in xml.


Configuring fonts for window managers and specific programsEdit

Most of the fonts you see will mostly be set by your window manager, such as Gnome, KDE, etc.

Window managers
Programs

ReferencesEdit

From HowTo Wiki, a Wikia wiki.
Advertisement | Your ad here

Around Wikia's network

Random Wiki