The name egui_system_fonts is already taken on crates.io. The new name
matches the crate's `SystemFontProvider` type.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cargo-deny is failing on all PRs due to new rustls advisories
(RUSTSEC-2026-0346, -0347, -0348, -0349). This bumps rustls 0.23.45 →
0.23.46 in `Cargo.lock`.
* [x] I have followed the instructions in the PR template
Co-authored-by: Claude <noreply@anthropic.com>
Improes non-`syntect` highlighter in `egui_extras::syntax_highlighting`.
* `TokenType` is now public, with new `CodeTheme::format` and
`CodeTheme::format_mut`, so apps can match the colors to their own theme
* New `TokenType::Function`: an identifier directly followed by `(`
* `/* block comments */` for C, C++, JavaScript, JSON and Rust
* Backslash escapes in strings, so `"say \"hi\""` is one string
* `'single'`, `"""triple"""` and `'''triple'''` strings in Python and
TOML, `'char'` literals in C/C++, and `` `template` `` strings in
JavaScript
* New languages: JavaScript/TypeScript, shell (bash, sh, zsh) and YAML
* `jsonc` and `json5` are now highlighted as JSON
The demo snapshots are rendered with `--all-features`, which uses
`syntect`, so they are unaffected.
The new `egui_extras/tests/syntax_highlighting.rs` snapshot test covers
the fallback highlighter, run by a new CI step without `syntect`.
* [x] I have followed the instructions in the PR template
This PR was written by Claude Code (an LLM) on behalf of @emilk, and
needs a human review before leaving draft.
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
`FileLoader` strips the `file://` prefix but does not percent-decode the
path,
so a `file://` URI with an escape such as `%20` fails to resolve on disk
(the
function's own doc noted "percent un-encoding are not handled").
`convert_uri_to_path` now decodes `%XX` escapes (e.g. `%20` -> space)
after
stripping the scheme, using a small inline decoder so no dependency is
added.
Invalid or truncated escapes are left as-is, and UTF-8 multibyte
sequences round
-trip. Added `%20` cases to the existing `check_convert_uri_to_path`
test for
both the Windows and non-Windows paths.
`cargo test`, `clippy`, and `fmt` pass for `egui_extras`.
Closes#8288
---------
Signed-off-by: 林晨 (Leo Cheng) <leo-cheng@vip.qq.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
SVG supports inlining raster images (PNG/JPEG), `egui-extras` as it
stands does not support this.
`resvg` has a feature for this, it's just a matter of enabling it, this
PR adds an `egui-extras` feature `svg_images` doing exactly that.
---------
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Fix: Refresh Windows title bar after theme changes
**Description**
On Windows, changing the window theme updates egui immediately, but the
native title bar may keep its previous colors until the window
activation state changes.
This sends WM_NCACTIVATE after applying ViewportCommand::SetTheme,
forcing Windows to refresh the non-client title bar state without
changing the real focus.
* Related #8299
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Also make some minor code changes because some structs have been renamed
in `accesskit` and `accesskit_consumer`.
As of today, this requires patching kittest, which has a commit bumping
its version of accesskit_consumer that isn't in a release yet.
I don't mind holding off on landing this for a little bit to see whether
they'll release a new version soon, if you prefer.
* (No issue, since this seems pretty small, but happy to file one if you
like)
* [x] I have followed the instructions in the PR template
---------
Signed-off-by: Alice Boxhall <alice@igalia.com>
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
Lets you tell what is driving a scroll: a mouse wheel, fingers on a
trackpad (not a touch screen), or the OS continuing a trackpad swipe
with momentum.
```rust
pub enum MouseWheelSource {
Unknown,
Wheel,
Trackpad,
Momentum,
}
```
* `Event::MouseWheel` gains `source: MouseWheelSource`. Integrations set
it to `Unknown` if they don't know.
* `InputState::scroll_source() -> Option<MouseWheelSource>`: what is
driving the current scrolling, `Some` while `is_scrolling()`. For a
trackpad that covers the whole gesture (`TouchPhase::Start`…`End`); for
a mouse wheel, until the smoothing of the last notch is done. Touch
screens scroll by dragging with the pointer, not with wheel events, so
`None` there.
Use cases: a `ScrollArea` can rubber-band and hold while fingers rest on
the trackpad, but bounce during momentum (#8663, built on this). A
slider or plot can ignore `Momentum` so a flick doesn't keep changing a
value after the fingers lift.
**Where the source is known**
* macOS (eframe): `Wheel`, `Trackpad` or `Momentum`. winit folds the
macOS momentum phase into the regular `TouchPhase`, so egui-winit reads
`NSEvent::momentumPhase` itself through a local event monitor
(`macos_scroll_momentum.rs`, owned by `State`, removed on drop). Precise
deltas are `Trackpad`, line deltas `Wheel`. Goes away once we are on a
winit with rust-windowing/winit#4732; marked with TODOs.
* winit `PanGesture`: `Trackpad`.
* Everywhere else: `Unknown`. Web `WheelEvent`s carry no phase or source
at all.
**Also**: the 150 ms scroll-action timeout from #8636 is tuned for
flowing events. Fingers resting on a trackpad produce none, so a known
`Trackpad` gesture now survives a 1 s gap before being considered over.
The enum mirrors the one proposed for winit.
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
With wasm threads, `DroppedFileHandle` wasn't `Send + Sync`, so neither
was `Context`, which holds the dropped files.
That broke `egui_extras`'s `http` loader and any code moving a `Context`
to another thread, and contradicts the `context_impl_send_sync` test.
`DroppedFileHandle` is `Send + Sync` everywhere again, and eframe wraps
the `web_sys::File` in a `SendWrapper` (new dependency, `send_wrapper`
0.6).
Checked: the command from the issue, the `check_wasm_atomics` CI
command, and the regular wasm32 build of `egui_demo_app`.
This partly reverts the design of #8354, cc @grtlr.
Fixes#8401
Fallback to `arboard` with `wayland-data-control` if `smithay` does not
find a text MIME type in the clipboard.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
An inspection request is served from a frame, and a minimized or
occluded window runs none: eframe skips the whole pass, and wgpu hands
out no surface texture. An inspector attached to a backgrounded app
could only time out.
* `ViewportCommand::RequestPaintWhileHidden` asks for a painted frame
from a hidden window. It rides the command channel, which already
reaches the integration while hidden (`run_logic` hands it the pending
commands), so `Context` needs nothing new.
* eframe paints when a pending action wants paint: that command, or a
screenshot, which asks for the same thing.
* egui-wgpu captures without a surface texture: the capture renders to
its own texture anyway, and only the present needs the surface. Pending
screenshot callbacks used to be dropped silently whenever the frame
could not be acquired, which also hit visible-but-occluded windows.
`egui_inspection` sends the command, so nothing raises or focuses the
window.
Repro and manual test: `cargo run -p test_inspection_hidden_window`.
Verified on macOS: screenshots and trees are served while the window is
minimized.
Replaces:
* https://github.com/emilk/egui/pull/8566
* [x] I have followed the instructions in the PR template
Written by Claude (LLM).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
`GlyphRasterizer` now has a `FontPriority`:
* `FontPriority::Highest`: asked about every cluster, before any font.
Use it to override how specific glyphs looks
* `FontPriority::Lowest` (default): a fallback, only asked about
clusters no installed font (or `FontProvider`) has. Same as before.
Several rasterizers can be installed; within a tier they are asked in
order, and the first `Some` wins.
```rust
ctx.add_glyph_rasterizer(
egui::GlyphRasterizer::new(|request| (request.cluster == "…").then(|| my_ellipsis(request)))
.with_priority(egui::FontPriority::Highest),
);
```
API changes (all unreleased): `Context::set_glyph_rasterizer(Option)` →
`add_glyph_rasterizer` / `set_glyph_rasterizers(Vec)`, same on
`epaint::Fonts`.
Follow-up to:
* https://github.com/emilk/egui/pull/8512
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Updated: `enum-map` 3.1, `env_logger` 0.11.11, `font-types` 0.12.4,
`image` 0.25.10, `log` 0.4.34, `smallvec` 1.16, `webbrowser` 1.2.4, plus
transitive bumps.
`syn` is now allowed to be duplicated in `deny.toml`: the ecosystem is
migrating from syn 2 to syn 3, and syn is build-time only, so the
duplicate costs compile time, not binary size. That unblocks `enum-map`
3.1, `serde` 1.0.229 and `thiserror` 2.0.20.
Held back (comments in `Cargo.toml` explain why): `accesskit*` (kittest
0.4), `glow` (wgpu 30), `harfrust`/`skrifa` (fontique, glifo), `resvg`
(tiny-skia via winit), `smithay-clipboard` (winit), `wasm-bindgen`
family.
* [x] I have followed the instructions in the PR template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
# What it does
Addition of a new system of theme plugins which allow the user to use
different rules engine to compute the style for the available
specialised widget style.
# How to use
Create a engine implementing the trait `ThemePlugin` and `ThemeStyle<S:
StyleStruct>` and implement the necessary methods, then register this
way (example for `ButtonStyle`):
```ui.add_theme::<ButtonStyle>(&mycustomengine);```
Now all button will call the `ThemeStyle<ButtonStyle>` method to compute the correct style and later use the cached value to avoid the costly computation.
If no valid `ThemeStyle<S>` or engine is available then it fallback to the default style.
* Closes part of <https://github.com/emilk/egui/issues/3284>
* [x] I have followed the instructions in the PR template
---------
Co-authored-by: adrien <221212@umons.ac.be>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <hi@lucasmerlin.me>
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template
* Closes#4654
* Related #4667
* [x] I have followed the instructions in the PR template
This PR avoids materializing the contents of a file that was dragged
into an egui application on the web. It does so by storing the
`web_sys::File` handle directly on WASM.
This breaks the existing API of `DroppedFile` on the web, because there
is no way to retrieve the bytes synchronously form a `DroppedFile`
anymore, forcing handling call sites to become asynchronous.
The native API remains the same.
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Hi, I may or may not have used your crate but I'd like to say a quick
thank you for it anyway!
I'm going down the list of reverse dependencies on `memoffset`.
This PR aims to remove the `memoffset` crate from your dependencies.
[`core::mem::offset_of`](https://doc.rust-lang.org/core/mem/macro.offset_of.html)
was stabilised in rustc 1.77 which I believe is at or below your MSRV.
The `memoffset` crate 0.9.1 says that
> If you're using a rustc version greater or equal to 1.77,
> this crate's offset_of!() macro simply forwards to
core::mem::offset_of!().
I consider it very unlikely (see
[here](https://github.com/rust-lang/rust/issues/111839)) for any usage
of the `offset_of!` macro to break but please check anyway.
I hope we can all enjoy the benefits of one less dependency :)
---
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
* [x] I have followed the instructions in the PR template *except for
`./scripts/check.sh` which doesn't run in my environment* (I'm unwilling
to chase it down because I'm firing off a whole bunch of these PRs to
various repositories, sorry.)
`cargo clippy` gives 1 unrelated warning.
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Replaces `home::home_dir` with `std::env::home_dir` as these functions
do the exact same thing
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md)
before opening a Pull Request!
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.
Please be patient! I will review your PR, but my time is limited!
-->
Removes dependency home from eframe by replacing `home::home_dir` with
`std::env::home_dir`. `home` was probably originally used since
`std::env::home_dir` was once deprecated because of a bug. Post Rust
version 1.87 this has been fixed and now these two functions do exactly
the same thing.
* [X] I have followed the instructions in the PR template
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Semver-compatible dependency updates (~200 transitive crates in
`Cargo.lock`), plus housekeeping of the version pins in `Cargo.toml`.
## Changes
* Normalize version strings in `[workspace.dependencies]`
(`similar-asserts = "2.0"`, `unicode_names2 = "3.1"`)
* `cargo update`: bump all semver-compatible transitive dependencies
* `itertools` 0.14 → 0.15; the duplicate with puffin's 0.14 /
criterion's 0.13 is now allowed in `deny.toml`
* `rand_core` duplicate (0.6 via phf_generator's rand 0.8, 0.10 via
getrandom 0.4/chacha20) also allowed in `deny.toml` — rand ecosystem is
mid-migration
* `toml` lock moved to 1.1.2 — the old winnow-duplicate blocker is gone
(winit's `toml_edit` now uses winnow 1.x), so the stale comment is
removed
* `wgpu` got a lock-only patch bump 29.0.1 → 29.0.4 (still on the 29.x
line; wgpu 30 intentionally not taken)
## Held back (would fail `cargo deny` with duplicate crates)
* `env_logger` 0.11.8 — newer pulls env_filter 1.x, duplicating the
0.1.x that android_logger needs
* `image` 0.25.6 — needs png 0.18, blocked on resvg
* `smithay-clipboard` 0.7.2 — pulls calloop 0.14, duplicating winit's
0.13
* accesskit platform adapters — newer ones need accesskit_consumer
0.36/0.37, duplicating the 0.35 that kittest 0.4 pins (comments added
for `accesskit_consumer`/`accesskit_winit`)
* wasm-bindgen family kept at 0.2.108 per the sync comment
Majors still blocked (documented in `Cargo.toml`):
`font-types`/`skrifa`/`harfrust` (vello_cpu 0.0.9), `resvg` (winit
0.30).
Verified: `scripts/cargo_deny.sh` green on all targets, `cargo clippy
--all-features --all-targets` clean.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
When an agent screenshots the app using the mcp and then interacts with
the app by clicking at coords, they see the coords in the native image
coords. Since the mcp does everything else in logical coordinates, it
helps if the image they see is also in logical resoltution, so we always
downscale it to 1.0.
I've added this here to avioid having to decode and re-encode the image
in the mcp.
Unfortunately it only does downscaling for now, since adding some way to
upscale the image just for the screenshot would add a lot of complexity,
and might be invasive from a plugin.
I've also changed the submit call to take a closure, to make it easier
to use other transport channel (makes the implementation for reruns mcp
nicer).
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Lucas Meurer <lucas@rerun.io>
Introduces live inspection for running egui apps over a small TCP
request/response protocol, plus the `egui::Plugin` that serves it.
This is the minimal surface to get the egui mcp in, we may want to
extend this in the future to add support for the inspection gui.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Related to #56 (Improve text — tracking issue)
## Summary
This PR integrates [harfrust](https://crates.io/crates/harfrust) (a
pure-Rust port of HarfBuzz) into epaint's text layout pipeline,
replacing the character-by-character glyph positioning with proper
OpenType text shaping.
### What this enables
- **GPOS kerning**: most modern fonts only ship kerning in GPOS tables
(not the legacy `kern` table). Pairs like "AV", "VA", "AT" are now
properly tightened.
- **GSUB substitutions**: ligatures (fi, fl), contextual alternates, and
other OpenType features.
- **Combining marks**: diacritics (e.g. ɔ̃) are positioned via anchor
tables instead of being rendered as standalone replacement glyphs.
### Before/After
#### Kerning, etc.
<img width="838" height="726" alt="before_main"
src="https://github.com/user-attachments/assets/f0f26d5f-b117-43a6-b39c-ea40d2e73836"
/>
<img width="838" height="726" alt="after_harfrust"
src="https://github.com/user-attachments/assets/d983e5da-486c-4f39-bd4f-5782a90c6b39"
/>
#### Ligatures
<img width="1117" height="698" alt="before_closeup"
src="https://github.com/user-attachments/assets/7a3b08b4-cf6f-45b7-98ba-07c473cd3b02"
/>
<img width="1117" height="698" alt="after_closeup"
src="https://github.com/user-attachments/assets/6cfc5f21-d32f-4f09-be0c-59c8c553d44f"
/>
### Architecture
The shaping integrates into the existing pipeline without changing the
public API:
1. **`Font::segment_into_runs`** — segments text into contiguous runs by
font face (grapheme-cluster aware, never splits combining sequences)
2. **`FontFace::shape_text`** — calls harfrust to shape each run,
returning glyph IDs + positioned advances/offsets
3. **`layout_shaped_run`** — emits `Glyph` structs from the shaping
output, with NOTDEF fallback to other font faces for missing glyphs
4. **Buffer recycling** — `FontsImpl` pools a `harfrust::UnicodeBuffer`
to avoid per-layout allocations
### Disclaimer
I'm far from being a good Rust programmer. Claude Code did most of the
heavy lifting here. I did my best and used my limited knowledge to avoid
making too many mistakes. If this PR isn't up to quality standards,
please don't hesitate to close it.
## Test plan
- [x] `cargo test -p epaint` — all 18 text tests pass, including 6 new
ones
- [x] `cargo clippy -p epaint --all-features` — clean
- [x] `cargo fmt` — clean
- [ ] Snapshot tests need regeneration (expected: shaping changes glyph
positions)
- New tests added:
- `test_gpos_kerning` — verifies GPOS kerning tightens "AV", "VA", "AT"
pairs
- `test_combining_diacritics` — combining tilde doesn't add extra width
- `test_shaping_basic_latin` — sanity check for Latin text
- `test_shaping_empty_string` — empty input doesn't panic
- `test_shaping_multiple_newlines` — newline splitting works correctly
- `test_shaping_mixed_font_fallback` — Latin + emoji in same string
---------
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>