Commit graph

755 commits

Author SHA1 Message Date
Jeremy Soller
5cc64c77c1
Better handling of newlines in editor insert and delete 2025-10-09 12:21:38 -06:00
Jeremy Soller
c5deb38cfe
If buffer is empty, do not set line ending 2025-10-09 11:02:00 -06:00
mikenu
6514323fbe Update README.md 2025-10-04 13:23:50 -06:00
mikenu-jp
73a0beedbf Fix: Add missing Urdu UDHR link with stable URL based on new OHCHR site structure (#350) 2025-10-04 13:23:50 -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
Erik McClure
3c1f6c9e8a
Add alignment parameter to set_text (#419)
* add alignment parameter to set_text

* Fix doc comment
2025-09-07 12:40:42 -06:00
shadow3
750e1a4dd1
feat(editor): Implement pixel-based scrolling for the Editor (#418)
Refactors the Editor's scrolling implementation to be pixel-based instead of line-based. This provides smoother and more granular scrolling, which works more consistently across different input devices (like trackpads).

- The `Action::Scroll` variant now takes `pixels: f32`.
- The `Editor` now processes scroll actions using pixel values directly.
- Examples have been updated to reflect the new scrolling behavior.
2025-09-07 12:39:38 -06:00
romanstingler
f7033bb043
Add explicit lifetimes to borrowed return types (#411) 2025-08-11 14:17:00 -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
romanstingler
de355a1fd9
feat: add ASCII fast path optimization to ShapeWord::build() (#407)
- Skip expensive grapheme iteration for simple ASCII words
- 32% performance improvement for code-like text
- 5-7% improvement for general ASCII content
- No regressions for Unicode text processing
- Conservative ASCII detection maintains correctness
2025-08-04 13:49:52 -06:00
Vancha
7646989d6f
Fixed Tab indenting the line instead of adding Tab or spaces (#403)
* Update editor.rs

* Makes sure indent_required is calculated according to the selection type

removed the redundant check for required_indent == 0,
introduced a slightly different path for when no selection = None, and calculated the required tab width and indent position accordingly.

* Undo typo

undid an accidental move of a redraw call outside of a loop

* Corrected indenting with rustfmt

formatted the code with rustfmt to pass the failing CI checks
2025-07-16 14:39:48 -06:00
callym
85b07b4c8c
Add pixel font flag (#402) 2025-07-08 08:58:24 -06:00
Wren [Undefined]
a03faa654d
Variable font support (#400)
* Variable font support

Here's a pretty naïve solution for variable fonts.

The iterator doesn't use the match keys' weight, but instead tries to
get the requested ideal weight, if the font is variable, otherwise it is
ignored and the actual (non-variable) weight is used. This is because I
didn't implement finding variable weight support for match keys; doing
so would be impossible without parsing TTF files when matching and I
didn't want to add that potentially expensive infrastructure if not
entirely necessary.

This is a breaking change, and I'm open for ideas on how to fix that
if it's an issue.

* cargo fmt

* Add variable font example to rich-text example
2025-07-07 08:50:40 -06:00
Jeremy Soller
d15011fba5
Format code 2025-07-02 11:02:56 -06:00
Jeremy Soller
9c16ca004a
Fix doc comment on DISABLE_HINTING 2025-07-02 10:59:24 -06:00
Jeremy Soller
4de1b13494
Add DISABLE_HINTING cache flag 2025-07-02 10:58:08 -06:00
Jeremy Soller
b7eb658166
Transform outline if fake italic provided 2025-07-02 10:57:33 -06:00
Joshix-1
6b3f6cb95e
Fix #386 do not ignore font family (#399)
Font family know gets used when querying the font.
Not sure if this solution is good, if the old code is even needed.
This works for me, which makes it good enough for me.
2025-07-02 10:32:01 -06:00
Erik McClure
f9e43cf355
Fix scroll when vertical offset is exactly layout_height (#401) 2025-07-02 10:29:54 -06:00
Erik McClure
3b1aa511d1
Clip based on ascent and descent, not baseline (#396)
Due to https://github.com/pop-os/cosmic-text/pull/141 the LayoutRunIter incorrect checks to see if the baseline is past the visible bounds of the buffer, instead of using the maximum ascent and maximum descent from the baseline.
2025-06-28 13:03:47 -06:00
Jeremy Soller
bcfb05a390
Revert "Round glyph advance to integer sizes (#384)"
This reverts commit 987ff45ff2.
2025-06-22 13:05:00 -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
mahkoh
987ff45ff2
Round glyph advance to integer sizes (#384)
This is in line with [1].

[1]: https://skia.googlesource.com/skia/+/refs/heads/chrome/m136/src/ports/SkTypeface_fontations.cpp#539
2025-05-14 15:00:30 -06: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
tigregalis
b347487712
use BuildHasher::default() not BuildHasher::new() (#381) 2025-04-14 08:55:16 -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
7b79d720cf
Merge pull request #371 from StewartCanva/stewart-add-kerning-ligatures
Add support for kerning and ligature font features
2025-03-31 08:41:10 -06:00
Stewart Connor
e828131c92 fix for test.sh 2025-03-31 17:03:51 +11:00
Stewart Connor
53763c157b Merge branch 'refs/heads/main' into stewart-add-kerning-ligatures
# Conflicts:
#	src/attrs.rs
2025-03-31 13:42:12 +11:00
Jeremy Soller
64fd3481f1
Require Fallback implementations to be Send + Sync 2025-03-28 10:33:40 -06:00
tigregalis
b027bab538 use alloc ToOwned and String 2025-03-28 15:57:33 +00:00
tigregalis
35eda69cb1 formatting 2025-03-28 15:57:33 +00:00
tigregalis
16015d7ea6 Document Fallback trait 2025-03-28 15:57:33 +00:00
tigregalis
bdd7882a94 set visibility of Fallbacks to pub(crate) 2025-03-28 15:57:33 +00:00
tigregalis
fb3a7c1a1c Reuse fallbacks 2025-03-28 15:57:33 +00:00
tigregalis
7fb685fa13 Pre-compute the fallbacks on FontFallbackIter::new 2025-03-28 15:57:33 +00:00
tigregalis
ae0fb9b561 Support non-static list of fallbacks 2025-03-28 15:57:33 +00:00
tigregalis
9a4d80d116 derive Debug on PlatformFallback 2025-03-28 15:57:33 +00:00
tigregalis
b32c831f1b export Fallback, PlatformFallback 2025-03-28 15:57:33 +00:00
tigregalis
a67dded054 Use fallback list via dyn trait in FontSystem 2025-03-28 15:57:33 +00:00
Stewart Connor
4e6d5d731b rm std 2025-03-28 15:55:47 +00:00
Stewart Connor
08822cac2e add letter spacing 2025-03-28 15:55:47 +00:00
Stewart Connor
03180dd9ee nits 2025-03-26 17:45:21 +11:00