Jeremy Soller
497003e67e
Fall back to buffer line height only if no glyphs found
2024-06-06 19:38:40 -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
Jeremy Soller
b0a70c70ff
Fix horizontal scrolling to start of empty line
2024-05-30 14:36:18 -06:00
Jeremy Soller
cb9d405c20
Fix horizontal scroll to end of line
2024-05-30 14:33:35 -06:00
Jeremy Soller
570999809c
Track horizontal scroll (which must be implemented by renderers)
2024-05-30 14:26:38 -06:00
Jeremy Soller
10d5888d11
Ensure at least one line is in Buffer
2024-04-30 12:21:21 -06:00
Jeremy Soller
0cfd9b64ef
Add line ending abstraction ( #250 )
...
* Add line ending abstraction
* Make Buffer::set_text use LineIter
* Add ctrl+s for saving to editor
2024-04-30 12:12:25 -06:00
Jeremy Soller
003f73e679
Set default buffer wrap to WordOrGlyph
2024-02-02 10:45:24 -07:00
Jeremy Soller
a11f68f13d
Format
2024-01-17 13:31:03 -07:00
Mohammad AlSaleh
329941c4a6
Try harder to succeed at fall-backing to a Monospace font
...
A combination of some ideas:
* Try all Monospace fonts before giving up.
* Relax exact weight restriction on font matching when trying Monospace
fall-back. Try smaller weights if needed.
* Make the fall-back try order weight-offset aware, AND script-aware.
* And finally, add the option to adjust the font size of glyphs using
fall-back Monospace fonts, so the width of them matches the default
font width.
For my use-case, the current fall-back attempt always fails with
Arabic script. And none of the Arabic-supporting Monospace fonts in
my system also support medium weight. So, if my default font is set
to medium weight, script-aware fall-back alone will still not work.
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2024-01-17 13:31:03 -07:00
Jeremy Soller
46d60a3723
Implement Clone for Buffer and use Arc::make_mut
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
80d120dfa5
Ensure that all shaping and layout uses scratch buffer
2024-01-17 13:31:03 -07:00
Jeremy Soller
5d1aa67804
Improve reliability of layout_cursor
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
afc5b525f1
Buffer: fix max scroll going one line beyond end
2023-11-30 14:51:22 -07:00
Jeremy Soller
19ae07bd3b
Fix some clippy lints
2023-11-15 09:21:13 -07:00
Jeremy Soller
241c4ca357
Buffer::set_rich_text: Only add attrs if they don't match the defaults
2023-11-02 10:24:28 -06:00
Jeremy Soller
d53932bd7c
Add function to set metrics and size simultaneously
2023-10-31 20:40:46 -06:00
Jeremy Soller
ad10e7373b
Require default Attrs to be specified in set_rich_text
2023-10-27 13:08:27 -06:00
Jeremy Soller
1eab951e27
Merge pull request #149 from tigregalis/set-rich-text
...
Add `Buffer::set_rich_text` method
2023-09-11 10:58:39 -06:00
John Nunley
64e469718b
Use a scratch buffer to reduce allocations
...
This commit adds a new ShapeBuffer type, which contains some buffers tha
are commonly re-created during the shaping process. New APIs are added
that take this structure, and old APIs are turned into wrappers around
the new API.
The goal is to reduce the number of per-layout allocations that happen
in a typical layout call.
2023-08-16 14:09:54 -07:00
John Nunley
440d24ffa0
Add more Debug implementations
...
I generally like to implement Debug on these kind of types.
2023-07-07 21:44:21 -07:00
tigregalis
fb8bb60972
update comments
2023-06-30 20:40:12 +08:00
tigregalis
7db01ebf3a
use core::mem::{replace, take} not std::
2023-06-30 20:31:29 +08:00
tigregalis
48f6aefb80
remove unnecessary into_iter in doctests
2023-06-27 21:59:58 +08:00
tigregalis
4a05c9c1cf
add BorrowedWithFontSystem<_>::set_rich_text
2023-06-27 21:53:27 +08:00
tigregalis
f092bdde73
add Buffer::set_rich_text method
2023-06-27 21:53:05 +08:00
Héctor Ramón Jiménez
eb09cf0259
Introduce PhysicalGlyph for offsetting and scaling
2023-06-20 06:07:24 +02:00
Jeremy Soller
e8b10fd675
Base selection on the top of the line
2023-06-16 07:03:43 -06:00
Jeremy Soller
10bf182c5d
Fix line wrap and scroll
2023-06-16 06:51:11 -06:00
Héctor Ramón Jiménez
431163dc35
Consider the centering_offset for visibility in LayoutRunIter
2023-06-16 02:25:45 +02:00
Héctor Ramón Jiménez
c2bef6a345
Align glyphs in a LayoutRun to baseline
2023-06-16 02:15:44 +02:00
Jeremy Soller
b5f45f81f6
Merge pull request #124 from tigregalis/iter-bidi-para
...
Replace use of `str::Lines` with `unicode-bidi`-based iterator
2023-06-09 07:03:07 -06:00
tigregalis
6e336ad1cd
replace use of str::lines with BidiParagraphs
2023-06-09 11:26:07 +08:00
tigregalis
2ed9c34796
use Buffer::new_empty in Buffer::new
2023-06-09 11:11:42 +08:00
tigregalis
cfb6760fa2
introduce Buffer::new_empty
2023-06-09 11:09:16 +08:00
Dima Rets
0eb08d218c
allow setting cursor color
2023-06-08 20:04:56 +01:00
Héctor Ramón Jiménez
87d75531b7
Allow Shaping::Basic only if swash feature is enabled
2023-04-21 20:47:02 +02:00
Héctor Ramón Jiménez
0f055c0a13
Replace skip_shaping boolean with Shaping enum
2023-04-21 20:24:44 +02:00
Héctor Ramón Jiménez
ad111a1df1
Add skip_shaping flag to avoid expensive shaping when not needed
2023-04-19 00:24:43 +02:00
13r0ck
e790e8e718
use checked_sub to fix panic on window resize.
...
bug link: https://github.com/iced-rs/iced/issues/1773
2023-03-30 12:40:14 -06:00
Edgar Geier
3331f41d7a
Improve documentation
2023-03-12 10:39:57 +01: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
Jeremy Soller
bd27ca8ad8
Merge pull request #88 from geieredgar/clippy-fixes
...
Fix clippy warnings
2023-03-02 14:53:08 -07:00
Edgar Geier
6c501c6640
Fix clippy warnings
2023-03-01 22:58:41 +01:00