2017-08-27 15:37:56 +00:00
#+TITLE : unicode-fonts layer
2019-05-02 21:49:30 +00:00
#+TAGS : font|layer
2020-10-03 18:54:32 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-08-27 15:37:56 +00:00
- [[#description ][Description ]]
- [[#features ][Features: ]]
- [[#install ][Install ]]
2020-09-18 19:47:05 +00:00
- [[#ligature-fonts ][Ligature Fonts ]]
2017-08-27 15:37:56 +00:00
* Description
2020-09-18 19:54:23 +00:00
This layer adds support for [[https://github.com/rolandwalker/unicode-fonts ][unicode-fonts ]] package. It is recommended to
2017-08-27 15:37:56 +00:00
install the fonts listed in the [[https://github.com/rolandwalker/unicode-fonts#quickstart ][Quickstart ]] section of the unicode-fonts README.
** Features:
- Display unicode glyphs using the best available font.
- Easily override glyphs or sections of glyphs.
2019-10-13 05:27:17 +00:00
- Display color emoji on both the macOS port version of Emacs and emacs-plus (with
2017-08-27 15:37:56 +00:00
=unicode-fonts-force-multi-color-on-mac= set to non nil).
2020-09-18 19:47:05 +00:00
- Enable support for font ligature in Emacs 27 + via [[https://github.com/mickeynp/ligature.el ][ligatures.el ]].
2017-08-27 15:37:56 +00:00
* 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.
If using [[https://github.com/d12frosted/homebrew-emacs-plus/ ][emacs-plus ]], you can set =unicode-fonts-force-multi-color-on-mac= to
enable color emoji.
#+BEGIN_SRC elisp
2018-09-19 03:54:47 +00:00
(unicode-fonts :variables unicode-fonts-force-multi-color-on-mac t)
2017-08-27 15:37:56 +00:00
#+END_SRC
2020-09-18 19:47:05 +00:00
If you want ligature support Emacs must be built with =Harfbuzz= and a ligature
2020-09-20 19:24:18 +00:00
font must be installed and configured you can see the [[https://github.com/mickeynp/ligature.el#compatibility-and-version-requirements ][upstream ]] docs for a full
2020-09-18 19:47:05 +00:00
list of requirements. By default this is not enabled you can enable it with
=unicode-fonts-enable-ligatures= .
2020-09-18 19:54:23 +00:00
#+BEGIN_SRC elisp
2020-09-18 19:47:05 +00:00
(unicode-fonts :variables unicode-fonts-enable-ligatures t)
#+END_SRC
2020-09-18 19:54:23 +00:00
By default when ligatures are enabled all modes will have ligatures. You can
2020-09-18 19:47:05 +00:00
enable ligatures for specific modes with the =unicode-fonts-ligature-modes=
variable.
2020-09-18 19:54:23 +00:00
#+BEGIN_SRC elisp
2020-09-18 19:47:05 +00:00
(unicode-fonts :variables unicode-fonts-ligature-modes '(php-mode js-mode))
#+END_SRC
2020-09-18 19:54:23 +00:00
To enable only for programming modes you can use =prog-mode=
2020-09-18 19:47:05 +00:00
2020-09-18 19:54:23 +00:00
#+BEGIN_SRC elisp
2020-09-18 19:47:05 +00:00
(unicode-fonts :variables unicode-fonts-ligature-modes '(prog-mode))
#+END_SRC
To configure the ligature set that gets used with your font there is a
2020-09-20 19:24:18 +00:00
=unicode-fonts-ligature-set= variable. To only enable the ligatures in
=if= statements you can limit the =unicode-fonts-ligature-set=
2020-09-18 19:47:05 +00:00
2020-09-18 19:54:23 +00:00
#+BEGIN_SRC elisp
2020-09-18 19:47:05 +00:00
(unicode-fonts :variables unicode-fonts-ligature-set '("==" "= ==" "!= " "!==" "||" "&&"))
#+END_SRC
* Ligature Fonts
- [[https://github.com/tonsky/FiraCode ][Fira Code ]]
2020-09-20 19:24:18 +00:00
- [[https://github.com/microsoft/cascadia-code ][Cascadia Code ]]
- [[https://github.com/be5invis/Iosevka/ ][Iosevka ]]