Commit graph

809 commits

Author SHA1 Message Date
Hojjat
b0884c0ab1 fix: find decoration spans in bidi text 2026-02-24 19:34:51 -07:00
Hojjat
0666ba14b1 improv: ShapeSpan::decoration_spans holds user-level attrs 2026-02-24 19:34:51 -07:00
Hojjat
e8a6b0cc60 chore: porting to decoration span
fix: BiDi Text Decoration

improv: don't use glyph decorations at all
2026-02-24 19:34:51 -07:00
Hojjat
abdbad308f test: text decoration for bidi text is different
test: bidi and rtl tests for text decoration
2026-02-24 19:34:51 -07:00
Hojjat
af2d269636 fix: import ceil for no_std 2026-02-24 19:34:51 -07:00
Hojjat
61f001b0f7 test: text decoration test 2026-02-24 19:34:51 -07:00
Hojjat
78665aab3b perf: minimize the performance impact of text decoration
Boxed the decoration data to go from 40b to 8b.
The performance is almost unchanged for text without decoration.
2026-02-24 19:34:51 -07:00
Hojjat
6ef1ccbeed improv text decoration visuals 2026-02-24 19:34:51 -07:00
Hojjat
c12b3a9bf2 improv: extract decoration metrics from the font 2026-02-24 19:34:51 -07:00
Hojjat
2758919c80 feat: add TextDecoration rendering 2026-02-24 19:34:51 -07:00
Hojjat
2edae7ef1d feat: add TextDecoration type 2026-02-24 19:34:51 -07:00
Hojjat
892f98cffe ci: ignore bincode being unmaintained 2026-02-24 15:45:42 -07:00
Hojjat
7c2ebf37fc fix: empty lines use span metrics 2026-02-24 14:09:08 -07:00
Jeremy Soller
f31b9d8695 0.18.2 2026-02-20 15:46:09 -07:00
Hojjat
a8873a0536 improv: show ellipsis if nothing else fits
If buffer is small enough that char+ellipsis doesn't fit, then show
ellipsis alone. If buffer is smaller than ellipsis, show nothing.
2026-02-20 15:37:30 -07:00
Hojjat
d304a49536 fix: width 0.0 is valid,return ellipsized if there's non-zero content 2026-02-20 15:37:30 -07:00
Hojjat
a24c55a483 chore: remove unenecessary log and code
After previous fix, there is not need to check to see if ellipsize
middle actually happened. If we reach here, it happened.
2026-02-20 14:23:48 -07:00
Nick
9c2c84432d
Remove completely unnecessary boxing/dyn of ranges introduced in last change. (#473)
Update shape.rs
2026-02-20 13:40:22 -07:00
Hojjat Abdollahi
29ac278e76
fix: off by one in fit_glyphs (#474) 2026-02-20 13:27:42 -07:00
Jeremy Soller
cc73876fc9 0.18.1 2026-02-20 12:17:18 -07:00
Hojjat Abdollahi
e83bd7f7bf
Merge pull request #471 from hojjatabdollahi/hojjat/fix-bidi-zw
Fix aggressive ellipsizing
2026-02-20 12:14:00 -07:00
Jeremy Soller
cd1d3aa1ef 0.18.0 2026-02-19 09:31:45 -07:00
Jeremy Soller
5528523182 Fix compilation for no_std 2026-02-19 09:15:06 -07:00
Hojjat Abdollahi
4819bc30fa
Ellipsize (#467)
* feat: add Ellipsize enum

* chore: API changes needed for ellipsize

Decided not to change "layout()" function for now to avoid breaking the
interface. For now.

* chore: shape ellipsis

* feat: Ellipsize::Start

Since it can only have 1 line, it's easier to implement.

* DROPME: temporarily change rich-text for testing

* test(ellipsize): Testing Ellipsize::Start

Long text in small buffer should produce ellipsis glyphs

* fix: do not need font_system anymore

We moved ellipsis shaping elsewhere so no need to pass font_system to
layout function (which also was recreating a new one in the tests every
time making them take forever).

* feat: Ellipsize::End

* improv(ellipsize): use a single ellipsis shape

* improv: Ellipsie::End && Wrap::None

There is no need to layout the whole line if it's not going to fit.

* fix: mixed bidi text when Ellipsize::End && Wrap::None

* chore: clean up and simplify when line.RTL==span.RTL

* fix(ellipsize): last word is not (word_count -1) if iter().rev()

* refactor(layout): extract the layout algorithm to make it more readable

* improv(ellipsize): Ellipsize::Start && Wrap::None

we iterate in reverse and only layout what's going to be visible

* Revert: delete the previous approach of post processing ellipsis

* doc: explain the interaction between Ellipsize and Wrap

* chore: lower the scope

* feat: Ellipsize the last line of a paragraph

For now only the number of lines is supported

* fix: clear ellipsized field on visual lines

This was causing ellipsis to show on random lines

* chore: remove old tests

will add better tests soon

* chore: clean up changes from previous attempt

* fix: consider the ellipsis width when doing alignment

* feat(ellipsize): add `Height` limit to `Ellipsize`

* fix: ellipsize the start of the last line correctly

* fix: ellipsize at the start of mixed bidi lines

* feat: Ellipsize::Middle

* fix: consider ellipsize::middle when calculating alignment correction

* refactor: improve readability

* refactor: deduplicate "fit_glyphs"

* refactor: combine backward and forward layout into one (wip)

* fix: Backward works in the unified layout_spans

* chore: clean up

* fix: Ellipsize::Middle

* fix: handle large words in bidi boundaries

* chore: clean up and some refactoring

* fix: ellipsis is now the same level as the surrounding text

* fix: try to fit more when ellipsizing::middle

* improv: ellipsis now have the same level as the neighbors

This makes ellipsized RTL text inside a LTR line more readable.

before:

Hello سلام...خوبی؟
Hello خولی؟...سلام

* fix: some extra words were being rendered in Ellipsize::Middle

This was causing the last word (if it's not the same level as the rest)
to be rendered outside the buffer.

* test: a few test cases for ellipsize

* fix: assign the correct byte range to ellipsis

this should fix the panic when selecting or clicking on or near the
ellipsis in the editor.
2026-02-19 09:11:22 -07:00
Jeremy Soller
4fd11f0e5e 0.17.2 2026-02-18 15:41:27 -07:00
Jeremy Soller
82fadd954c Make Motion::Home and Motion::End operate on unwrapped lines, fixes #468 2026-02-18 15:39:41 -07:00
Jeremy Soller
d7dc22dd20
Fix 0.17.1 date in changelog 2026-01-30 15:58:56 -07:00
Jeremy Soller
ae8f1c0737
0.17.1
- Set correct rust-version to 1.89
- Update all dependencies to latest versions
2026-01-30 15:57:17 -07:00
Jeremy Soller
bdd6657fd7
0.17.0 2026-01-29 09:48:18 -07:00
Adam Kowalski
d907e41bf3 fix: resolve no_std build issues in ligature handling 2026-01-29 09:04:48 -07:00
Adam Kowalski
723841f934 fix: improved dynamic ligature probing to handle contextual alternates 2026-01-29 09:04:48 -07:00
Adam Kowalski
c6ce5e69e5 fix: use dynamic font probing to preserve ligatures across break opportunities 2026-01-29 09:04:48 -07:00
Adam Kowalski
5d1db4992a chore: extend fix to != and ++ ligatures, match existing test style 2026-01-29 09:04:48 -07:00
Adam Kowalski
d391a3a166 chore: add unit test and improve comment 2026-01-29 09:04:48 -07:00
Adam Kowalski
8c8c41b05b fix: prevent line break splitting |> ligature sequence
The unicode-linebreak crate treats the pipe character '|' as a break opportunity (BA/AL class). This causes ShapeSpan::build to split text like '|>' into separate ShapeWords. When these words are shaped independently, the font shaping engine cannot form ligatures that cross the word boundary.

This patch manually checks for the '|>' sequence during segmentation and skips the break opportunity, ensuring they remain in the same shaping run.

Added a unit test 'ligature_segmentation' to verify that '|>' remains a single word.
2026-01-29 09:04:48 -07:00
Todd York
ee702e5090 Reorder fields in FontMatchKey to fix fallback logic; Add comments 2026-01-20 08:40:39 -07:00
Todd York
2729d2d49c Refactor override_fake_italic() 2026-01-16 10:43:22 -07:00
Todd York
a288f1d775 Shape as fake italic if no matching italic font exists 2026-01-16 10:43:22 -07:00
Todd York
e9075aeae8 Allow fallback to fonts with mismatched stretch or style 2026-01-16 10:43:22 -07:00
Todd York
cfb7224370 Fix variable font weight for SwashCache::get_outline_commands() 2026-01-16 10:24:38 -07:00
Jeremy Soller
0d9af4f7de
0.16.0 2025-12-29 14:19:32 -07:00
ickshonpe
8cd21a315a The ASCII fast path assumes that the current word has only one attributes span, when it can intersect multiple attribute spans.
This commit adds a check to ensure that all the attribute spans intersecting the word range are compatible before taking the fast path.
Fixes #445
2025-12-22 06:53:47 -07:00
Benjamin Stigsen
7051682e70 Update Harfrust 2025-12-09 07:59:44 -07:00
Jeremy Soller
eebdd01a8e
Update harfrust and skrifa 2025-12-08 12:30:13 -07:00
Héctor Ramón Jiménez
a07a619054 Add set_hinting method to Buffer 2025-12-01 13:59:55 -07:00
Héctor Ramón Jiménez
d779057d9c Replace magic boolean with new Hinting enum 2025-12-01 13:59:55 -07:00
Héctor Ramón Jiménez
48eda6bd7d Draft metrics hinting support 2025-12-01 13:59:55 -07:00
Jeremy Soller
9339446cfa
Add Renderer trait for more flexible rendering of buffers and editors 2025-11-06 11:23:11 -07:00
Jeremy Soller
8a7bc790e5
Round x_advance to nearest monospace width when requested, fixes #237 2025-11-03 15:09:58 -07:00
Jeremy Soller
40fee41332
Fix bench compilation 2025-11-01 08:32:01 -06:00