2019-12-30 07:41:08 +03:00
|
|
|
### Advanced Font Shaping Options
|
|
|
|
|
|
|
|
The `harfbuzz_features` option allows specifying the features to enable when
|
|
|
|
using harfbuzz for font shaping.
|
|
|
|
|
|
|
|
There is some light documentation here:
|
|
|
|
<https://harfbuzz.github.io/shaping-opentype-features.html>
|
|
|
|
but it boils down to allowing opentype feature names to be specified
|
|
|
|
using syntax similar to the CSS font-feature-settings options:
|
|
|
|
<https://developer.mozilla.org/en-US/docs/Web/CSS/font-feature-settings>.
|
|
|
|
The OpenType spec lists a number of features here:
|
|
|
|
<https://docs.microsoft.com/en-us/typography/opentype/spec/featurelist>
|
|
|
|
|
|
|
|
Options of likely interest will be:
|
|
|
|
|
|
|
|
* `calt` - <https://docs.microsoft.com/en-us/typography/opentype/spec/features_ae#tag-calt>
|
|
|
|
* `clig` - <https://docs.microsoft.com/en-us/typography/opentype/spec/features_ae#tag-clig>
|
|
|
|
|
|
|
|
If you want to disable ligatures in most fonts, then you may want to
|
|
|
|
use a setting like this:
|
|
|
|
|
2020-04-07 02:32:16 +03:00
|
|
|
```lua
|
|
|
|
return {
|
2022-07-19 17:54:31 +03:00
|
|
|
harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' },
|
2020-04-07 02:32:16 +03:00
|
|
|
}
|
2019-12-30 07:41:08 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
Some fonts make available extended options via stylistic sets.
|
|
|
|
If you use the [Fira Code font](https://github.com/tonsky/FiraCode),
|
|
|
|
it lists available stylistic sets here:
|
|
|
|
<https://github.com/tonsky/FiraCode/wiki/How-to-enable-stylistic-sets>
|
|
|
|
|
|
|
|
and you can set them in wezterm:
|
|
|
|
|
2020-04-07 02:32:16 +03:00
|
|
|
```lua
|
|
|
|
return {
|
|
|
|
-- Use this for a zero with a dot rather than a line through it
|
|
|
|
-- when using the Fira Code font
|
2022-07-19 17:54:31 +03:00
|
|
|
harfbuzz_features = { 'zero' },
|
2020-04-07 02:32:16 +03:00
|
|
|
}
|
2019-12-30 07:41:08 +03:00
|
|
|
```
|
|
|
|
|
2022-01-01 22:56:23 +03:00
|
|
|
*Since: 20220101-133340-7edc5b5a*
|
2021-12-21 07:56:59 +03:00
|
|
|
|
|
|
|
You can specify `harfbuzz_features` on a per-font basis, rather than
|
|
|
|
globally for all fonts:
|
|
|
|
|
|
|
|
```lua
|
|
|
|
local wezterm = require 'wezterm'
|
|
|
|
return {
|
2022-07-19 17:54:31 +03:00
|
|
|
font = wezterm.font {
|
|
|
|
family = 'JetBrains Mono',
|
|
|
|
harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' },
|
|
|
|
},
|
2021-12-21 07:56:59 +03:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
and this example disables ligatures for JetBrains Mono,
|
|
|
|
but keeps the default for the other fonts in the fallback:
|
|
|
|
|
2021-12-21 08:01:53 +03:00
|
|
|
```lua
|
2022-07-19 17:54:31 +03:00
|
|
|
local wezterm = require 'wezterm'
|
2021-12-21 07:56:59 +03:00
|
|
|
|
|
|
|
return {
|
2022-07-19 17:54:31 +03:00
|
|
|
font = wezterm.font_with_fallback {
|
2021-12-21 07:56:59 +03:00
|
|
|
{
|
2022-07-19 17:54:31 +03:00
|
|
|
family = 'JetBrains Mono',
|
|
|
|
weight = 'Medium',
|
|
|
|
harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' },
|
2021-12-21 07:56:59 +03:00
|
|
|
},
|
2022-07-19 17:54:31 +03:00
|
|
|
{ family = 'Terminus', weight = 'Bold' },
|
|
|
|
'Noto Color Emoji',
|
|
|
|
},
|
2021-12-21 07:56:59 +03:00
|
|
|
}
|
|
|
|
```
|
2019-12-30 07:41:08 +03:00
|
|
|
|