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. |
||
|---|---|---|
| .github/workflows | ||
| examples | ||
| sample | ||
| screenshots | ||
| src | ||
| .gitattributes | ||
| .gitignore | ||
| Cargo.toml | ||
| CHANGELOG.md | ||
| ci.sh | ||
| deny.toml | ||
| editor-libcosmic.sh | ||
| editor-orbclient.sh | ||
| editor-test.sh | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||
| README.md | ||
| redoxer.sh | ||
| rich-text.sh | ||
| terminal.sh | ||
| test.sh | ||
COSMIC Text
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.
Screenshots
Arabic translation of Universal Declaration of Human Rights

Hindi translation of Universal Declaration of Human Rights

Simplified Chinese translation of Universal Declaration of Human Rights

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
- no_std support (with
default-features = false)- no_std font loading
- no_std shaping
- no_std layout
- no_std rendering
The UDHR (Universal 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
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
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.