Skip to main content

Crate verovioxide_data

Crate verovioxide_data 

Source
Expand description

Bundled SMuFL fonts and resources for verovioxide.

This crate embeds the SMuFL fonts and related resources from the Verovio project for use at runtime. The data includes glyph definitions, bounding boxes, and optional CSS files with embedded WOFF2 fonts for web output.

§Font Features

By default, only the Leipzig font is included. Additional fonts can be enabled via feature flags:

  • font-leipzig (default) - Leipzig SMuFL font
  • font-bravura - Bravura SMuFL font
  • font-gootville - Gootville SMuFL font
  • font-leland - Leland SMuFL font
  • font-petaluma - Petaluma SMuFL font
  • all-fonts - Enable all fonts

Note: Bravura is always included as baseline because it’s used to build the glyph name table in Verovio.

§Example

use verovioxide_data::{resource_dir, extract_resources};

// Access embedded resources directly (in-memory)
let dir = resource_dir();
if let Some(bravura) = dir.get_file("Bravura.xml") {
    let contents = bravura.contents_utf8().unwrap();
    println!("Bravura bounding boxes loaded: {} bytes", contents.len());
}

// Or extract to a temporary directory for file-based access
let temp_dir = extract_resources().expect("Failed to extract resources");
let path = temp_dir.path().join("Bravura.xml");
assert!(path.exists());

Enums§

DataError
Errors that can occur when working with verovioxide data resources.

Functions§

available_fonts
Lists all available SMuFL font names based on enabled features.
default_font
Returns the default font name.
extract_resources
Extracts all embedded resources to a temporary directory.
has_bravura
Returns true if the Bravura font is available.
has_gootville
Returns true if the Gootville font is available.
has_leipzig
Returns true if the Leipzig font is available.
has_leland
Returns true if the Leland font is available.
has_petaluma
Returns true if the Petaluma font is available.
resource_dir
Returns a reference to the embedded verovio data directory.