This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+fonts/unicode-fonts
2022-11-01 16:52:36 +01:00
..
config.el unicode fonts: multiple improvements 2022-08-05 00:11:56 -04:00
funcs.el fixup! unicode fonts: multiple improvements 2022-08-06 01:22:57 -04:00
packages.el fix: https://github.com/syl20bnr/spacemacs/issues/15699 2022-11-01 16:52:36 +01:00
README.org [bot] documentation_updates (#15679) 2022-08-05 04:24:35 +00:00

unicode-fonts layer

Description

This layer adds support for unicode-fonts package. It is recommended to install the fonts listed in the Quickstart section of the unicode-fonts README.

Features:

  • Display Unicode glyphs using the best available font.
  • Easily override glyphs or sections of glyphs.
  • Display color emoji on both the macOS port version of Emacs and emacs-plus (with unicode-fonts-force-multi-color-on-mac set to non nil).
  • Enable support for font ligature in Emacs 27 + via ligatures.el.

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add unicode-fonts to the existing dotspacemacs-configuration-layers list in this file.

  (setq-default dotspacemacs-configuration-layers '(unicode-fonts))

If using emacs-plus, you can set unicode-fonts-force-multi-color-on-mac to enable color emoji.

  (setq-default dotspacemacs-configuration-layers
                '(unicode-fonts :variables
                                unicode-fonts-force-multi-color-on-mac t))

Configuration

If you want ligature support Emacs must be built with Harfbuzz and a ligature font must be installed and configured. You can see the upstream docs for a full list of requirements. By default this is not enabled, and you can enable it with unicode-fonts-enable-ligatures.

  (setq-default dotspacemacs-configuration-layers
                '(unicode-fonts :variables
                                unicode-fonts-enable-ligatures t))

By default ligatures will be enabled in all programming modes. You can enable ligatures for specific modes with unicode-fonts-ligature-modes variable. For example, to enable ligatures only in PHP and Javascript files:

  (setq-default dotspacemacs-configuration-layers
                '(unicode-fonts :variables
                                unicode-fonts-enable-ligatures t
                                unicode-fonts-ligature-modes '(php-mode js-mode)))

Or to enable ligatures only for text files:

  (setq-default dotspacemacs-configuration-layers
                '(unicode-fonts :variables
                                unicode-fonts-enable-ligatures t
                                unicode-fonts-ligature-modes '(text-mode)))

To configure the ligature set that gets used with your font there is a unicode-fonts-ligature-set variable. For example To only enable the ligatures in if statements you can set the unicode-fonts-ligature-set as:

  (setq-default dotspacemacs-configuration-layers
                '(unicode-fonts :variables
                                unicode-fonts-enable-ligatures t
                                unicode-fonts-ligature-set '("==" "===" "!=" "!==" "||" "&&")))