Commit graph

234 commits

Author SHA1 Message Date
bjorn3
95e36249d5 Remove the dependency on ouroboros
This reduces compilation time by removing a dependency on syn and other
dependencies of ouroboros_macros. In addition it saves a lot of unused
codegened methods.

On my laptop (2 core + HT) this reduces compilation time by ~20%. On a
many core system this doesn't help much though as the critical path path
consists of both ttf-parser -> rustybuzz and swash. Further gains will
likely need to be made by reducing compilation time for these crates.

Benchmark 1: cargo build
  Time (mean ± σ):     25.150 s ±  0.167 s    [User: 84.414 s, System: 7.335 s]
  Range (min … max):   24.909 s … 25.444 s    10 runs

Benchmark 1: cargo build
  Time (mean ± σ):     19.819 s ±  0.226 s    [User: 67.754 s, System: 5.592 s]
  Range (min … max):   19.492 s … 20.140 s    10 runs

The code is based on an expansion of the ouroboros macro, cleaned up to
remove all unused methods and inline most functions that are only called
once.
2023-06-08 18:00:42 +02:00
Jeremy Soller
f2445987fb
Merge pull request #118 from pop-os/checked_sub
Use checked_sub to fix panic on window resize.
2023-03-31 06:43:30 -06:00
Jeremy Soller
615dc51907
Merge pull request #119 from CryZe/fix-no-std-signature
Fix `FontSystem::new_with_locale_and_db` Signature
2023-03-31 06:42:26 -06: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
Jeremy Soller
3c7dc1f657
Remove monospaced from attrs 2023-03-30 08:04:52 -06:00
Christopher Serr
71281a5d79 Fix FontSystem::new_with_locale_and_db Signature
It turns out that the `no_std` version of
`FontSystem::new_with_locale_and_db` doesn't match the `std` version.
This fixes that.
2023-03-29 22:36:54 +02:00
Jeremy Soller
521acb64e0
Merge pull request #117 from CryZe/reuse-memory-in-set-text
Allow buffer reuse in `BufferLine`
2023-03-27 18:27:46 -06: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
Christopher Serr
8a14734033 Expose rustybuzz in the public API
This exposes `rustybuzz` on top of `fontdb`. This is in particular
useful if you want to query the font for additional information. This is
already publically exposed via `Font::rustybuzz()`, but the types were
not re-exported, so it was impossible to properly use that function.
2023-03-27 23:08:32 +02:00
Jeremy Soller
9ebbc33792 Merge branch 'mut-font-system' of https://github.com/geieredgar/cosmic-text into geieredgar-mut-font-system 2023-03-17 18:15:45 -06:00
Edgar Geier
d297a6a48a
Call get_font lazily 2023-03-14 00:39:50 +01:00
Hojjat
05b069911a Fix indices (suggestions by geieredgar) 2023-03-13 13:08:35 -06:00
Hojjat
01e609f3d6
Merge branch 'pop-os:main' into fix-layout-overflow 2023-03-13 11:40:42 -06:00
Hojjat
7fa51c6404 Fixed some typos 2023-03-13 08:50:24 -06:00
Edgar Geier
f86acd325c
Lazily call make_shared_face_data 2023-03-13 11:15:36 +01:00
Hojjat
8d503af956 bugfix: mixed ltr+rtl overflow 2023-03-12 21:37:10 -06:00
Edgar Geier
af4378d753
Add db_mut method to FontSystem 2023-03-12 10:39:58 +01:00
Edgar Geier
41468c17a2
Fix doctest 2023-03-12 10:39:58 +01: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
Edgar Geier
bff5aaaea3
Make FontSystem not self-referencing 2023-03-12 10:23:54 +01:00
Jeremy Soller
c4a8d521f6 Add default Redox font directory (/ui/fonts) 2023-03-08 21:01:53 -07:00
Jeremy Soller
e43cc03354 Use std font system for redox 2023-03-08 20:44:26 -07:00
Edgar Geier
2c1d564d62
Update fontdb dependency to version 0.13 2023-03-03 13:07:49 +01:00
Jeremy Soller
eca804c732
Revert "Make FontSystem not self-referencing and update fontdb and rustybuzz" 2023-03-02 18:16:57 -07:00
Edgar Geier
f8bc71af0a
Update fontdb dependency to version 0.13 2023-03-03 00:53:00 +01:00
Edgar Geier
750d988429
Make FontKey repr(transparent) if swash feature is disabled 2023-03-03 00:53:00 +01:00
Edgar Geier
506a4194be
Make FontSystem not self-referencing 2023-03-03 00:53:00 +01:00
Jeremy Soller
0548d7ae59
Merge pull request #92 from notgull/font-system-new-warning
docs: Add a warning about FontSystem::new()
2023-03-02 14:54:23 -07:00
Jeremy Soller
bd27ca8ad8
Merge pull request #88 from geieredgar/clippy-fixes
Fix clippy warnings
2023-03-02 14:53:08 -07:00
Jeremy Soller
7078c3bb98
Fix vi editor compilation 2023-03-02 11:31:07 -07:00
Edgar Geier
6c501c6640
Fix clippy warnings 2023-03-01 22:58:41 +01:00
Edgar Geier
4e93853765
Remove lifetime from SwashCache 2023-03-01 22:41:59 +01:00
jtnunley
7098ee62e2 fmt 2023-03-01 13:36:29 -08:00
jtnunley
e00964fccf Add a warning about FontSystem::new() 2023-03-01 13:16:13 -08:00
Héctor Ramón Jiménez
22b8a534fa
Avoid division by zero in LayoutRunIter 2023-02-28 20:40:31 +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
Héctor Ramón Jiménez
f08bea22ed
Expose Placement from zeno in swash module 2023-02-27 18:14:26 +01:00
Hojjat
fdd3ee83a5 Fix selection highlighting when paragraph is justified 2023-02-24 13:00:25 -07:00
Jeremy Soller
f4b14f1210
Merge pull request #78 from hojjatabdollahi/main
Alignment and Justification
2023-02-24 10:54:09 -07:00
Hojjat
fff8389bbf Allow set_align to clear the alignment by setting it to None 2023-02-24 08:39:24 -07:00
grovesNL
6a656e9a0f Exclude line y offset in height comparison
We start `line_y` at an initial offset, so we need to account for this
later when checking if the total height is beyond the buffer height.
2023-02-24 11:27:45 -03:30
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
27d52a12e9 Fix the trailing space 2023-02-23 13:26:21 -07:00
Hojjat
2442422762 Add justification buttons to editor-libcosmic 2023-02-22 21:59:03 -07:00
Hojjat
59e89bdbaa Justified 2023-02-22 20:48:57 -07:00
Hojjat
00ff5b72f3 Align Left, Right, and Center works 2023-02-22 18:31:49 -07:00