Commit Graph

12519 Commits

Author SHA1 Message Date
Daniel Wennberg
32f8c71be3 Always clamp scaled glyph to cell
Also take padding into account for centered alignment, necessary since
our constraint type allows asymmetric padding.
2025-10-03 13:44:22 -07:00
Daniel Wennberg
7acf617763 fix(font): Anchor scaling at bounding box center 2025-10-03 13:44:22 -07:00
Mitchell Hashimoto
b99ca6ad97 flush output for our builddata executable (#9019)
Fixes #9018

We were truncated our terminfo causing tmux to not respect some
features.
2025-10-03 13:33:59 -07:00
Mitchell Hashimoto
93c634c866 flush output for our builddata executable
Fixes #9018

We were truncated our terminfo causing tmux to not respect some
features.
2025-10-03 13:32:15 -07:00
Mitchell Hashimoto
fd64b833a4 fix(font): Apply glyph constraints before thickening and centering before quantizing (#8580)
In CoreText, when thickening (font smoothing) is enabled or Ghostty is
synthesizing a bold face, the glyph bounding box is padded to make sure
the thicker glyph can fit. Currently, this happens before applying
constraints (scaling and alignment), which makes the size and position
of constrained glyphs dependent on font size, font thickening strength,
and display DPI.

With this PR, constraints are applied before any other adjustments, and
padding is applied directly to the rasterization canvas without
modifying any metrics.

For consistency, I also moved constraint application above emboldening
in the FreeType code, although under that API, the two operations are
orthogonal as far as I can tell.

Secondly, this PR moves glyph centering above bitmap quantization, as
centering is generally fractional and will therefore undo the quantizing
if done after.

Supersedes #8552.
2025-10-03 12:55:23 -07:00
Daniel Wennberg
f245574087 Fix comment 2025-10-03 12:53:46 -07:00
Daniel Wennberg
5c129205a5 Use correct and consistent pre-constraint glyph rect
In Freetype, measure rect after emboldening, so constraints apply to the
true glyph size like in CoreText.

In CoreText, don't let font smoothing affect the rect (only the canvas).
2025-10-03 12:53:46 -07:00
Daniel Wennberg
96fbff681b Center before quantizing bitmap glyphs 2025-10-03 12:53:46 -07:00
Mitchell Hashimoto
071621a8c2 Fix typos (#9013)
This PR fixes typos I spotted in the project.
2025-10-03 10:04:35 -07:00
Andreas Deininger
a667b740ee Fix typos 2025-10-03 18:52:26 +02:00
Mitchell Hashimoto
f99a6846bc Add update-mirror Nu script to ease mirror updating for deps (#9010)
This adds a new script we can manually run that downloads all the files
that need to be uploaded to the mirror and updates our build.zig.zon.
The upload still happens manually [by me] but this simplifies the task
greatly.
2025-10-03 08:13:45 -07:00
Mitchell Hashimoto
f0eb46ea26 Add update-mirror Nu script to ease mirror updating for deps
This adds a new script we can manually run that downloads all the files
that need to be uploaded to the mirror and updates our build.zig.zon.
The upload still happens manually [by me] but this simplifies the task
greatly.
2025-10-03 07:39:41 -07:00
Mitchell Hashimoto
1c1a56394d apprt/gtk: Zig 0.15 whack a mole 2025-10-03 07:33:58 -07:00
Mitchell Hashimoto
4d97186643 apprt/gtk: fix Zig 0.15 2025-10-03 07:17:35 -07:00
Mitchell Hashimoto
e0cf528576 Zig 0.15 (#9004)
Replaces #8372 

Before merge I'm going to squash this and give @pluiedev coauthor, since
I took a lot of her work. I just have to go through this myself to make
sure I learn all the changes in Zig 0.15, but as I got things, I copy
and pasted her work in. My work is probably less thorough and there are
places we can convert deprecated things, probably, but this results in
green CI.

## Benchmarks

It looks like there are some speed regressions in isolated places. I'm
not sure if this is noise or not, I'm going to keep running some tests.
If someone can check macOS that'd be helpful (my vtebench is down on
macOS atm), cc @qwerasd205 if interested.

On an x86_64 system:


![output](https://github.com/user-attachments/assets/25395c18-2560-45c8-9fd3-d524bc5cbfb8)
2025-10-03 07:12:12 -07:00
Mitchell Hashimoto
569fe92389 fix up merge conflicts 2025-10-03 07:11:48 -07:00
Mitchell Hashimoto
bb98bc744d ci: disable freebsd for now 2025-10-03 07:10:44 -07:00
Mitchell Hashimoto
22caf60263 update a bunch of required Zig versions to 0.15 2025-10-03 07:10:44 -07:00
Mitchell Hashimoto
a41f59837e nix: update to unstable for Zig 0.15 in package 2025-10-03 07:10:44 -07:00
Mitchell Hashimoto
ba100dddff update deps 2025-10-03 07:10:44 -07:00
Mitchell Hashimoto
87b77e1980 ci: cleanup 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
4e3e0ed056 Zig 0.15: Flatpak 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
e1b5464bab Zig 0.15: build snap 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
2af424268a Zig 0.15: emit bench 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
9ec3b1b152 Zig 0.15: webdata 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
f0cfaa9580 zig 0.15: build on macOS 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
0112607532 Zig 0.15: zig build test macOS 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
d59d754e29 Zig 0.15: zig build GTK exe 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
cb295b84a0 Zig 0.15: zig build test 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
3770f97608 terminal: Zig 0.15, lib-vt and test-lib-vt work 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
913d2dfb23 unicode: fix lookup table generation 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
7ec57aeebd Zig 0.15: zig fmt 2025-10-03 07:10:43 -07:00
Mitchell Hashimoto
d02770d292 zig-15: build binary builds 2025-10-03 07:10:41 -07:00
Mitchell Hashimoto
dfa2354fec Implement and use generic approx equality tester (#8979)
Seems like there needs to be a general, easy-to-use solution for
approximate equality testing of containers holding floats (see, e.g.,
https://github.com/ghostty-org/ghostty/pull/8563#pullrequestreview-3281357931).
How's this?
2025-10-03 07:10:16 -07:00
Mitchell Hashimoto
f8ef51fc61 core: add 'command finished' notifications (#8992)
Fixes #8991

Uses OSC 133 esc sequences to keep track of how long commands take to
execute. If the user chooses, commands that take longer than a user
specified limit will trigger a notification. The user can choose between
a bell notification or a desktop notification.
2025-10-03 06:58:29 -07:00
Mitchell Hashimoto
7ac9de7d83 gtk: fix duplicate signal handlers (#9001)
Signal handlers are connected to surface objects in two spots - when a
tab is added to a page and when the split tree changes. This resulted in
duplicate signal handlers being added for each surface. This was most
noticeable when copying the selection to the clipboard - you would see
two "Copied to clipboard" toasts. Ensure that there is only one signal
handler by removing any old ones before adding the new ones.
2025-10-03 06:53:29 -07:00
Mitchell Hashimoto
8ed3a98db2 Fix Weird Behavior in CoreText Shaper (#9002)
You can pretty simply reproduce a crash on `main` in `Debug` mode by
running `printf "مرحبًا \n"` with your primary font set to one that
supports Arabic such as Cascadia Code/Mono or Kawkab Mono, which will
cause CoreText to output the shaped glyphs non-monotonically which hits
the assert we have in the renderer.

In `ReleaseFast` this assert is skipped and because we already moved
ahead to the space glyph (which belongs at the end but is emitted first)
all of the glyphs up to that point are lost. I believe this is probably
the cause of #8280, I tested and this change seems to fix it at least.

Included in this PR is a little optimization: we were allocating buffers
to copy glyphs etc. from runs to every time, even though CoreText
provides `CTRunGet*Ptr` functions which get *pointers* to the internal
storage of these values- these aren't guaranteed to return a usable
pointer but in that case we can always fall back to allocating again.
Also avoided allocation while processing glyphs by ensuring capacity
beforehand immediately after creating the `CTLine`.

The performance impact of this PR is negligible on my machine and
actually seems to be positive, probably due to avoiding allocations if I
had to guess.
2025-10-02 15:36:02 -07:00
Jeffrey C. Ollie
c8ed3031bc gtk: improve signal handler management
Instead of making two separate passes over the surfaces in a split tree
to manage signal handlers, do it in one pass.
2025-10-02 17:22:52 -05:00
Jeffrey C. Ollie
10adef3092 gtk: fix duplicate signal handlers 2025-10-02 17:22:52 -05:00
Qwerasd
efc6e0d673 fix(font/coretext): always prevent shaper from emitting rtl
The solution we had before worked in most cases but there were some
which caused problems still. This is what HarfBuzz's CoreText shaper
backend does, it uses a CTTypesetter with the forced embedding level
attribute. This fixes the failure case I found that was causing non-
monotonic outputs which can have all sorts of unexpected results, and
causes a crash in Debug modes because we assert the monotonicity while
rendering.
2025-10-02 15:32:21 -06:00
Qwerasd
d6063428bd font/coretext: tiny shaper improvements
Reduce potential allocation while processing glyphs by ensuring capacity
in the buffer ahead of time and also using CTRunGet*Ptr functions first
and only allocating for those if that didn't work (it should almost
always work in practice.)
2025-10-02 14:06:58 -06:00
Mitchell Hashimoto
052857b58b fix(config): Make macos-custom-icon null-terminated (#8999)
The config option `macos-custom-icon` wasn't working because, to pass
successfully through the C API to Swift, the string must be
null-terminated.

Fixes
https://discord.com/channels/1005603569187160125/1423192859112116224
2025-10-02 11:44:43 -07:00
Mitchell Hashimoto
16dab3b8dc crash: remove minidump parser (#9000)
We never used it because our minidump files on Linux didn't contain
meaningful information. With Zig's Writergate, let's drop this and
rewrite it later, we can always resurrect it from the git history.

Rejoice @pluiedev
2025-10-02 11:23:45 -07:00
Mitchell Hashimoto
f76dd96c7e crash: remove minidump parser
We never used it because our minidump files on Linux didn't contain
meaningful information. With Zig's Writergate, let's drop this and
rewrite it later, we can always resurrect it from the git history.
2025-10-02 11:09:51 -07:00
Jeffrey C. Ollie
1c23ebc6f1 address review comments 2025-10-02 12:57:53 -05:00
Jeffrey C. Ollie
07124dba64 core: add 'command finished' notifications
Fixes #8991

Uses OSC 133 esc sequences to keep track of how long commands take to
execute. If the user chooses, commands that take longer than a user
specified limit will trigger a notification. The user can choose between
a bell notification or a desktop notification.
2025-10-02 12:40:40 -05:00
Daniel Wennberg
e615b11b2c fix(config): Make macos-custom-icon null-terminated 2025-10-02 10:28:18 -07:00
Mitchell Hashimoto
9c8d2e577e fix(font): Let powerline glyphs be wide (#8994)
#8829 fixed the interaction of Powerline glyphs with other symbols, but
regressed in the handling of the Powerline glyphs themselves by letting
them get caught in an early exit that imposes a constraint width of 1.
This PR fixes the regression and adds corresponding tests. Tried to be
somewhat principled about why the special treatment is warranted, hence
the new helper function `isGraphicsElement`.

**Before**
<img width="270" height="44" alt="Screenshot 2025-10-02 at 00 16 54"
src="https://github.com/user-attachments/assets/9e975434-114c-44d5-a4ed-ac6a954b9d00"
/>

**After**
<img width="270" height="44" alt="Screenshot 2025-10-02 at 00 16 11"
src="https://github.com/user-attachments/assets/20545e74-c9f9-4a6b-9bf0-a7cf1d38c3a0"
/>
2025-10-02 10:08:24 -07:00
Mitchell Hashimoto
f11a4f7a68 Convert framegen to C, add compressed data to source tarball (#8989)
Zig 0.15 removed the ability to compress from the stdlib, which makes
porting our framegen tool to Zig 0.15+ more work than it's worth. We
already depend on and have the ability to build zlib, and Zig is a full
blown C compiler, so let's just use C.

The framegen C program doesn't free any memory, because it is meant to
exit quickly. It otherwise behaves pretty much the same as the old Zig
codebase.

The build scripts were modified to build the C program and run it, but
also to include the framedata in the generated source tarball so that
downstream packagers don't have to do this (although they'll have all
the deps anyways).

**AI disclosure:** The Zig to C conversion was done by Amp. I know C and
reviewed the code. The build system improvements are partially done by
Amp as well but I finished it all out. I've reviewed everything. Full
thread:
https://ampcode.com/threads/T-4e0a80af-3d2a-48d6-bf59-3e2f05eb7673
2025-10-02 06:57:50 -07:00
Daniel Wennberg
85c879f112 fix(font): Let powerline glyphs be wide 2025-10-02 00:12:00 -07:00