No description
Find a file
Andrew Wheeler(Genusis) f2a60a8dcc
Rework add_span (#25)
* Rework Ranges to split and change or overwrite based on old ranges to new range

* set array size to 3 instead of 5. added some comments

* Avoid adding ranges that the start and end == each other

* actually remove the start != end requirement since get_span doesnt care and would work for single characters.

* Add 1 to forward map so it cant overlap ranges like 11..11

* optimize the span lookup so if it is outside the search parameters it doesnt keep looping. update get span to iterate normally since there should be no duplicates. Maybe optimize this to a btree now instead?

* make the range changes for front to end have the end -1 so as to not overlap since get span is <=

* Readded block for ranges like 1..1
Moved rework ranges into the first loop.
Removed the -1 and +1 from the range clips.
2022-10-29 17:56:14 -06:00
.github/workflows Add github pages task 2022-10-27 11:30:13 -06:00
examples Update text color on theme change 2022-10-29 17:31:50 -06:00
sample Add em dash sample 2022-10-26 09:26:21 -06:00
src Rework add_span (#25) 2022-10-29 17:56:14 -06:00
.gitignore Appearance for iced text box 2022-10-18 14:35:16 -06:00
Cargo.toml 0.2.2 2022-10-27 18:29:41 -06:00
editor-libcosmic.sh Relicense MIT OR Apache 2.0 2022-10-24 12:58:15 -06:00
editor-orbclient.sh Relicense MIT OR Apache 2.0 2022-10-24 12:58:15 -06:00
editor-test.sh Do not use mono feature for editor test 2022-10-25 10:18:11 -06:00
LICENSE-APACHE Relicense MIT OR Apache 2.0 2022-10-24 12:58:15 -06:00
LICENSE-MIT Relicense MIT OR Apache 2.0 2022-10-24 12:58:15 -06:00
README.md Update roadmap 2022-10-27 16:19:51 -06:00
redoxer.sh Add redoxer example 2022-10-27 12:07:05 -06:00
rich-text.sh Use Color in more places 2022-10-27 09:07:47 -06:00
rustfmt.toml Disable formatting for now 2022-10-25 08:12:04 -06:00
terminal.sh Add terminal example 2022-10-27 11:15:08 -06:00

COSMIC Text

crates.io docs.rs license Rust workflow

Pure Rust multi-line text handling.

COSMIC Text provides advanced text shaping, layout, and rendering wrapped up into a simple abstraction. Shaping is provided by rustybuzz, and supports a wide variety of advanced shaping operations. Rendering is provided by swash, which supports ligatures and color emoji. Layout is implemented custom, in safe Rust, and supports bidirectional text. Font fallback is also a custom implementation, reusing some of the static fallback lists in browsers such as Chromium and Firefox. Linux, macOS, and Windows are supported with the full feature set. Other platforms may need to implement font fallback capabilities.

Roadmap

The following features must be supported before this is "ready":

  • Font loading (using fontdb)
    • Preset fonts
    • System fonts
  • Text styles (bold, italic, etc.)
    • Per-buffer
    • Per-span
  • Font shaping (using rustybuzz)
    • Cache results
    • RTL
    • Bidirectional rendering
  • Font fallback
    • Choose font based on locale to work around "unification"
    • Per-line granularity
    • Per-character granularity
  • Font layout
    • Click detection
    • Simple wrapping
    • Wrapping with indentation
    • No wrapping
    • Ellipsize
  • Font rendering (using swash)
    • Cache results
    • Font hinting
    • Ligatures
    • Color emoji
  • Text editing
    • Performance improvements
    • Text selection
    • Can automatically recreate https://unicode.org/udhr/ without errors (see below)
    • Bidirectional selection
    • Copy/paste

The UDHR (UN Declaration of Human Rights) test involves taking the entire set of UDHR translations (almost 500 languages), concatenating them as one file (which ends up being 8 megabytes!), then via the editor-test example, automatically simulating the entry of that file into cosmic-text per-character, with the use of backspace and delete tested per character and per line. Then, the final contents of the buffer is compared to the original file. All of the 106746 lines are correct.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.