Skip to content

Add cosmic text example #739

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 258 additions & 6 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ A separate Linebender integration for playing Lottie animations is available thr

A separate Linebender integration for rendering raw scenes or Lottie and SVG files in [Bevy] through [`bevy_vello`](https://github.com/linebender/bevy_vello).

### Cosmic Text

An example scene demonstrating the integration of COSMIC text for font loading and text layout through [COSMIC Text Scene](./examples/scenes/src/cosmic_text_scene/mod.rs).
This scene can be run with:

```shell
cargo run --package with_winit --features cosmic_text -- --test-scenes
```

## Examples

Our examples are provided in separate packages in the [`examples`](https://github.com/linebender/vello/tree/main/examples) directory.
Expand Down Expand Up @@ -296,6 +305,7 @@ For clarity, these files are also licensed under either of the above licenses.
The intent is for this research to be used in as broad a context as possible.

The files in subdirectories of the [`examples/assets`](https://github.com/linebender/vello/tree/main/examples/assets) directory are licensed solely under their respective licenses, available in the `LICENSE` file in their directories.
The file [`examples/scenes/src/cosmic_text_scene/mod.rs`](examples/scenes/src/cosmic_text_scene/mod.rs) is licensed as described in the [README](examples/scenes/src/cosmic_text_scene/README.md) in its directory.

[piet-metal]: https://github.com/linebender/piet-metal
[`wgpu`]: https://wgpu.rs/
Expand Down
3 changes: 3 additions & 0 deletions examples/headless/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ pollster = { workspace = true }
env_logger = "0.11.6"
png = "0.17.16"
futures-intrusive = { workspace = true }

[features]
cosmic_text = ["scenes/cosmic_text"]
7 changes: 7 additions & 0 deletions examples/scenes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ clap = { workspace = true, features = ["derive"] }
image = { workspace = true, features = ["jpeg"] }
rand = "0.8.5"


cosmic-text = { version = "0.12.1", optional = true }
unicode-segmentation = { version = "1.12.0", optional = true }

# for pico_svg
roxmltree = "0.20.0"
bytemuck.workspace = true
Expand All @@ -28,3 +32,6 @@ web-time = { workspace = true }
# We have a transitive dependency on getrandom and it does not automatically
# support wasm32-unknown-unknown. We need to enable the js feature.
getrandom = { version = "0.2.15", features = ["js"] }

[features]
cosmic_text = ["dep:cosmic-text", "dep:unicode-segmentation"]
22 changes: 22 additions & 0 deletions examples/scenes/src/cosmic_text_scene/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2022 System76
Copyright 2020 the Vello Authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions examples/scenes/src/cosmic_text_scene/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Cosmic Text Scene

This scene incorporates code from [COSMIC Text](https://github.com/pop-os/cosmic-text).
This is licensed under the same kind of license as Vello, but it has a different copyright notice.

As such, [mod.rs](./mod.rs) is licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE](../../../../LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)

at your option.
Loading