xlsfonts
List available X Window System fonts
SYNOPSIS
xlsfonts [-display display] [-fn pattern] [-l|-ll|-lll] [-1|-C|-n columns] [-u] [-w width]
PARAMETERS
-display display
Specifies the X server to contact. This allows querying fonts from a remote or specific X display.
-fn pattern
Specifies a font name pattern (using X Logical Font Description wildcards) to match. Only fonts matching this pattern will be listed.
-l
Provides a long listing of fonts, including their properties. This is useful for seeing detailed attributes of each font.
-ll
Provides a very long listing, showing more properties than -l.
-lll
Provides an extremely long listing, showing all available properties for each font.
-1
Outputs one font name per line, disabling column formatting.
-C
Outputs font names in columns, which is often the default behavior when space allows.
-n columns
Specifies the number of columns to use when outputting font names.
-u
Prevents sorting of the font names; they are listed in the order received from the X server.
-w width
Specifies the width in characters for column output. It works in conjunction with -C or default column output.
DESCRIPTION
xlsfonts is a command-line utility for the X Window System that lists the fonts known to the X server. When invoked, it queries the X server and displays the names of all available fonts, or those matching a specified pattern. Font names are typically presented in the X Logical Font Description (XLFD) format, which provides a comprehensive way to describe font properties like foundry, family, weight, slant, size, and encoding. This tool is invaluable for users and administrators to identify which fonts are accessible to X applications, verify font server configurations, or troubleshoot font-related display issues. It helps in understanding the exact font names needed for resources or commands that require explicit font specifications.
CAVEATS
xlsfonts lists fonts known and served by the X server, which might not be all fonts physically present on your system. The X server's font path (configured via xset fp) determines which directories it scans for font files. If a font is installed but not in the server's font path, xlsfonts will not list it. Font names are represented as X Logical Font Description (XLFD) strings, which can be complex and require familiarity to interpret fully.
UNDERSTANDING XLFD STRINGS
xlsfonts outputs font names using the X Logical Font Description (XLFD) format. An XLFD string is a precise, 14-field identifier for a font, such as:
-foundry-family-weight-slant-setwidth-addstyle-pixelsize-pointsize-resX-resY-spacing-avgwidth-charsetregistry-charsetencoding.
Wildcards (* and ?) can be used with the -fn option to match parts of these fields, making it powerful for filtering specific font types (e.g., -*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-* for 12-point bold Helvetica fonts).
FONT PATHS AND SERVER CONFIGURATION
The fonts listed by xlsfonts are those accessible via the X server's font path. This path specifies directories where the X server looks for font files. You can inspect the current font path using xset q and modify it using xset fp+ (add directory), xset fp- (remove directory), or xset fp= (set new path). For changes to take effect, xset fp rehash is often required. Ensuring fonts are in the server's path is crucial for them to be used by X applications.
HISTORY
xlsfonts has been a fundamental utility within the X Window System since its early days, dating back to the X11R1 release. It was developed as part of the core X distribution to provide a simple yet effective way for users and developers to inspect the fonts available on an X display. Its design and core functionality have remained remarkably consistent over decades, reflecting the stable nature of the X fonting mechanism. It continues to be a staple tool for managing and troubleshooting font environments in X.