Commit graph

45 commits

Author SHA1 Message Date
Hojjat
7c2ebf37fc fix: empty lines use span metrics 2026-02-24 14:09:08 -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
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
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
4de1b13494
Add DISABLE_HINTING cache flag 2025-07-02 10:58:08 -06:00
Stewart Connor
e828131c92 fix for test.sh 2025-03-31 17:03:51 +11:00
dsgallups
f05a69a9d9 resolve all lints, update MSRV 2025-01-22 17:00:01 -07:00
koe
0935f549ee add alignment option to Buffer::set_rich_text 2024-09-01 15:26:38 -06:00
Jeremy Soller
93a7df859a Allow for undefined buffer width and/or height, fixes #70 2024-06-12 09:14:56 -06:00
Pavel Strakhov
10ae9a9b16 Add an option to set selected text color 2024-06-10 10:15:09 -06:00
Jeremy Soller
37688747e1 Use line height from attrs 2024-06-06 19:38:40 -06:00
Jeremy Soller
8638ec29bb Add metrics to attributes 2024-06-06 19:38:40 -06:00
Nico Burns
a53a0b3a8c Convert rich-text example to winit 2024-03-03 17:22:33 -07:00
Jeremy Soller
bd5f2f95e8 Add capability to synthesize italic 2024-01-17 13:31:03 -07:00
Jeremy Soller
cbbf6f0d8f Allow Editor to use reference or Arc of Buffer 2024-01-17 13:31:03 -07:00
Jeremy Soller
ae030e9885 Move color and x_opt out of Cursor 2024-01-17 13:31:03 -07:00
Jeremy Soller
d0b4b4635e Refactor of scroll and shaping
- Scroll is identified by line index and layout index, instead of just
  layout index
- Shaping has the option to prune, where caches outside of the scroll
  view are cleared
- Syntax editor no longer requires layout of all lines, only of lines
  inside scroll
- BufferLine has a metadata field that can be used by other abstractions
  to know when text was changed
2024-01-17 13:31:03 -07:00
Jeremy Soller
018a2e9d2a Move cursor motions to new Motion enum, move handling to Buffer 2024-01-17 13:31:03 -07:00
Jeremy Soller
ad10e7373b
Require default Attrs to be specified in set_rich_text 2023-10-27 13:08:27 -06:00
tigregalis
0d9173c05b update rich_text example with set_rich_text 2023-06-27 21:56:17 +08:00
Héctor Ramón Jiménez
0dce8b75d1
Fix examples 2023-04-21 20:35:59 +02:00
Jeremy Soller
3c7dc1f657
Remove monospaced from attrs 2023-03-30 08:04:52 -06:00
Edgar Geier
384c5c1fdc
Remove Mutex from FontSystem 2023-03-12 10:39:56 +01:00
Edgar Geier
46e9ef0246
Make BorrowedWithFontSystem borrow FontSystem mutably 2023-03-12 10:39:56 +01:00
Edgar Geier
057b5b6fa9
Extract borrow of FontSystem from Buffer 2023-03-12 10:39:54 +01:00
Edgar Geier
4e93853765
Remove lifetime from SwashCache 2023-03-01 22:41:59 +01:00
Héctor Ramón Jiménez
4320ae6329
Use f32 instead of i32 for lengths
This allows users to use logical coordinates instead of physical ones.
2023-02-28 03:39:31 +01:00
Jeremy Soller
8cc988d374 Run cargo fmt 2023-01-04 20:03:03 -07:00
Andrew Wheeler
8614a7a398 Updated RangeMap to Add Clear(). 2022-12-30 08:33:00 -07:00
Jeremy Soller
ee54e7626b
Vi-style editor and other editor improvements (#40)
* WIP VI wrapper for editor

* WIP: block cursor

* Create Edit trait, run CI on all feature options

* Add prints describing build steps to ci.sh

* Custom rendering for Vi editor

* Clippy fixes

* More clippy fixes

* Show clippy results in CI

* Fix for Redox

* Fix clippy lint

* Add vi feature to enable vi-style editor

* Add escape to libcosmic text box
2022-11-15 12:26:59 -07:00
Ian Douglas Scott
0d3fb1dd9d Use ouroboros in FontSystem to avoid lifetime bound
Perhaps not quite what ouroboros is expected to be used for, but it's
not too bad, and avoiding the lifetime bound can be a huge help.
2022-11-04 10:37:32 -06:00
Jeremy Soller
92cad6fe13
Decouple editing from buffer 2022-10-31 11:24:36 -06:00
Jeremy Soller
b9c01f1a81
Make rich text example editable 2022-10-27 14:52:10 -06:00
Jeremy Soller
e4c8d4ba6b
Make attribute spans use ranges and update docs 2022-10-27 09:56:53 -06:00
Jeremy Soller
3ece9236b3
Use Color in more places 2022-10-27 09:07:47 -06:00
Jeremy Soller
559a83faa5 Improve attribute setting 2022-10-26 18:45:31 -06:00
Jeremy Soller
536c24355c
Always redraw on resize 2022-10-26 18:13:14 -06:00
Jeremy Soller
99ae0d1bee
Scale rich-text and syntax examples 2022-10-26 18:05:38 -06:00
Jeremy Soller
851e55d950
Add markdown sample 2022-10-26 15:37:26 -06:00
Jeremy Soller
77d416b2fd
Add ligatures and increase text size for rich text example 2022-10-26 15:21:30 -06:00
Jeremy Soller
ea64291abb
Make it possible to set attributes per glyph 2022-10-26 15:16:06 -06:00
Jeremy Soller
4798c7ee1a
Add initial rich text example 2022-10-26 14:16:48 -06:00