Commit graph

23 commits

Author SHA1 Message Date
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
Imbris
9d2d2dd7a6
Remove shape reset from BufferLine::set_align docs since that isn't performed 2023-08-02 00:15:46 -04: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
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
Christopher Serr
aff886da64 Allow buffer reuse in BufferLine
With the way `BufferLine::set_text` was written, you would always clone
the `String` / `str` that you are passing in, resulting in the function
almost not being any better than simply creating a new `BufferLine`.
This ensures the internal buffer is reused.
2023-03-27 23:14:40 +02:00
Edgar Geier
384c5c1fdc
Remove Mutex from FontSystem 2023-03-12 10:39:56 +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
Hojjat
fff8389bbf Allow set_align to clear the alignment by setting it to None 2023-02-24 08:39:24 -07:00
Hojjat
d313713f44 Removed alignment from Buffer, added alignment per Bufferline to editor-libcosmic 2023-02-23 14:23:56 -07:00
Hojjat
4e7e1cc79e Alignment is based on text direction by default now 2023-02-23 13:45:34 -07:00
Hojjat
00ff5b72f3 Align Left, Right, and Center works 2023-02-22 18:31:49 -07:00
Jeremy Soller
8cc988d374 Run cargo fmt 2023-01-04 20:03:03 -07:00
Audrey Dutcher
cd15418315 Add BufferLine::into_text 2023-01-04 18:41:26 -07:00
Hojjat
b9fef72f76 Added an enum with the option for "No Wraping" 2022-12-20 13:38:34 -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
Jeremy Soller
268805ba0c no_std support 2022-11-08 13:24:14 -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
ac354c3a2a
Remove AttrsList lifetime bound 2022-11-04 09:44:54 -06:00
Jeremy Soller
d49e8881fd
Use image renderer for iced text widget 2022-10-31 12:04:33 -06:00
Jeremy Soller
92cad6fe13
Decouple editing from buffer 2022-10-31 11:24:36 -06:00
Jeremy Soller
88bd1c9235
Add layout_opt and shape_opt getters to TextBufferLine 2022-10-27 17:40:00 -06:00
Jeremy Soller
cce821e99f
Adjust attribute spans when buffer lines change 2022-10-27 14:51:46 -06:00