363 Commits
Author SHA1 Message Date
xtqqczze 092dcf70d8 style: Add newline after inner attribute for readability (#8130)
Add a newline after inner attributes to make it clear that the
attribute applies to the enclosing item rather than the following item.
2026-09-05 15:31:29 +02:00
HuaGu-Dragon fff02ca501 perf: Simplify string case conversions to ASCII only (#7890) 2026-07-07 09:37:16 +02:00
Wez Furlong 514bb39a7d fixup some mismatched_lifetime_syntaxes warnings 2025-10-05 10:59:20 +01:00
Rebecca Turner bf9a2aeeba Fix mismatched_lifetime_syntaxes warnings
Fixes a bunch of warnings like this:

```
warning: hiding a lifetime that's elided elsewhere is confusing
   --> window/src/os/macos/window.rs:670:23
    |
670 |     fn display_handle(&self) -> Result<DisplayHandle, HandleError> {
    |                       ^^^^^            ------------- the same lifetime is hidden here
    |                       |
    |                       the lifetime is elided here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
    |
670 |     fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
    |                                                     ++++
```

This lint was added in Rust 1.89: https://github.com/rust-lang/rust/issues/141787
2025-09-09 07:05:12 -07:00
mgpinf 9606fa2569 Add font configuration option for ActivateCommandPalette, CharSelect, PaneSelect (#6696)
* feat: option to configure font for ActivateCommandPalette, CharSelect, PaneSelect

Add configuration option for font for the below entities:
- ActivateCommandPalette
- CharSelect
- PaneSelect

For the above entities, if the font is not set in configuration, it
defaults to the font resolved in config.window_frame.font. This is in
order to maintain existing behavior of using the font resolved in
config.window_frame.font

* docs: documentation for added configuration options

Add documentation for below configuration options:
- command_palette_font
- char_select_font
- pane_select_font

* refactor: rename EntityFont to Entity

* docs: add example configuration in char_select_font

Apply changes mentioned in suggestion:
https://github.com/wezterm/wezterm/pull/6696#discussion_r1986085165

* docs: add example configuration in pane_select_font

Apply changes mentioned in suggestion:
https://github.com/wezterm/wezterm/pull/6696#discussion_r1986085165

* docs: add example configuration in command_palette_font

Apply changes mentioned in suggestion:
https://github.com/wezterm/wezterm/pull/6696#discussion_r1986085165

* refactor: calculate make_bold in make_entity_font_impl method

* refactor: resolve font_size based on Entity

Since we can fetch font_size based on entity, we resolve it in
'make_entity_font_impl'. This removes the need to pass the pref_size
parameter

Apply changes mentioned in suggestions:
https://github.com/wezterm/wezterm/pull/6696#discussion_r1986085350
https://github.com/wezterm/wezterm/pull/6696#discussion_r1986085949
2025-03-09 15:34:32 -07:00
Wez Furlong edcdefda3b workspace-ify the deps
There have been a couple of attempts at this in the past, which
had some usability warts in what I recall as an earlier, less
useful set of features overall.

Whether that was collective misunderstanding at the time, or things
have gotten better since then, now is a good time to adopt the workspace
dep syntax, because wezterm has many crates to keep on top of, and
automation like dependabot can't see a lot of them.

This will help to manage the versions of deps in wezterm centrally.

Let's try this out in CI: the Cargo.lock changes here are minimal
(eliminated a second version of base64 from one crate, terminal_size
from another, and removed an explicit dep on serde_derive) so
hopefully this sails through on !linux.

closes: https://github.com/wezterm/wezterm/pull/6668
2025-02-12 09:43:36 -07:00
Wez Furlong b6ec0b03d6 macos: suppress warnings from legacy objc crate
This is a PITA. The objc crate does some stuff that spews warnings
everywhere that the sel! and msg_send! macros are used.

That crate is not currently maintained

There is a fork of the crate which resolves the spew, but we also
use the cocoa crate which pulls in the original crate

The new fork is not compatible with cargo workspace patching.

There is an alternative objc2 crate with a nicer, more type-safe
API, but the API changes to migrate are pretty huge: I just lost
a couple of hours on this and still hadn't gotten past the migrating
the NSMenu stuff over.

So, the approach here is to simply ignore the warnings in the modules
that use the objc crate.

This will need to be fixed by someone someday, but that day is not
today.

refs: https://github.com/SSheldon/rust-objc/issues/125
2025-02-07 22:23:22 -07:00
Wez Furlong 11c4b11669 s,wez/wezterm,wezterm/wezterm,
I moved the repo to an org of its own. Update various things
to reference the new location.
2025-02-07 13:08:01 -07:00
Wez Furlong 00644d4e1a update for new wezterm.org domain 2025-02-06 21:13:50 -07:00
Wez Furlong f847bd284d hbwrap: from_raw_parts handling of null ptr
use similar approach to 67d4ba9f76

closes: https://github.com/wez/wezterm/pull/6337
closes: https://github.com/wez/wezterm/issues/6336
2024-10-30 21:54:04 -07:00
Wez Furlong 56a27e93a9 cargo update
plus some noise around the image crate api evolving and deprecating
some type aliases.
2024-07-30 08:27:27 -07:00
Wez Furlong 209d13bd6b allow some unused fields
I want these for the future, and they are harmless now
2024-07-14 07:50:30 -07:00
Wez Furlong 9bfcb69139 deps: metrics -> 0.23
refs: https://github.com/wez/wezterm/pull/5512
2024-06-07 17:53:46 -07:00
Wez Furlong 90822d64a3 deps: remove duplicate memmap2 2024-05-13 11:45:47 -07:00
Wez Furlong 6c890c3995 update metrics to latest version (0.22) 2024-05-13 09:41:12 -07:00
Wez Furlong 281b6e2740 deps: update metrics to a more recent version
This isn't the latest version of metrics; it's just a more recent
version that allows us to remove a duplicate ahash dependency from the
build graph.
2024-05-13 09:41:11 -07:00
Wez Furlong 14d426fea8 add cargo deny config, update lru 2024-05-13 08:29:36 -07:00
Wez Furlong 265b85be1d update image to 0.25
This improves how non-conforming jpegs are decoded and displayed.

refs: https://github.com/wez/wezterm/issues/5365
2024-05-05 16:14:46 -07:00
Pi-Cla ee61e61e4f [PATCH] Fix various cargo audit errors
closes: https://github.com/wez/wezterm/pull/5206
2024-05-04 22:47:57 -07:00
Wez Furlong 67d4ba9f76 fix when running on rust 1.78
std::slice::from_raw_parts will now panic if the ptr is null.
Resolve this by adding our own wrapper that translates that
case to an empty slice.
2024-05-04 15:53:28 -07:00
Wez Furlong a77ff4b846 fix some warnings with newer rust
The warning is that some of the variants are never read.
In the case of ftwrap, they are referenced via ffi.
For the other locations, we want them for debug purposes.
2024-04-28 19:54:54 -07:00
Wez Furlong 21af10e0f6 be smarter about NO_HINTING
Only use it when we think the dpi is high, otherwise use the
default freetype parameters.

refs: https://github.com/wez/wezterm/issues/4908
refs: https://github.com/wez/wezterm/issues/4902
2024-01-31 07:55:10 -07:00
Wez Furlong c4f16fe339 macos: constrain fallback to normal attributes
refs: https://github.com/wez/wezterm/issues/4808
2024-01-29 20:02:54 -07:00
Wez Furlong c75c15b9ca macos: fall back to old font fallback approach
In https://github.com/wez/wezterm/issues/4877 it became clear that
the newer approach for finding fallback fonts is only better than
the old approach in some cases, so this commit adds a fallback
to the old approach if the new one didn't yield any usable results
for a given codepoint.

refs: #4099
2024-01-28 16:19:58 -07:00
Wez Furlong e23ab47239 macos: ignore LastResort font in fallback suggestions
refs: https://github.com/wez/wezterm/issues/4877
2024-01-27 23:28:20 -07:00
Xiaopeng Li a84e5fedb1 impl FT_PIXEL_MODE_LCD_V 2024-01-23 06:26:28 -07:00
Wez Furlong ba85958a61 deps: update env-logger
Note that we are pinned on 0.10 for env-bootstrap, where we use it
only for its module filter parser.
2024-01-20 16:01:10 -07:00
Daniel Koukola 9a5af15323 Fix freetype_load_target 2024-01-11 06:54:51 -07:00
Wez Furlong c75f20f21c deps: ordered-float -> 4.1.0
closes: https://github.com/wez/wezterm/pull/4338
2023-09-28 14:39:22 -07:00
Wez Furlong 50cc44a53a font-config: failed to resolve clusters like 3065,2686
Root cause is that font-config will try to find a single font that
satisfies a query like `fc-list ':charset=2686 3065'`, but if that
is impossible, there are no results.

The resolution is to split the query up and look for each individual
codepoint.

refs: #4310
2023-09-20 18:54:17 -07:00
Wez Furlong 70931f58f1 fonts: improve categorization, selection of pcf fonts
Match out bold, semicondensed etc. from the full name.

Allow matching a font based on the full path to the font as
an alternative, because pcf fonts tend to have terrible
metadata and many pixel variants.

refs: https://github.com/wez/wezterm/issues/4256
2023-09-11 07:58:10 -07:00
Wez Furlong d35f067deb hbwrap: fix compilation on aarch64
refs: https://github.com/wez/wezterm/issues/4213
2023-08-28 06:39:14 -07:00
Wez Furlong 551af58637 font: refactor: extract ClusterResolver to file scope 2023-08-28 06:39:14 -07:00
Wez Furlong ce7e5a2799 font: hbwrap: add harfbuzz caret API 2023-08-28 06:39:14 -07:00
Wez Furlong c91e124f41 fonts: fix potential panic for bitmap space glyphs with 0 size 2023-08-22 23:34:08 -07:00
Wez Furlong e4ea6a6c4b fonts: capture palette info when parsing fonts 2023-08-22 19:12:47 -07:00
Wez Furlong 67f4450d8f fonts: detect colr glyphs better
Freetype's support for colr is relatively rudimentary, which is fine,
but we want more control, so we probe a bit harder to figure out
whether a glyph has colr information before allowing freetype
to rasterize it, so that we have the opportunity to reroute
that rendering to our own logic.
2023-08-22 07:35:55 -07:00
Wez Furlong 7af61159a8 font: port over radial gradient fills 2023-08-22 06:43:58 -07:00
Wez Furlong 85bb023295 font: refactor: extract common function 2023-08-21 09:40:24 -07:00
Wez Furlong dd6f2a4d7f fonts: stub out sweep gradient 2023-08-21 09:38:18 -07:00
Wez Furlong 40083f55b8 font: refactor: reuse ColorLine and gradient structs 2023-08-21 09:30:40 -07:00
Wez Furlong 01fd28fc02 refactor: extract colr from freetype -> colr.rs 2023-08-21 09:19:22 -07:00
Wez Furlong 64dd96917d fonts: repurpose experimental_svg_fonts -> ignore_svg_fonts
Now we can optionally skip loading svg fonts, making our default
to continue to try to use them.

We don't actually support interpreting svg data, but we do now
support COLR v1 data which is found in some of those same fonts.

refs: https://github.com/wez/wezterm/issues/4148
2023-08-20 22:59:22 -07:00
Wez Furlong e1044a6d5f font: colr: add font_colr_rasterizer option
The harfbuzz driven rasterization of COLR glyphs is superior to
my attept at a freetype driven rasterizer, so let's default to
the harfbuzz version.

This change means that the default for most regular glyphs is
freetype, but we'll use harfbuzz for COLR glyphs.
2023-08-20 22:55:02 -07:00
Wez Furlong 017432d0cf freetype: colr: fixup crazy scaling issue in char selector
Popping open the char selector could result in comedy-sized emoji
that dramatically overflow the bounds.

The reason for that is that glyphcache isn't smart enough to notice
when the glyph.height exceeds the cell_height and allows the glyph
bitmap to be rendered at the rasterized size.

The reason for that glyph being so huge is that freetype is producing
outlines that are too large.  The font metrics have the requested
x and y ppem values (eg: the nominal font size in pixels), but also
x and y scaling values that are not set to 1.  The result is that
the produced extents are too large by those x and y scaling values.

I'm not sure why that is, but it is simplest and most self-contained
to adjust for that scale factor when we rasterize via cairo, so that
is what we do here.
2023-08-20 19:55:56 -07:00
Wez Furlong b6ba87ad3c fonts: tidy up some warnings 2023-08-20 17:46:34 -07:00
Wez Furlong 8f4f9653c5 font: adjust metrics for pre-scaled bitmap glyphs
When using the harfbuzz rasterizer with a bitmap glyph, the result
is a rasterized glyph that is pre-scaled to the cell dimensions.

We need to tell glyphcache that that has happened, otherwise it
will apply the same scale factor again.
2023-08-20 17:32:42 -07:00
Wez Furlong 84720a18f0 fonts: stick with ft based metrics for now
I think I've got the right values going in and out, so I think
it's ok to turn this on, but I'm worried about legacy non-opentype
formats that freetype supports but harfbuzz doesn't.

Let's stick with ft's metrics until I find time to validate
the behavior.
2023-08-20 16:52:33 -07:00
Wez Furlong 536c3fa4da rasterizer/freetype: tune debug logging 2023-08-20 15:31:33 -07:00
Wez Furlong 7264030a28 fonts: adopt fixed crate for freetype fixed-point math
This found at least one bug and should prevent future bugs.
2023-08-20 15:19:30 -07:00