The issue mentioned from the prior commit was due to not breaking
out of the inner fallback loop, so we'd stack up multiple glyphs
with the same cluster value, causing the earlier versions to be
obscured by the later versions.
Adjust glyph width calculation: the metrics we were getting from
harfbuzz were synchronized with the font render size. When we're
configured to use allsorts, the shaper metrics are not connected
to the render metrics and we can end up with the raw emoji glyph
width being much larger than the font advance metric value and
then render a giant heart emoji. The revised calculations trigger
scaling if the glyph width is too wide. I've gone back and forth
on that particular line a couple of times in the past: hopefully
this time we've got the right calculation?
I "fixed" the font metrics we compute and return from allsorts
by rounding them to the nearest integer value. That makes the
spacing look better at my normal font size (8.3 -> 8) and makes
things look tighter. It feels a bit magical IMO.
Adds the ability to specify `--font-shaper Allsorts` and use that
for metrics and shaping.
It is sufficient to expand things like ligatures, but there's something
slightly off about how the metrics are computed and they differ slightly
from the freetype renderer, which leads to some artifacts when rendering
with opengl.
One of my tests is to `grep message src/main.rs` to pull out the line
that has a selection of emoji. The heart emoji is missing from that
line currently.
Refs: https://github.com/wez/wezterm/issues/66
This commit makes use of the allsorts font parser to
parse out matching fonts found under the `font_dirs`
locations.
The matching is imperfect but sufficient for my ad-hoc
local tests.
Using allsorts for this parsing/matching means that we
can implement font_dirs on all platforms; previously it
was only available when using some plumbing from font-kit.
Refs: https://github.com/wez/wezterm/issues/74
I don't think font-kit has enough data available for to make things
work the way we're used to. In addition, the implementation of
the loader for core text has a lot of TODO's.
The state of the FontKit variant is that it basically renders glyphs
and they are aligned to the same baseline, but both the vert and
horz metrics are off; for example, `-` doesn't render. The glyphs
are also under-sized.
This is another option to help with the portable wezterm on a flash
drive use case.
When the font system is set to FontKitAndFreeType, the set of
directories specified by the `font_dirs` configuration option will
be scanned for fonts and used as a source for fonts.
In addition, any relative paths in the the `font_dirs` list will
be expanded relative to the configuration file path.
That allows deploying the following set of files to the root of
a flash drive:
* wezterm.exe
* wezterm.toml
* fonts/myfont.ttf
and with this config snippet:
```
font_system = "FontKitAndFreeType"
font_dir = ["fonts"]
```
wezterm will now consider myfont.ttf when loading fonts.
Refs: https://github.com/wez/wezterm/issues/73
This commit adds two new font system variants that are currently
implemented only on Windows:
* FontKit - uses fontkit both for font discovery and rasterizing
* FontKitAndFreeType - uses fontkit for font discovery but freetype
for rasterizing
To a certain extent, FontKitAndFreeType obsoletes FontLoaderAndFreeType
and I'll be looking at removing it once I can test the build on macOS.
The FontKit impl has bad metrics and also crashes during shaping
on Windows, so it's not ready to be used by default.
The NoticeXXX variants are emitted at the trigger point, but
we should wait for the debounced XXX variants instead. We
were doing this for write but not for delete. This should
improve the chances that we'll pick up a new version of a
config file.
Even with setting this, I'm 0 for 4 different systems in having the
notifications actually stay on the screen until dismissed.
This was successful at displaying a notification on the pixelbook
desktop though, so that's 1/3 linux systems that have had success.