1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-26 14:54:16 +03:00
Commit Graph

1734 Commits

Author SHA1 Message Date
Wez Furlong
f204ad9a82 fonts: fixed up shaping using allsorts
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.
2019-12-14 10:17:31 -08:00
Wez Furlong
a9b0197075 fonts: add an Allsorts shaper
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
2019-12-14 08:46:06 -08:00
Wez Furlong
72f4ec58e4 font: allsorts add helpers for shaping 2019-12-11 23:05:57 -08:00
Wez Furlong
414d465208 font: load more font metadata using allsorts 2019-12-11 22:20:46 -08:00
Wez Furlong
6ef899ddba fonts: simplify obtaining and stash the otf table 2019-12-11 22:05:11 -08:00
Wez Furlong
ad72362cbc eliminate dep on rental
Trading a lot of gross for a single line of gross
2019-12-11 21:40:07 -08:00
Wez Furlong
5696ce6304 fonts: add types for various font units
The idea is that this will make it easier to deal with alternate
rasterizers and shapers in later commits.
2019-12-10 09:01:55 -08:00
Wez Furlong
232555fd6c fonts: fix dpi scaling for hidpi displays 2019-12-09 22:15:58 -08:00
Wez Furlong
10b903afd8 fonts: fixup compilation on mac+windows 2019-12-09 22:10:55 -08:00
Wez Furlong
61776aa5a3 fonts: general implementation for config.font_dirs
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
2019-12-09 21:59:34 -08:00
Wez Furlong
9a653ca663 fix subtraction underflow in debug mode 2019-12-09 21:52:36 -08:00
Wez Furlong
aed75850c5 fonts: remove references to long-dead fontconfig feature name 2019-12-09 20:26:58 -08:00
Wez Furlong
2d024845a7 fonts: rename font loader to locator 2019-12-09 20:06:12 -08:00
Wez Furlong
f89b52e53e fonts: add a basic font parse using allsorts
Refs: https://github.com/wez/wezterm/issues/66
2019-12-09 18:08:02 -08:00
Wez Furlong
e01fed8120 fonts: remove some dead code 2019-12-09 13:56:34 -08:00
Wez Furlong
0a0a895a5b fonts: remove fontconfigandfreetype.rs 2019-12-09 13:43:48 -08:00
Wez Furlong
988e996a76 fonts: remove font_system selection type
This simplifies things a bit by removing some boiler plate.
We can now control locator, shaper and rasterizer independently.
2019-12-09 13:35:38 -08:00
Wez Furlong
108942960f fonts: migrate default_font over to new stuff 2019-12-09 13:24:09 -08:00
Wez Furlong
6fdb693f2c fonts: cut raster and shaper over to new stuff 2019-12-09 13:17:40 -08:00
Wez Furlong
d4f0eb40f7 fonts: add a metics method to the shaper 2019-12-09 12:58:03 -08:00
Wez Furlong
c91345cbd6 fonts: FontConfiguration::resolve_font
Can now create a LoadedFont that ties together the new abstractions.
It's not yet sufficient to use in wezterm though.
2019-12-09 12:46:58 -08:00
Wez Furlong
cd07a31d84 fonts: start adding new stuff to FontConfiguration 2019-12-09 12:12:54 -08:00
Wez Furlong
accfc9b09c font: adjust interfaces to pass size information down 2019-12-09 08:33:11 -08:00
Wez Furlong
a05612960e font: fontkit: add missing fallback in font locator 2019-12-09 08:06:02 -08:00
Wez Furlong
5891277d1f fonts: move ft size computation into lower layer
This allows it to be shared between separated ft and harfbuzz code
2019-12-09 08:00:55 -08:00
Wez Furlong
17101b182e fix build on linux 2019-12-09 00:50:19 -08:00
Wez Furlong
b5a59a18fa fonts: extract the shaper concept 2019-12-09 00:06:47 -08:00
Wez Furlong
41d10811a6 fonts: break out the rasterizer concept 2019-12-08 23:27:10 -08:00
Wez Furlong
6f867ac3e2 fonts: start breaking out the loader/locator concept 2019-12-08 22:48:47 -08:00
Wez Furlong
151a915128 Improve FontKit rendering, but it is still bad
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.
2019-12-08 21:35:37 -08:00
Wez Furlong
ab86eb1c75 font-kit: enable its use on macos
FontKit is still broken, but FontKitAndFreeType works
2019-12-08 17:51:01 -08:00
Wez Furlong
55f2016683 fix subtraction underflow 2019-12-08 17:49:27 -08:00
Wez Furlong
6ea837fc14 TODONE 2019-12-08 16:41:28 -08:00
Wez Furlong
1e9d3571ba font-kit: add font_dirs configuration option
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
2019-12-08 16:34:17 -08:00
Wez Furlong
8ae136e616 fonts: allow using font-kit as a source for fonts
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.
2019-12-08 16:02:04 -08:00
Wez Furlong
b47cd72853 Windows: show toast notification if config reload encounters error
This gives us a way to show notifs on windows, which is a feature
that isn't supported by the notify-rust crate.
2019-12-08 11:14:02 -08:00
Wez Furlong
cdfd77902a update ssh2 dep 2019-12-08 10:43:55 -08:00
Wez Furlong
500b880b97 load config from executable dir first on Windows
This is to support the portable-tools use case for roaming admins.

Refs: https://github.com/wez/wezterm/issues/73
2019-12-07 20:51:30 -08:00
Jeremy Fitzhardinge
0558662813 Convert chit-chat into info
I assume it was being printed as error from a mass conversion to the logging framework.
2019-12-06 15:11:42 -08:00
Jeremy Fitzhardinge
0ba11a8bbd Clean up FontAttributes bold and italic
There doesn't seem to be a need for a tristate Option<bool>, since we always treat unset as false.
2019-12-06 15:11:42 -08:00
Jeremy Fitzhardinge
b751c6590b Small cleanup in fontconfigandfreetype 2019-12-06 15:11:42 -08:00
Jeremy Fitzhardinge
6420a47ad2 font: add Debug implementation for Pattern and FontSet 2019-12-06 15:11:42 -08:00
Wez Furlong
5b6bad2c51 downrev notify-rust dependency
SOmething on the CI doesn't like it and it looks like a problem
with that alpha version, so let's go back to their stable rev.
2019-12-04 20:40:32 -08:00
Wez Furlong
66861ff8f7 improve handling of deleted config files in the reloader
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.
2019-12-04 20:38:29 -08:00
Wez Furlong
598c2d8c26 notifications: set the resident hint
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.
2019-12-04 19:55:43 -08:00
Wez Furlong
d4ab211190 PendingMouse and CopyAndPaste now impl Debug 2019-12-04 19:45:13 -08:00
Wez Furlong
09840dd011 notifications: fixup formatting and add to get-deps script 2019-12-04 18:33:36 -08:00
Wez Furlong
c547b03b8b add basic notifications if the config is broken during reload 2019-12-04 18:26:47 -08:00
Wez Furlong
fc53b3969a rustfmt 2019-12-01 15:24:03 -08:00
Wez Furlong
0f28ab8243 docs: update rust version info and build instructions 2019-12-01 15:23:08 -08:00