Commit Graph

7966 Commits

Author SHA1 Message Date
Jacob Sandlund
b58656be8a Merge branch 'uucode-update' into vs-correctness 2025-11-24 09:14:32 -05:00
Jacob Sandlund
61c7381452 Update comment. PR for wcwidth_standalone might be a bit 2025-11-24 09:14:03 -05:00
Jacob Sandlund
55c1cb3aad Merge branch 'uucode-update' into vs-correctness 2025-11-23 22:56:15 -05:00
Jacob Sandlund
62ec34072f fix typo 2025-11-23 22:56:00 -05:00
Jacob Sandlund
36c3295806 unicode: don't narrow invalid text presentation (VS15) sequences 2025-11-23 22:39:21 -05:00
Jacob Sandlund
97926ca307 Update uucode to the latest, for future width and grapheme break changes 2025-11-23 17:26:25 -05:00
Mitchell Hashimoto
df466f3c73 renderer: make cursorStyle depend on RenderState
This makes `cursorStyle` utilize `RenderState` to determine the
appropriate cursor style. This moves the cursor style logic outside the
critical area, although it was cheap to begin with.

This always removes `viewport_is_bottom` which had no practical use.
2025-11-22 14:36:53 -08:00
Mitchell Hashimoto
3283f57fd2 lib-vt: expose RenderState API 2025-11-21 16:01:22 -08:00
Mitchell Hashimoto
82f5c1a13c renderer: clear renderstate memory periodically 2025-11-21 09:03:03 -08:00
Mitchell Hashimoto
2ecaf4a595 font/shaper: fix harfbuzz tests 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
3d56a3a02b font/shaper: remove old pre-renderstate logic 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
c892599385 terminal: cache some selection state to make render state faster 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
7728620ea8 terminal: render state dirty state 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
86fcf9ff4a terminal: render state selection 2025-11-20 22:00:44 -08:00
Mitchell Hashimoto
a15f13b962 terminal: renderstate tests 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
5d58487fb8 terminal: update renderstate to use new assert 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
6e5e24c3ca terminal: fix lib-vt test builds 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
cd00a8a2ab renderer: handle normal non-osc8 links with new render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
fa26e9a384 terminal: OSC8 hyperlinks in render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
81142265aa terminal: renderstate stores pins 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
b8363a8417 terminal: update render state for new dirty tracking 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
cc268694ed renderer: convert bg extend to new render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
07115ce9a9 terminal: render state contains raw row data 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
d1e87c73fb terminal: renderstate now has terminal colors 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
ebc8bff8f1 renderer: switch to using render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
9162e71bcc terminal: render state contains cursor state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
2d94cd6bbd font: update shaper to support new renderstate 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
29db3e0295 terminal: setup selection state on render state 2025-11-20 22:00:43 -08:00
Mitchell Hashimoto
0e13fd6b73 terminal: add more render state tests 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
4caefb807c terminal: fix up some performance issues with render state 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
5d85f2382e terminal: render state needs to preserve as much allocation as possible 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
a860801323 terminal: updating render state with tests 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
3f7cee1e99 terminal: render state fixes for empty cells 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
040d7794af renderer: build up render state, rebuild cells with it 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
a66963e3f8 terminal: full redraw state tracking on render state 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
bbbeacab79 terminal: renderstate needs dirty state 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
60fe4af8ac terminal: render state style get requires non-default style 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
789b3dd38d terminal: RenderState.row_data is a MultiArrayList 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
7195cab7d3 benchmark: add RenderState to ScreenClone benchmark 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
a90fe1656a terminal: RenderState 2025-11-20 22:00:42 -08:00
Mitchell Hashimoto
5f3645433c font: round cell height from line height instead of ceiling (#9648)
This change should give more consistent results between high and low DPI
displays, and generally approximate the authorial intent of the metrics
a little better.

Also changed the cell height adjustment to prioritize the top or bottom
when adjusting by an odd number depending on whether the face is higher
or lower in the cell than it "should" be. This should make it easier for
users who have an issue with a glyph protruding from the cell to adjust
the height and resolve it.
2025-11-20 20:00:26 -10:00
Mitchell Hashimoto
ffe4afe538 fix(font/CoreText): make system fallback fonts work again (#9649)
The code that re-creates the font descriptor from scratch using the same
attributes also rubs off the magic dust that makes CoreText not throw a
fit at us for using a "hidden" system font (name prefixed with a dot) by
name when we use the descriptor. This means that a small subset of chars
that only have glyphs in these fallback system fonts like ".CJK Symbols
Fallback HK Regular" and ".DecoType Nastaleeq Urdu UI" would not be able
to be rendered, since when we requested the font with the non-magical
descriptor CoreText would complain in the console and give us Times New
Roman instead.

Using `CTFontDescriptorCreateCopyWithAttributes` to clear the charset
attribute instead of recreating from scratch makes the copy come out
magical, and CoreText lets us instantiate the font from it, yippee!

### ℹ️ For anyone who came to this PR from a search engine rabbit hole
trying to figure this out for your own code:
It seems like if you want to use one of these fonts, you have to avoid
creating a new descriptor from scratch with the name. To create a
descriptor with one of these names that CoreText won't get upset about,
you have to get it in one of these ways (there may be others but these
are ones that definitely work at time of writing):
- Get it from `CTFontCreateForString`(`WithLanguage`) with a character
only provided by that font.
- Get it from `CTFontCreateUIFontForLanguage` or any of the mechanisms
for generally receiving a system font that you don't necessarily have
full control over the exact choice of font with.
- Get it from a collection created with
`CTFontCollectionCreateMatchingFontDescriptors`
- Get it from `CTFontCreateWithGraphicsFont` ... and it seems that for
now, `CGFontCreateWithFontName` lets you use these "hidden" names
without complaining :)

I wouldn't trust any of these methods to necessarily *continue* working
in to the future, since Apple seems to be trying to dissuade
*intentional* use of any particular named hidden system font.
Realistically, the `CreateForString` option is the most likely to stick
around.

If all else fails, check FireFox or Chrome's source code to see how
they're solving it in current year.

And to help it get indexed for those looking for it...
<details>
<summary>CoreText's angry message</summary>

```
CoreText note: Client requested name ".CJKSymbolsFallbackHK-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[NSFont systemFontOfSize:].
CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.
```

</details>
2025-11-20 19:59:34 -10:00
Mitchell Hashimoto
9955b43e0c Underline Drawing Fixes (#9654)
Reworked the undercurl and dotted underline to use z2d, the undercurl is
almost identical (slightly better, it has rounded end caps now) but
without the really complicated code, and the dotted underline is greatly
improved since it now draws as anti-aliased dots that are evenly spaced
instead of rectangles that might have uneven spacing at the wrong font
size.

Also fixes #9394 since I added code that makes sure that none of the
underlines is drawn off of the edge of the canvas (the padding only goes
so far, after all).

|Size|Adjustments|Before|After|
|-|-|-|-|
|32|none|<img width="640" height="964" alt="image"
src="https://github.com/user-attachments/assets/20e44d89-5825-496e-b197-bd1ca6c685f7"
/>|<img width="640" height="964" alt="image"
src="https://github.com/user-attachments/assets/b1fb8499-26fd-42ec-8186-1677ab29048b"
/>|
|11|none|<img width="234" height="358" alt="image"
src="https://github.com/user-attachments/assets/5db89f15-128c-4780-826c-a4f59026a0af"
/>|<img width="234" height="358" alt="image"
src="https://github.com/user-attachments/assets/c9a2855a-284e-46d8-b824-0ada2a0ac386"
/>|
|9|underline +8, overline -8|<img width="206" height="294" alt="image"
src="https://github.com/user-attachments/assets/7b3a6d7e-9bb5-4ebb-8881-57878553a47d"
/>|<img width="206" height="294" alt="image"
src="https://github.com/user-attachments/assets/3a8dc97e-7f71-4c6b-821c-49262e6ff9a9"
/>|
2025-11-20 11:09:05 -10:00
Qwerasd
3280cf7d34 font/sprite: rework dotted underline
Draw proper anti-aliased dots now instead of rectangles, thanks to z2d
this is very easy to do, and the results are very nice, no more weird
gaps in dotted underlines if your cell is the wrong number of pixels
across.
2025-11-20 13:36:09 -07:00
Qwerasd
81a6c24186 font/sprite: rework undercurl, fix out of bounds underlines
Use z2d to draw the undercurl instead of the manual raster code we had
before- the code was cool but unnecessarily complicated. Plus z2d lets
us have rounded caps on the undercurl which is neat.

Also make sure we won't draw off the canvas with our underlines-- the
canvas has padding but it's not infinite.
2025-11-20 12:48:39 -07:00
Qwerasd
1fd7606db6 font: round cell height from line height instead of ceiling
This change should give more consistent results between high and low DPI
displays, and generally approximate the authorial intent of the metrics
a little better.

Also changed the cell height adjustment to prioritize the top or bottom
when adjusting by an odd number depending on whether the face is higher
or lower in the cell than it "should" be. This should make it easier for
users who have an issue with a glyph protruding from the cell to adjust
the height and resolve it.
2025-11-20 10:16:11 -07:00
Daniel Wennberg
c937276976 Clarify window-title-font-family availability 2025-11-20 08:57:46 -08:00
Jon Parise
a4e65f02b4 fish: add descriptions to fish shell completions (#9551)
Add descriptions to fish shell completions 

Claude Code used to understand the codebase and reason through the edge
cases (several iterations)

- Using first sentence from the Config to add description for each
config, even if sentence spans few lines
- Several options can share the same description, code doesn't duplicate
description, see screenshot in the posted issue thread below

Fixes [#9531](https://github.com/ghostty-org/ghostty/issues/9531)
2025-11-20 09:15:35 -05:00
Qwerasd
a347406137 fix(font/CoreText): make system fallback fonts work again
The code that re-creates the font descriptor from scratch using the same
attributes also rubs off the magic dust that makes CoreText not throw a
fit at us for using a "hidden" system font (name prefixed with a dot) by
name when we use the descriptor. This means that a small subset of chars
that only have glyphs in these fallback system fonts like ".CJK Symbols
Fallback HK Regular" and ".DecoType Nastaleeq Urdu UI" would not be able
to be rendered, since when we requested the font with the non-magical
descriptor CoreText would complain in the console and give us Times New
Roman instead.

Using `CTFontDescriptorCreateCopyWithAttributes` to clear the charset
attribute instead of recreating from scratch makes the copy come out
magical, and CoreText lets us instantiate the font from it, yippee!
2025-11-19 22:03:37 -07:00
Qwerasd
aa2f31179b CoreText: Apply subpixel horizontal alignment also when cell width is less than advance (#9646)
Follow-up to #9432 to ensure that subpixel horizontal alignment is
consistent whether `cell_width = @round(face_width)` rounds up or down.
2025-11-19 21:51:15 -07:00