Show Font (show-font.el)

Preview fonts in Emacs

This document contains the release notes for each tagged commit on the project’s main git repository: https://github.com/protesilaos/show-font.

The newest release is at the top. For further details, please consult the manual: https://protesilaos.com/emacs/show-font.

1. Version 0.3.0 on 2025-04-26

This version adds some refinements to an already stable package.

1.1. The command show-font-list is an alias for show-font-tabulated

The show-font-list command was using a custom buffer that listed font families and their corresponding short preview. It did not have any other feature.

I made changes under the hood to rely on the built-in tabulated-list-mode which is a standard and gives us the option to sort by column. The show-font-list is thus an alias for the new command show-font-tabulated. Right now the sorting facility only applies to reversing the name-based order. In the future we may have more columns, such as if we describe a font as “Latin”, “Greek”, etc.

1.2. The tabulated list marks fonts that cannot be previewed

In the past, the font listing would include families that could not display the show-font-pangram or, indeed, any Latin character. Those would be rendered as empty boxes.

I have now introduced a simple heuristic to test that the given family supports Latin characters. If it does not, then (i) it is highlighted with a different colour, (ii) it shows “No preview” instead of the pangram, and (iii) it displays the information in the Emacs default font family. Some families do not play nice with this approach though, as they pass the test but still do not display any Latin characters. This happens with icon fonts.

The long-term goal is to support different scripts and show the appropriate text for each of them.

1.3. The show-font-sentences-sample adds more to the show-font-select-preview

The new user option show-font-sentences-sample is a list of strings that can be used to exhibit common patterns and letter combinations. The default value is carefully designed to show if a font family is stylistically consistent, such as with how it draws i, l, t, or h, n, m, and so on. Plus, it teaches you some obscure words like “scholarch”, “antipode”, and “heteroclite”: use them with your Greek friends—and if they do not know those words, then they must buy you a café frappé!

1.4. Miscellaneous

  • The face show-font-title-small is an obsolete alias for the more appropriately named show-font-title-in-listing.
  • The prompt used by the command show-font-select-preview now correctly uses its own history and default value.
  • The default value of the user option show-font-character-sample includes some more patterns to better test the adequacy of a font family. This sample is displayed in the buffer produced by the command show-font-select-preview.

2. Version 0.2.0 on 2025-01-25

This version includes quality-of-life refinements.

2.1. Show fonts in a tabulated listing

The command show-font-tabulated will produce a listing of font families and their preview that uses the built-in tabulated interface. This interface is the same as the one used by M-x list-packages. Users can sort fonts by font family name (move point to the given column and type S or call M-x tabulated-list-sort).

When show-font-tabulated is called with a prefix argument (C-u by default), it prompts for a string or regular expression. It then shows only the font families matching the given input.

2.2. Limit font listing using a regular expression

The command show-font-list which we already had in version 0.1.0 is like the show-font-tabulated, but uses a bespoke buffer where each font and its preview are shown one after the other. Now it also accepts an optional prefix argument to limit the list to only the matching fonts.

2.3. The show-font-display-buffer-action-alist controls buffer placement

The preview buffers we use will now conform with the value of the new user option show-font-display-buffer-action-alist. This is a more advanced feature, due to how display-buffer works, so you may want to check the video I did recently about controlling where buffers are displayed: https://protesilaos.com/codelog/2024-02-08-emacs-window-rules-display-buffer-alist/.

The default value of show-font-display-buffer-action-alist will show the buffer at the bottom of the frame.

3. Version 0.1.0 on 2024-09-10

With show-font the user has the means to preview fonts inside of Emacs. This can be done in the following ways:

  • The command show-font-select-preview uses the minibuffer to prompt with completion for a font on the system. The selected font is then displayed in a bespoke buffer.
  • The command show-font-list produces a list with all the fonts available on the system. Each font on display is styled with its given character set.
  • The show-font-mode is a major mode that gets activated when the user visits a .ttf or .otf file. It will preview with the font, if it is installed on the system, else it will provide a helpful message and an option to install the font (NOTE 2024-09-10: this only works on Linux).

The previews include a pangram, which is controlled by the user option show-font-pangram. The default value is a playful take on the more familiar “the quick brown fox jumps over the lazy dog” phrase. Users can select among a few presets, or define their own custom string.

The function show-font-pangram-p is available for those who wish to experiment with writing their own pangrams (it is not actually limited to the Latin alphabet).

The user option show-font-character-sample provides a more complete character set that is intended for use in full buffer previews (i.e. not in the list of fonts). It can be set to any string. The default value is a set of alphanumeric characters that are commonly used in programming: a good monospaced font should render all of them unambiguously.

Finally, the following faces control the appearance of various elements.

  • show-font-small
  • show-font-regular
  • show-font-medium
  • show-font-large
  • show-font-title
  • show-font-title-small
  • show-font-misc
  • show-font-button