21 Commits

Author SHA1 Message Date
Gordon Cassie
b76f5976ee Remove unnecessary allocation. 2024-04-30 10:20:50 -07:00
Mitchell Hashimoto
9b4e362a33 font/coretext: shaping ligatures adds padding cells for replaced cells
Fixes #1708

Harfbuzz does this automatically. Our tests for harfbuzz test this. We
had a todo in CoreText to mimic this but wasn't sure if it was useful.
Turns out, it is important (see bug!)
2024-04-30 10:14:43 -07:00
Mitchell Hashimoto
188d25b5d9 font/coretext: fix merge issue from #1662 2024-04-08 17:07:00 -04:00
Mitchell Hashimoto
e66e82787b Merge pull request #1662 from mitchellh/fontmem
Dedupe font stack for terminals with identical font configuration
2024-04-08 16:57:58 -04:00
Mitchell Hashimoto
edac4a113f font/coretext: shaper may return multiple runs and that's okay
Fixes #1664

I previously asserted that we got exactly one run from CoreText because
I assumed that our run iterator was perfectly splitting runs for
CoreText. This assumption appears to be false and that seems okay.

The test case in this commit produces two runs that are directly next to
each other and there's no downside to simply iterating over them. So
this commit changes to iterate over the runs.
2024-04-08 10:52:50 -04:00
Mitchell Hashimoto
de2b0f6857 font: Atlas updated to use monotonic ID 2024-04-05 21:10:10 -07:00
Mitchell Hashimoto
c88137d254 font/shaper: work on new grid APIs 2024-04-05 20:21:13 -07:00
Mitchell Hashimoto
329697779a renderer/metal: convert more 2024-04-05 18:51:26 -07:00
Mitchell Hashimoto
eb4d21fcbf font/coretext: handle two-byte utf16 followed by more chars 2024-04-04 21:31:07 -07:00
Mitchell Hashimoto
6ace9e9d19 font/coretext: unit tests pass on macOS 2024-04-04 14:46:46 -07:00
Mitchell Hashimoto
e41e45e1ad font/coretext: face doesn't need harfbuzz font if we're not using it 2024-04-04 12:18:28 -07:00
Mitchell Hashimoto
c5bbbdb5ee font/coretext: better comment coretext shaper 2024-04-04 12:06:59 -07:00
Mitchell Hashimoto
61d3da1bf6 font/coretext: respect quirks fonts for shaper 2024-04-04 12:02:43 -07:00
Mitchell Hashimoto
b124378f5c font/coretext: remove todo for font features 2024-04-04 11:34:20 -07:00
Mitchell Hashimoto
de11063679 font/coretext: shaper supports user-defined font features 2024-04-04 11:25:46 -07:00
Mitchell Hashimoto
f0f53bd8b1 font/shaper: fix CoreText shaper to compile with latest terminal changes 2024-04-03 10:14:17 -07:00
Mitchell Hashimoto
f447e6f9df font: insert blank cells for multi-cell ligatures for styling
Up to this point, every font I've experienced with ligatures has
replaced the codepoints that were replaced for combining with a space.
For example, if a font has a ligature for "!=" to turn it into a glyph,
it'd shape to `[not equal glyph, space]`, so it'd still take up two
cells, allowing us to style both.

Monaspace, however, does not do this. It turns "!=" into `[not equal
glyph]` so styles like backgrounds, underlines, etc. were not extending.

This commit detects multi-cell glyphs and inserts synthetic blank cells
so that styling returns. I decided to do this via synthetic blank cells
instead of introducing a `cell_width` to the shaper result because this
simplifies the renderers to assume each shaper cell is one cell. We can
change this later if we need to.

Annoyingly, this does make the shaper slightly slower for EVERYONE to
accomodate one known font that behaves this way. I haven't benchmarked
it but my belief is that the performance impact will be negligible
because to figure out cell width we're only accessing subsequent cells
so they're likely to be in the CPU cache and also 99% of cells are going
to be width 1.
2024-01-06 19:22:25 -08:00
Mitchell Hashimoto
34cdb871f5 font/coretext: clarify buggy coretext shaper 2023-12-11 21:42:49 -08:00
Mitchell Hashimoto
114723af9e font/coretext: shaper applies x/y offsets 2023-12-11 21:22:30 -08:00
Mitchell Hashimoto
fcd9de0311 font/coretext: coretext shaper is cleaner 2023-12-11 12:56:30 -08:00
Mitchell Hashimoto
62a5fe0236 font/shape: add coretext shaper 2023-12-11 11:13:49 -08:00