1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-03 23:30:04 -04:00
Commit Graph

8 Commits

Author SHA1 Message Date
Emil Ernerfeldt
74b128451a Merge branch 'main' into feat/harfrust-text-shaping
# Conflicts:
#	crates/egui_demo_lib/tests/snapshots/image_kerning/image_dark_x1.png
#	crates/egui_demo_lib/tests/snapshots/image_kerning/image_dark_x2.png
#	crates/egui_demo_lib/tests/snapshots/image_kerning/image_light_x1.png
#	crates/egui_demo_lib/tests/snapshots/image_kerning/image_light_x2.png
2026-03-29 10:02:11 +02:00
Emil Ernerfeldt
eb35f7d12f Improve test of text rendering 2026-03-29 10:00:36 +02:00
gcailly
c7ce4eeb6f Bump vello_cpu 0.0.6 → 0.0.7 and update snapshots
Update vello_cpu to 0.0.7, which produces slightly different
rasterization output. All snapshot tests have been regenerated.

Note: skrifa cannot be bumped to 0.41.0 in this PR because it
pulls in read-fonts 0.38, while harfrust 0.5.2 depends on
read-fonts 0.37. The two FontRef types are incompatible.
2026-03-28 14:15:57 +01:00
gcailly
210b54ad82 Fix tab character advance width after harfrust shaping
The text shaper doesn't handle tab stops — override the advance width
to TAB_SIZE × space width in layout_shaped_run, matching the previous
character-by-character behavior.
2026-03-27 12:23:37 +01:00
gcailly
24154bff10 Update image_kerning snapshots (GPOS kerning changes positioning) 2026-03-26 16:37:39 +01:00
Lucas Meurer
14afefa252 Fix galley width calculation being off due to subpixel binning (#7972)
- fix for https://github.com/rerun-io/reality/pull/1075

The galleys row size was calculated by looking at the last glyphs pos_x,
which got changed to be rounded to integers when we added subpixel
binning. This introduced a subtle bug which caused the width of galleys
to be slightly off.
This PR fixes this by looking at the actual cursor position instead,
which is not rounded.

Also added a test to ensure this is correct. Previously, for the second
and last line, the `x` was too close to the `0`.

<img width="48" height="67" alt="image"
src="https://github.com/user-attachments/assets/a69a4cc3-b3f3-4553-ab92-73cb2e7a358c"
/>

---------

Co-authored-by: lucasmerlin <8009393+lucasmerlin@users.noreply.github.com>
2026-03-12 13:49:16 +01:00
valadaptive
609dd2d28e Replace ab_glyph with Skrifa + vello_cpu; enable font hinting (#7694)
<!--
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!
-->

* Closes N/A
* [x] I have followed the instructions in the PR template

I'll probably come back to this and clean it up a bit. This PR
reimplements ab_glyph's functionality on top of Skrifa, a somewhat
lower-level font API that's being used in Chrome now.

Skrifa doesn't perform rasterization itself, so I'm using
[vello_cpu](https://github.com/linebender/vello) from the Linebender
project for rasterization. It's still in its early days, but I believe
it's already quite fast. It also supports color and gradient fills, so
color emoji support will be easier.

Skrifa also supports font hinting, which should make text look a bit
nicer / less blurry.

Here's the current ab_glyph rendering:

<img width="1592" height="1068" alt="image"
src="https://github.com/user-attachments/assets/2385b66e-23f8-4c6e-b8c2-ea90e0eea4e4"
/>

Here's Skrifa *without* hinting--it looks almost identical, but there
are some subpixel differences, probably due to rasterizer behavior:

<img width="1592" height="1068" alt="image"
src="https://github.com/user-attachments/assets/a815f3e9-65ac-4940-bc00-571177bef53d"
/>

Here's Skrifa  *with* hinting:

<img width="1592" height="1068" alt="image"
src="https://github.com/user-attachments/assets/d6cc0669-3537-4377-bba9-ed5ef09664db"
/>

Hinting does make the horizontal strokes look a bit bolder, which makes
me wonder once again about increasing the font weight from "light" to
"regular".

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2025-12-06 16:11:33 +01:00
Emil Ernerfeldt
92de16a88c Fix kerning snapshot test directory 2025-10-09 15:50:36 +02:00