1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00
Commit Graph

3599 Commits

Author SHA1 Message Date
Wez Furlong
8237dfc8c6 fonts: fix compilation on win32 2021-04-10 07:32:56 -07:00
Wez Furlong
c312983643 Ensure that we propagate OutOfTextureSpace errors
otherwise we won't be able to show many glyphs beyond those that
fit in the initial texture atlas!

refs: https://github.com/wez/wezterm/discussions/672
refs: https://github.com/wez/wezterm/issues/671
2021-04-10 07:26:19 -07:00
Wez Furlong
b825f86380 avoid incomplete paints if loading a glyph fails
This addresses the render artifacts aspect of https://github.com/wez/wezterm/issues/671

For whatever reason, some font(s) cannot be loaded on that system
and that results in the paint routine erroring out.

This commit avoids the error by substituting a blank glyph
instead of the glyph that failed to load.

refs: https://github.com/wez/wezterm/issues/671
2021-04-10 00:21:00 -07:00
Wez Furlong
02e58d904d fonts: allow unloading unused fonts from the shaper
When we process the system fallback list, we can produce a long list
of fonts to be speculatively processed by the shaper.

Until this commit, the shaper would always keep the associated
freetype face open forever, which increases the number of open
files and the amount of allocated memory.

This commit allows the shaper to release a font if it has never
produced any valid shaper results, which keeps the list down
to just the fonts that are in use.
2021-04-10 00:20:47 -07:00
Wez Furlong
3ce44823a0 fonts: FontDataSource::Memory -> BuiltIn
This makes it harder to accidentally copy the associated data.
2021-04-09 23:43:44 -07:00
Wez Furlong
f9bdd2502a fonts: adjust error diagnostics 2021-04-09 22:25:47 -07:00
Wez Furlong
438b7540ba docs: typo 2021-04-09 22:05:16 -07:00
Wez Furlong
21ce3f3262 docs: clean up the font documentation
Migrate information into the relevant config option pages, and
instead summarize with a demonstration of configuring the font.

For wezterm.font, there's now an expanded discussion on naming
and matching fonts.

closes: https://github.com/wez/wezterm/issues/560
2021-04-09 21:52:25 -07:00
Wez Furlong
7524dc3826 changelog for #667
closes: https://github.com/wez/wezterm/issues/667
2021-04-09 19:53:38 -07:00
Wez Furlong
6a817fd26e changelog for https://github.com/wez/wezterm/issues/668
closes: https://github.com/wez/wezterm/issues/668
2021-04-09 19:52:26 -07:00
Wez Furlong
18061bb47c really fixup win32 build 2021-04-09 14:16:23 -07:00
Wez Furlong
ac04076827 maybe fixup win32 build 2021-04-09 14:07:20 -07:00
Wez Furlong
b006ab923b fonts: adopt CSS Fonts Level 3 compatible font matching 2021-04-09 14:05:41 -07:00
Wez Furlong
99fc3ee3cd fonts: rename width/FontWidth to stretch/FontStretch
This terminology is consistent with that used in CSS to describe
this same property of the font.
2021-04-09 12:00:18 -07:00
Wez Furlong
dfb6043971 fix potential panic when pasting multibyte text > 1024 bytes
We were handling the case where the chunk intersected a multibyte
boundary after the first chunk, but not for the first chunk itself.

Refactor the code so that we use the same chunk splitting logic
for both of those cases.

refs: https://github.com/wez/wezterm/issues/668
2021-04-09 11:47:42 -07:00
Wez Furlong
0694e905e8 font-config: fall back to searching by postscript name
Our first pass is to match based on the overall constraints
supplied by the user, but if that fails, we fall back to
looking up by postscript name.
2021-04-09 10:26:46 -07:00
Wez Furlong
16e7457049 x11: notice dynamic changes to Xft.dpi
This commit allows the x11 window implementation to detect changes
in the DPI that occur after a window is created.

These can occur when changing desktop resolution or when changing
the accessibility option for "Large Text" in gnome.

In order to avoid continually polling for the value on every resize,
we look for the `_GTK_EDGE_CONSTRAINTS` atom in our property change
notifications.  This seems to be sent at least as often as the
dpi/scaling changes.

It's also worth noting that some dpi changes don't generate resize
events, so we can't just read the dpi value on every resize, because
we'd miss some of those changes.

Part of this commit changes the font scaling logic: previously
we'd keep a notion of "dpi scale" to apply.  That dates from an
earlier time in wezterm where we didn't think that we knew an
actual dpi value.

The way that worked was that we'd compare our current guestimate
of the DPI against what we though the baseline OS dpi should be to
produce a scaling factor.

On X11 that dpi value is global and we'd effectively always produce
a revised scaling factor of 1 after we'd set up the initial window.

This commit changes that logic to just pass down the actual DPI value
to the font code.  That DPI value already accounts for HiDPI scaling
so this is hopefully a NOP change for the other systems.

refs: https://github.com/wez/wezterm/issues/667
2021-04-09 09:23:25 -07:00
Jun Wu
228eab546e termwiz: do not use terminfo for unsupported 256-colors
I noticed edenscm log -p (using streampager) cannot render 256 colors
if TERM is not "*-256color", despite forcing enabling true colors in
streampager (https://github.com/markbt/streampager/pull/28).

I tracked it down here. The problem is that we ask terminfo for colors
it does not claim to support. Fix it by using fallback CSI rendering
for colors exceeding the terminfo max color.
2021-04-09 08:04:55 -07:00
Jun Wu
e023114509 vtparse: simplify TRANSITIONS const
The latest Rust handles more types of const expressions. So we can
use const fns or match directly without using workarounds like OptionPack
and macros.
2021-04-09 08:00:29 -07:00
Jun Wu
c5aa4c9772 vtparse: add a test about the TRANSITIONS value
Going to change how TRANSITIONS is generated. Add a test to ensure the
value is unlikely changed by the change. Note the string is 14K long
so we only hash its values to keep the code short.
2021-04-09 08:00:29 -07:00
Wez Furlong
6e6d6a7f06 fonts: refine matching on macos
Potentially allow matching more ttc and variable fonts on this
platform.
2021-04-08 17:37:40 -07:00
Wez Furlong
4c1de197bd fonts: use ParsedFont rather than FontDataHandle
This can avoid extraneous parses in a few cases.
2021-04-08 17:11:23 -07:00
Wez Furlong
c4d6831cf7 fixup build on macos 2021-04-08 16:23:32 -07:00
Wez Furlong
ecc500af05 ssh: don't override the ssh config User value 2021-04-08 16:17:49 -07:00
Wez Furlong
22440a3cb2 fixup font tests 2021-04-08 16:04:59 -07:00
Wez Furlong
dcf41d7338 docs: freetype_render_target
refs: #639
2021-04-08 15:52:06 -07:00
Wez Furlong
43ea2f192a Allow matching font weight and font width in wezterm.font
refs: https://github.com/wez/wezterm/issues/655
2021-04-08 15:42:53 -07:00
Gus Wynn
dee10c2f21 Support unicode charaters in 2021-04-08 15:42:39 -07:00
Wez Furlong
c14ec06ff6 docs: changelog for #655 2021-04-08 12:47:04 -07:00
Wez Furlong
b689d192c6 docs: changelog for #661 2021-04-08 12:45:22 -07:00
Wez Furlong
5b5751d2b9 fonts: improve font matching of variations on windows
Try harder to find a better variation match when we get
a data blob from gdi.
2021-04-08 12:42:48 -07:00
Wez Furlong
392fe098c9 fonts: place FontDataHandle in ParsedFont 2021-04-08 12:08:21 -07:00
Wez Furlong
364ab2a35b fonts: refactor: split out FontDataSource 2021-04-08 11:34:58 -07:00
Wez Furlong
63222e4a94 fonts: fixup build on unix systems 2021-04-08 10:53:00 -07:00
Wez Furlong
6830d171cf fixup metrics when line_height==1.0
This was broken by b441be3ac9

For whatever reason, the breakage was only visible with the Iosveka
font on Windows.  I couldn't reproduce it on my other systems, even
though the code technically applies to any system.

The breakage was: the metrics resulted in a difference of about 0.4
pixels being used for the descender with that particular font, resulting
in weird vertical alignment problems.

The offset needs to be computed against the ceil of the cell height,
which removes the fractional offset.

refs: https://github.com/wez/wezterm/issues/661
refs: https://github.com/wez/wezterm/issues/582
2021-04-08 09:48:47 -07:00
Wez Furlong
064b591a1b fonts: remove ttf_parser, compute coverage from freetype
Replaces the last usage of ttf-parser with calling into freetype.

This removes a source of inconsistency, as ttf-parser doesn't support
all of the things that freetype does.

Notably, this prevents a weird error from blowing up codepoint coverage
calculations on a system where I have helvetica.bdf in my font dir for
long-forgotten reasons.
2021-04-08 09:12:59 -07:00
Wez Furlong
e59e17d773 fonts: remove last use of ttf_parser::fonts_in_collection
improve some diagnostics around fonts on windows
2021-04-08 08:46:10 -07:00
Wez Furlong
024f66ba87 fonts: improve diagnostics 2021-04-08 01:12:37 -07:00
Wez Furlong
14b2537c15 fonts: restore listing of fonts in trace mode
```
WEZTERM_LOG=wezterm_font=trace,info wezterm
```

will list fonts found in font_dirs and the builtin fonts.
It can't show all fonts found via the system locator, because
that only has an interface for finding fonts by matching name,
not listing all of them.
2021-04-08 01:00:13 -07:00
Wez Furlong
88837a0f1d fonts: allow matching against the postscript name 2021-04-08 00:52:06 -07:00
Wez Furlong
99368ad567 fonts: (almost) migrate away from ttf_parser::fonts_in_collection
Use the equivalent functionality from freetype instead.

Just one call site to update on windows; will do that from a
windows machine.
2021-04-08 00:47:11 -07:00
Wez Furlong
a6ebae3be2 refine reduce_first_font_to_family 2021-04-07 23:48:49 -07:00
Wez Furlong
e3fc0a583b win32: cut over to new font matcher
and remove the old one

refs: https://github.com/wez/wezterm/issues/655
2021-04-07 22:36:34 -07:00
Wez Furlong
a8281e4984 font-config: cut over to new matcher
refs: https://github.com/wez/wezterm/issues/655
2021-04-07 22:29:10 -07:00
Wez Furlong
7fb485d4ff parse font width, improve font matching
refs: https://github.com/wez/wezterm/issues/655
2021-04-07 22:07:15 -07:00
Wez Furlong
80aa86fa0c fonts: parse weight and italic into ParsedFont 2021-04-07 20:00:41 -07:00
Glenn Waters
5c7e07bb60 Update docs/config/lua/window/get_dimensions.md
Co-authored-by: Wez Furlong <wez@wezfurlong.org>
2021-04-07 19:00:28 -07:00
Glenn Waters
84a9cd6da3 Create get_dimensions.md
Missing document.

Was not sure how to populate "Since" from the git has. Here is the commit: ba5d50ba9e
2021-04-07 19:00:28 -07:00
Wez Furlong
f35d58a031 fixup win32 build
refs: https://github.com/wez/wezterm/issues/655
2021-04-07 18:17:29 -07:00
Wez Furlong
04cf0de1af fixup build on linux
refs: https://github.com/wez/wezterm/issues/655
2021-04-07 18:14:19 -07:00