Crates.io | rustovio |
lib.rs | rustovio |
version | 0.1.0 |
source | src |
created_at | 2021-06-26 02:35:17.69203 |
updated_at | 2021-06-26 02:35:17.69203 |
description | bindings to verovio, an engraving library |
homepage | https://github.com/mockersf/rustovio |
repository | https://github.com/mockersf/rustovio |
max_upload_size | |
id | 415061 |
size | 20,995,010 |
Rust bindings to Verovio. It offer the raw bindings and a limited wrapper.
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.
let mut tk = VerovioToolkit::new("verovio/data").unwrap();
tk.load_data_from_file(filename);
println!("{}", tk.render_to_svg(1).unwrap());
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::<i8>());
CStr::from_ptr(svg)
};
println!("{}", svg_str.to_str().unwrap());