Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mockersf/rustovio
rust bindings to Verovio
https://github.com/mockersf/rustovio
engraving music rust verovio
Last synced: about 2 months ago
JSON representation
rust bindings to Verovio
- Host: GitHub
- URL: https://github.com/mockersf/rustovio
- Owner: mockersf
- License: apache-2.0
- Created: 2021-06-25T21:49:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-07T23:02:22.000Z (almost 2 years ago)
- Last Synced: 2024-10-15T11:47:20.398Z (2 months ago)
- Topics: engraving, music, rust, verovio
- Language: Rust
- Homepage:
- Size: 37.1 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE2
Awesome Lists containing this project
README
# Rustovio
[![CI](https://github.com/mockersf/rustovio/actions/workflows/ci.yml/badge.svg)](https://github.com/mockersf/rustovio/actions/workflows/ci.yml)
[![docs](https://docs.rs/rustovio/badge.svg)](https://docs.rs/rustovio)
[![crates.io](https://img.shields.io/crates/v/rustovio.svg)](https://crates.io/crates/rustovio)Rust bindings to [Verovio](https://github.com/rism-digital/verovio). It offer the raw bindings and a limited wrapper.
## Limitations
This currrently does not work on Windows, mostly because I don't have one to check how to do the setup.
To use this library, you need to have a C++ runtime available for dynamic linking.
## Wrapper
```rust
let mut tk = VerovioToolkit::new("verovio/data").unwrap();
tk.load_data_from_file(filename);
println!("{}", tk.render_to_svg(1).unwrap());
```## Bindings
```rust
let data = fs::read_to_string(filename).expect("Something went wrong reading the file");
let cdata = CString::new(data).unwrap();let resource_folder = CString::new("verovio/data").unwrap();
let svg_str = unsafe {
let tk = bindings::vrvToolkit_constructorResourcePath(resource_folder.as_ptr());
bindings::vrvToolkit_loadData(tk, cdata.as_ptr());
let svg = bindings::vrvToolkit_renderToSVG(tk, 1, std::ptr::null::());
CStr::from_ptr(svg)
};
println!("{}", svg_str.to_str().unwrap());
```