1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00
Commit Graph

1717 Commits

Author SHA1 Message Date
Wez Furlong
662227a725 bump vtparse version for publishing 2019-12-21 16:43:13 -08:00
Wez Furlong
a5b7747559 Replace enable_ligatures option with expanded harfbuzz_features option 2019-12-21 16:16:36 -08:00
Wez Furlong
291800b49a fonts: refine scaling factor
The ongoing saga from a465378dc4,
f204ad9a82, and others!

Only do scale adjustment here for glyphs that are taller rather than
wider.

This makes the ligatures in fira code look good again, and still
works with the v1 of the operator mono fonts.
2019-12-21 14:40:26 -08:00
Wez Furlong
5c1b78c17c fonts: allow disabling ligatures via config option
@sunshowers requested a way to turn this off, so here's a top level
config option to control whether we perform ligature substitution.

Ideally this would be associated with the font rather than globally,
but threading that information through the various layers is more
difficult than a global setting.
2019-12-21 09:38:33 -08:00
Wez Furlong
ef582a8955 DRY: add FontAttributes::new() for defining font fallbacks 2019-12-21 09:20:00 -08:00
Wez Furlong
1f81a064ed wayland: avoid appearing blurry on startup on scaled displays
@sunshowers mentioned to me that the window appeared blurry on a hidpi
display on startup, and was fixed by changing focus in a tiling window
manager.

I could replicate this using weston with scaling set to 2; the issue was
that the initial scale factor change event wasn't fully propagated and
bubbled up as a resize event to the terminal layer.

This commit taps into the dpi change event and forces it to be
interpreted as a window configuration change, resulting in more crisp
text.
2019-12-19 23:05:17 -08:00
Wez Furlong
8f3d5f238b use default config if config file is broken on startup
Show the error message using a toast notification, but fall back to
the defaults; this makes it easier to get in and fix the issue,
rather than silently failing.
2019-12-19 11:12:02 -08:00
Wez Furlong
fe4f0bf57a catch panic -> toast notification
This is useful when launched from a gui launcher and the stderr is
not conveniently visible.

If a panic occurs, generate a toast notification with the panic
message so that there is a breadcrumb to follow if the application
does terminate in this way.

Every so often I encounter this situation on my windows machine during
a graphics card driver update, so this should help to run that down.
2019-12-19 11:03:50 -08:00
Wez Furlong
bd71db6450 refactor toast notification code
We now use this both for config loading issues and an errors
that bubble up out from the main loop.
2019-12-19 10:26:24 -08:00
Wez Furlong
fc9e5ea0f5 Add font hinting and antialiasing config options
Adds the following options for the top level configuration,
which allow manipulating the quality of hinting and AA that
occurs for freetype:

```
font_antialias = "Subpixel" # None, Greyscale, Subpixel
font_hinting = "Full" # None, Vertical, VerticalSubpixel, Full
```

Refs: https://github.com/wez/wezterm/issues/79
2019-12-19 09:13:29 -08:00
Wez Furlong
726f1421b4 docs: document configuring the tab bar colors 2019-12-18 10:51:54 -08:00
Wez Furlong
ecf8b07711 docs: add note on how to disable wayland 2019-12-18 10:40:01 -08:00
Wez Furlong
b4241c6076 docs: update for recent font related config changes 2019-12-18 10:38:47 -08:00
Wez Furlong
bf35707cec docs: switch to the "Hacker" theme which is darker
refs: https://github.com/wez/wezterm/issues/77
2019-12-18 09:25:36 -08:00
Wez Furlong
ba4f5c1da9 add a little script to install jekyll
Tired of losing 30+ minutes trying to get a non-root ruby/gem
install working!
2019-12-18 08:05:05 -08:00
Wez Furlong
26ac488c20 fix toml parse error reporting
The move to anyhow changed the nature of the error objects
that get passed through to the notification system; since
we use the `context` method and used the normal display
presentation (via `to_string`) we were only reporting the
context and not the nature of the error.

Switching to alternate output makes the error messages more
useful by including the underlying problem and line number.

Refs: https://github.com/wez/wezterm/issues/78
2019-12-17 21:52:17 -08:00
Wez Furlong
8950c6cc24 fonts: improve diagnostics around locating font_dirs fonts 2019-12-15 16:09:49 -08:00
Wez Furlong
dab667ffc4 fonts: locator that only uses wezterm font_dirs config
This is useful when checking to make sure that your config works
independent of the system fonts.
2019-12-15 15:43:41 -08:00
Wez Furlong
d4fcd9432a remove unused rayon dep 2019-12-15 15:32:22 -08:00
Wez Furlong
ff4f0add98 clippy 2019-12-15 08:50:12 -08:00
Wez Furlong
0accf24181 finess some dead/unused code annotations 2019-12-15 08:38:52 -08:00
Wez Furlong
a465378dc4 fonts: readjust the glyph scaling code
As mentioned in f204ad9a82, this has
gone back and forth a few times.

This version avoids some artifacts by avoiding scaling in most cases.
The test scenario for this is to tab complete a directory name in
zsh; that causes a bold `/` glyph to be rendered which selects a
typeface with different metrics and would render a horizontal line
at either the top of bottom of the glyph.

Similarly, a `/` in italics (eg: comments in vim) would select a
third different font and have different artifact properties.

Now both of those artifacts are eliminated.
2019-12-15 08:07:13 -08:00
Wez Furlong
52dfce6c4e more mac + windows build tweaks 2019-12-14 22:38:24 -08:00
Wez Furlong
4fdee2baf0 maybe fix the windows build for anyhow changes 2019-12-14 22:27:37 -08:00
Wez Furlong
c6e4d31e47 maybe fix mac build for real 2019-12-14 22:20:50 -08:00
Wez Furlong
c87a1c3b03 maybe fixup compilation on macos and windows 2019-12-14 22:10:08 -08:00
Wez Furlong
9a2c7a1485 failure -> anyhow + thiserror 2019-12-14 21:43:05 -08:00
Wez Furlong
16cfe58d50 clippy 2019-12-14 16:41:17 -08:00
Wez Furlong
f7bc9d536a font: teach rasterizer to load a font only on demand 2019-12-14 15:36:50 -08:00
Wez Furlong
50f72c43b3 fonts: manage fontconfig and freetype associated files better
I noticed a lot of things bleeding into the process and its children,
so work a bit harder to trim the resource usage back
2019-12-14 15:22:47 -08:00
Wez Furlong
990d12fdf4 fonts: defer loading and setting font size
There's a lot of overhead for doing the size setting on each shaper
call!
2019-12-14 14:00:15 -08:00
Wez Furlong
21ab0887db fonts: freetype: metrics: skip sizing an undefined glyph 2019-12-14 13:16:57 -08:00
Wez Furlong
51c2646eee fonts: remove some unused code and fixup some warnings 2019-12-14 12:29:38 -08:00
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