Commit graph

78 commits

Author SHA1 Message Date
David Stern
73acfb0962 Cache rustybuzz shape plans. 2023-12-18 18:19:27 -05:00
Jeremy Soller
b7bdd62eb3
ViEditor: update modit and improve put implementation 2023-12-05 10:05:26 -07:00
Jeremy Soller
9278e7d0c4
ViEditor: Implement put/yank registers 2023-11-30 13:42:52 -07:00
Jeremy Soller
cbd567d238
Support line selection 2023-11-28 10:42:50 -07:00
Jeremy Soller
1201d0c8b5
Use crates.io modit 2023-11-17 07:53:24 -07:00
Jeremy Soller
27d447b6fc
Use fontdb 0.16 2023-11-15 12:42:51 -07:00
Jeremy Soller
38bed64ef1
Use cosmic_undo_2 instead of undo_2 for improved compiler support 2023-11-15 09:09:46 -07:00
Jeremy Soller
5352fdee94
Undo/redo support in ViEditor 2023-11-13 13:31:06 -07:00
Jeremy Soller
b3c5f14e47
Remove two-face (it can be added by user of library) 2023-11-13 10:42:03 -07:00
Jeremy Soller
74c92e0419 ViEditor: switch to using modit 2023-11-07 15:57:00 -07:00
Jeremy Soller
e62fea5efd
SyntaxEditor: Support using two-face syntax definitions 2023-11-02 13:38:25 -06:00
Jeremy Soller
163d8ef26e
0.10.0 2023-10-19 09:57:40 -06:00
Dov Reshef
8db03fe3cf Add image render tests
Add tests that will match rendered words/paragraphs against reference
images.

Use env var `GENERATE_IMAGES` to write the initial reference images to
the repository.
2023-09-27 11:57:18 +03:00
Huang-Huang Bao
331710a16f
Use self_cell for creating self-referential struct
Remove indigenous unsafe self-referential implemention which has a lesser chance to be audited.
2023-09-19 02:16:23 +08:00
Jeremy Soller
33706262f6
Update all dependencies 2023-09-18 08:57:01 -06:00
Huang-Huang Bao
32c4fd2a0f
Set MSRV to 1.65
The MSRV was scanned by cargo-msrv, the result shows src/buffer.rs uses let - else statements which requires rust 1.65.0.
This also reformat the Cargo.toml.
2023-09-15 19:52:53 +08:00
Imbris
91674d5a49 Fix #134 and include a test for it.
Try to ensure that using "the width computed during an unconstrained
layout" as the width constraint during a relayout produces the same
layout. This is useful for certain UI layout algorithms.

See https://github.com/pop-os/cosmic-text/issues/134

* Instead of computing the LayoutLine width from the positioned and
  aligned glyphs, we pass through width computed during line wrapping
  (unless justified alignment is used, in this case we use the old
  approach because the use case for measuring the width isn't really
  applicable to justified text since that will just expand to the
  provided width). For the produced width to later give the same
  wrapping results when passed in as the `line_width` it needs to use
  the same exact float arithmatic that was used to compute the width
  that is compared against `line_width` when making line wrapping
  choices. Passing this width through as the LayoutLine width is the
  most covenient option without making more major changse to the API.
  Nevertheless, I am imagining that if we get a dedicated measurement
  method (i.e. that doesn't do the final positioning and alignment of
  glyphs and which caches `Vec<VisualLine>`), then this width can just
  be exposed there instead of preservering it in LayoutLine.
* Incidentally, this fixes
  https://github.com/pop-os/cosmic-text/issues/169.
* Switch substraction from `fit_x` to checking whether potential
  addition to the current line width would exceed the `line_width`. This
  avoids the float error being dependent on the provided `line_width`
  value.
* When eliminating trailing space from the line width, we avoid
  backtracking with subtraction (which would not give the same exact
  value due to float error) and instead save the previous width and use
  that.
* If the previous word did not exceed the line_width, we now include a
  single blank word even if it would cross the width limit since its
  width won't be counted. This is necessary to get the same wrapping
  behavior when re-using the measured width (which doesn't count a
  single trailing blank word). Note, this whitespace logic may be
  reworked anyway if <https://github.com/pop-os/cosmic-text/issues/155>
  is addressed.
* Change tests to use `opt-level=1` to keep test runtime down.
* Add `fonts` folder for fonts used in tests.
* Fix an issue where a non-breaking whitespace was assumed to be the
  start of a section of spaces which included characters that weren't
  even whitespace.
* Add some TODOs about incongruencies between `is_whitespace`,
  justification, and line breaks.
2023-08-25 21:00:46 -04:00
Jeremy Soller
665d3d86b9
Merge pull request #174 from urlordjames/fontconfig_default
enable fontconfig feature by default
2023-08-23 14:10:22 -06:00
urlordjames
0adbd45654 enable fontconfig feature by default 2023-08-23 11:11:51 -04:00
urlordjames
ace8560493 enable std feature with fontconfig feature 2023-08-23 10:54:48 -04:00
John Nunley
99d3d71a0f Add benchmarks to accurately gauge improvements
Signed-off-by: John Nunley <dev@notgull.net>
2023-08-16 14:09:55 -07:00
genusistimelord
bd4b6cea3b
Add feature to allow fontdb to get fontconfig features for systems that dont auto have this support 2023-08-16 15:14:55 -04:00
grovesNL
14d0ceb81b Move hashbrown behind no_std feature 2023-08-09 10:19:24 -02:30
John Nunley
faa1ceafda Unify the no_std and std impls of FontSystem 2023-07-24 08:51:19 -07:00
John Nunley
e65bcbc4d3
Change to a feature 2023-07-22 08:24:28 -07:00
Jeremy Soller
7d50d17369
0.9.0 2023-07-06 07:37:03 -06:00
Jeremy Soller
3640b5e1ef
Update rustybuzz to 0.8.0 2023-06-12 11:13:51 -06:00
Jeremy Soller
bb176df59e
Merge pull request #128 from tigregalis/fontdb-0-14
bump `fontdb` to 0.14.1
2023-06-08 12:43:13 -06:00
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
tigregalis
9c4fd35d8e bump fontdb to 0.14.1 2023-05-12 11:11:13 +08:00
Christopher Serr
a8546df7b3 Fix WebAssembly support
There was a problem in the upstream `sys-locale` crate where it assumed
that every WebAssembly target can use `wasm-bindgen` just fine. This
however is not the case, as `wasm-bindgen` and the ecosystem around it
are specifically to target the web. In reality there however are at
least the following 4 "targets" (with possibly more in the future):
 - WebAssembly on the web
 - Freestanding WebAssembly
 - WebAssembly with WASI
 - WebAssembly with Emscripten

These are all supported properly through `sys-locale` 0.3.0 now. However
because "WebAssembly on the web" unfortunately is not its own target and
instead uses `wasm32-unknown-unknown`, just like freestanding
WebAssembly, the only way to differentiate between them is through a
feature. This is the best practice and is done throughout the ecosystem.
Here the feature `wasm-web` is introduced that properly forwards it to
`sys-locale` and possibly other crates in the future.
2023-04-04 17:22:00 +02:00
Jeremy Soller
3224daa66f
0.8.0 2023-04-03 08:27:28 -06:00
Edgar Geier
bff5aaaea3
Make FontSystem not self-referencing 2023-03-12 10:23:54 +01:00
Edgar Geier
7e6368a4fc
Bump rustybuzz version to 0.7 2023-03-03 13:20:32 +01: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
20234f8d11
Bump rustybuzz version to 0.7 2023-03-03 00:53:00 +01:00
Edgar Geier
f8bc71af0a
Update fontdb dependency to version 0.13 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
0d7308b775
0.7.0 2023-02-07 12:28:48 -07:00
Andrew Wheeler
8614a7a398 Updated RangeMap to Add Clear(). 2022-12-30 08:33:00 -07:00
Jeremy Soller
cf9bf26d49
0.6.0 2022-12-20 09:03:39 -07:00
Jeremy Soller
0e302e540a
0.5.6 2022-12-20 08:58:17 -07:00
Jeremy Soller
82d5fc02a5
0.5.5 2022-12-16 13:51:05 -07:00
Jeremy Soller
21e0078d25
cargo upgrade 2022-12-14 09:21:42 -07:00
Jeremy Soller
d54af47d9d
0.5.4 2022-12-14 09:19:20 -07:00
Jeremy Soller
cdf36db03d
0.5.3 2022-12-13 09:23:50 -07:00
Jeremy Soller
6660a1d95b
0.5.2 2022-12-08 11:33:53 -07:00
Jeremy Soller
69e41a558c
0.5.1 2022-12-08 10:32:10 -07:00
Jasper Bekkers
e6df88f698
Add cargo-deny to the CI of this crate (#45) 2022-11-21 04:40:06 -07:00