Commit graph

133 commits

Author SHA1 Message Date
63072bbe29 yoda: snap monospace cell width via Unicode East Asian Width
Replaces the previous heuristic (font_monospace_em_width.is_none() ⇒ 2
cells) which was reviewed as unsound: Arabic, dingbats, math symbols and
other narrow scripts pulled from non-monospace fallback fonts would all
have been forced to 2 cells. It also didn't handle ZWJ emoji clusters
or ambiguous-width chars correctly.

Proper fix, computed at shape time when `line: &str` is in scope:
- new ShapeGlyph.terminal_cells: u8 (0, 1 or 2)
- populated via unicode-width crate applied to the cluster text
  line[start..end] (harfrust path, uses UnicodeWidthStr) or to the
  single codepoint (no-font fallback path, UnicodeWidthChar)
- layout_to_buffer consumes it when match_mono_width is Some:
      x_advance = cells * mono_width
  instead of the previous round(x_advance / mono_width) * mono_width
  which produced variable cell counts for fallback glyphs.

Covers:
- ASCII + Latin        → width 1  (unchanged visual)
- CJK + fullwidth      → width 2  ✓
- Emoji (incl. ZWJ)    → width 2  ✓  (cluster text handles the ZWJ case)
- Arabic / Hebrew      → width 1  ✓  (was wrongly snapped to 2 before)
- Combining marks      → width 0  ✓  (zero-advance, matches terminals)
- Variation selectors  → width 0  ✓

Limitations: ambiguous-width chars (EAW=A) resolve to 1 via unicode-width
default; a 'cjk' ambiguous mode (unicode-width::UnicodeWidthChar::width_cjk)
could be exposed later as a Buffer flag if needed — not needed for typical
terminal use, matching most wcwidth implementations.

Based on review feedback from lionel@wopr.io on the initial heuristic patch.
2026-04-23 23:20:40 +02:00
Jeremy Soller
c24886c247 0.19.0
Some checks failed
Pages / pages (push) Has been cancelled
Rust / cargo-deny (push) Has been cancelled
Rust / build (push) Has been cancelled
2026-04-22 13:17:01 -06:00
Hojjat
4d74f795cc chore: update hashbrown 2026-04-09 17:59:26 -06:00
Rasmus Kildevæld
158d8ba518 Add swash libm feature to the no_std feature list 2026-04-01 10:25:56 -06:00
Jeremy Soller
f31b9d8695 0.18.2 2026-02-20 15:46:09 -07:00
Jeremy Soller
cc73876fc9 0.18.1 2026-02-20 12:17:18 -07:00
Jeremy Soller
cd1d3aa1ef 0.18.0 2026-02-19 09:31:45 -07:00
Jeremy Soller
4fd11f0e5e 0.17.2 2026-02-18 15:41:27 -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
Jeremy Soller
0d9af4f7de
0.16.0 2025-12-29 14:19:32 -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
Jeremy Soller
c82ee1c5b5
0.15.0 2025-10-30 08:40:58 -06:00
Nico Burns
1140ce89b0 Upgrade skrifa to 0.37, harfrust to 0.3.1
Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-10-02 07:48:04 -06:00
Nico Burns
e04bfd098f
Use linebender_resource_handle instead of peniko (#424)
Signed-off-by: Nico Burns <nico@nicoburns.com>
2025-09-21 06:45:37 -06:00
valadaptive
355b7febb1
Update and fix cargo-deny (#421)
* Update and fix cargo-deny

* We are not free of syn

* More cargo-deny fixes
2025-09-09 07:51:08 -06:00
valadaptive
2610c869f6
Replace rustybuzz with HarfRust (#417)
* Use HarfRust for shaping

* Replace ttf-parser with skrifa entirely

* Fix clippy lints

* Add shape plan cache

* Bump harfrust and skrifa

* Fix no_std build

* Simplify the shape plan cache

* Please the paperclip

* Cache font ID with plan

* Tune shape plan cache for "BiDi Processing" bench
2025-09-08 21:15:27 -06:00
romanstingler
a2f1f4b2a0
refactor: address clippy warnings and improve code quality (#409)
- Fix string formatting with modern interpolation syntax
- Improve Debug implementation with finish_non_exhaustive()
- Fix function placement in shape.rs to avoid items_after_statements warning
- Use more idiomatic Rust patterns (map_or_else, next_back)
- Clean up conditional imports in vi.rs
- Convert multiple methods to `const` functions for optimization and consistency
- Introduce `core_maths` for enhanced no-std compatibility
- Update `Cargo.toml` for the new optional dependency and feature adjustments
2025-08-11 13:58:59 -06:00
romanstingler
e80dbc3607
Optimize BidiParagraphs with ASCII fast path (#408)
* Optimize BidiParagraphs with ASCII fast path - Added fast path for ASCII text that avoids BidiInfo allocation - Added some text shaping benchmarks

* refactor: fix clippy warnings and cleanup imports
2025-08-11 13:15:09 -06:00
Taj Pereira
c597f3755b
Update peniko version to 0.4.0 (#387)
* Update peniko version

* Fix no_std build
2025-05-30 04:50:41 +08:00
tigregalis
b017d7c856
fontdb 0.23 (#383)
* fix bench

* update Cargo.toml fontdb 0.23
2025-04-21 09:58:26 -06:00
Jeremy Soller
9e7a56f083
0.14.2 2025-04-14 08:57:14 -06:00
Jeremy Soller
87a937056d
0.14.1 2025-04-04 11:53:46 -06:00
Taj Pereira
695745ac4f
Store font as peniko::Font behind feature flag (#375)
* Allow exposing Peniko font from cosmic text

* .

* .

* .

* .
2025-04-04 11:19:45 -06:00
Jeremy Soller
6598c7cae8
0.14.0 2025-03-31 12:59:58 -06:00
Jeremy Soller
0483999799
0.13.2 2025-03-11 09:45:30 -06:00
Jeremy Soller
60f2c2b0c2
0.13.1 2025-03-10 11:24:51 -06:00
Jeremy Soller
f7ad0bfa60
0.13.0 2025-03-10 10:57:35 -06:00
dsgallups
e9c809bf28 fix: verifiable MSRV 2025-01-22 17:00:01 -07:00
dsgallups
f05a69a9d9 resolve all lints, update MSRV 2025-01-22 17:00:01 -07:00
HoldMyBeer
166b59f560 Reduce memory usage and loading time of FontSystem 2025-01-10 09:38:43 -07:00
Jeremy Soller
1ab7fc213d
Update swash to 0.2.0 and hook up std feature 2025-01-06 13:39:29 -07:00
koe
caa214a755 Use SmolStr in FamilyOwned instead of String 2024-09-01 07:20:07 -06:00
Jeremy Soller
e16b39f29c Revert "update fontdb, rustybuzz and ttf-parser"
This reverts commit 6f78d23a8c.
2024-08-01 12:45:52 -06:00
MaxVerevkin
6f78d23a8c update fontdb, rustybuzz and ttf-parser 2024-08-01 10:52:00 -06:00
Jeremy Soller
58c2ccd1fb
0.12.1: Make collection of monospace fallback information optional 2024-07-31 10:02:11 -06:00
Jeremy Soller
a03ec6b75f
0.12.0 2024-06-18 15:44:54 -06:00
Jeremy Soller
24fb208953
Downgrade fontdb until iced can update resvg 2024-06-15 18:51:57 -06:00
Kristoffer Ödmark
542b20ca43 Upgrade dependencies, and re-export ttf-parser so that dependents can verify fonts using the same ttf-parser version 2024-06-15 06:05:18 -06:00
Julian Braha
31d3ceca51 Only use libm dependency for no_std feature 2024-06-06 19:42:47 -06:00
Itsusinn
39c4e3e02b refactor: move "rayon" feature under "std" 2024-06-05 08:15:51 -06:00
Itsusinn
658025314c feat: concurrently load & parse fonts 2024-06-05 08:15:51 -06:00
Nico Burns
22e61965aa Enable vi feature for docs.rs build 2024-03-01 10:20:55 -07:00
Christopher Serr
8582173128 Fix no_std build
This fixes the `no_std` build and also makes sure it's tested properly
in the CI workflow.
2024-02-12 10:37:49 -07:00
Jeremy Soller
0cb6eba6e7
0.11.2: Fix glyph start and end when using shape-run-cache 2024-02-09 15:12:33 -07:00
Jeremy Soller
cb447ea8c6
0.11.1 2024-02-08 11:13:33 -07:00
Jeremy Soller
1eb3233373
Add shape-run-cache feature, that can significantly improve shaping performance 2024-02-08 11:12:41 -07:00
Jeremy Soller
8174877407
0.11.0 2024-02-07 14:18:19 -07:00
Jeremy Soller
1b025ae56e
Update swash to 0.1.12 2024-02-01 12:43:08 -07:00