Expand description
Pure-Rust/WASM SVG score renderer for acorde_core::Score, driven by
acorde_layout.
Score model (acorde-core) → logical layout (acorde-layout) → renderer (acorde-render-svg)This crate has no browser/DOM dependency — render_svg produces a plain String that
renders identically whether you’re on native Rust, in a WASM host, or on a server. It
consumes layout decisions (LayoutResult) rather than re-deriving them: beam grouping,
tuplet grouping, courtesy accidentals, and row breaks all stay in acorde-layout. This
crate places glyphs at pixel coordinates and nothing more.
Glyphs (clefs, noteheads, accidentals, rests) are original hand-authored SVG paths — no vendored font, no system-font dependency. See the crate README for the rationale.
§Example
use acorde_core::Score;
use acorde_render_svg::{render_svg, SvgRenderOptions};
let score = Score::default();
let svg = render_svg(&score, &SvgRenderOptions::default()).unwrap();
assert!(svg.starts_with("<svg"));Structs§
- Address
Bounds - Approximate interactive bounds for one stable
acorde_core::NoteAddr. The box is centered on the note’s anchor and is intended for hit testing/highlighting, not engraving. - Glyph
Coverage - Explicit coverage information for the renderer’s built-in glyph resource.
- Harmony
Range Metadata - A ranged harmony annotation with stable score addresses for browser editors.
- Harp
Pedal Diagram Metadata - A harp pedal diagram with its stable staff-local measure location.
- Microtone
Marker Coverage - Host-neutral capability information for the renderer’s explicit microtone marker.
- Note
Semantic Metadata - Stable note-level semantic metadata that avoids forcing browser hosts to parse SVG elements.
- Render
Metadata - Lightweight browser-facing metadata for a rendered score.
- Render
Preflight Issue - A source-located renderer capability warning discovered before SVG emission.
- Rendered
View Metadata - Browser-facing identity and effective style for a resolved linked view.
- Score
Text Metadata - A score-level styled text entry exposed without requiring hosts to parse SVG or interchange XML.
- Staff
Presentation Metadata - SvgAnnotation
- A host-provided, non-semantic annotation to place on top of rendered SVG.
- SvgAnnotation
Collision Policy - Collision ownership and permitted escape lane for one host annotation.
- SvgAnnotation
Metrics - Font-independent SVG-pixel bounds relative to an annotation’s
(x, y)anchor. - SvgRender
Options - Options controlling SVG output. All fields have defaults — safe to deserialize from
partial JSON (e.g.
"{}"from a WASM caller that only wants defaults). - TabFret
Metrics - Font-independent metrics for one rendered tablature fret label.
- Tablature
Change Metadata - A tablature tuning or capo configuration that takes effect at a physical measure.
- Tablature
Position Metadata - A tablature position with a stable source address for browser editing hosts.
- Tablature
Staff Metadata - Typed tablature configuration for a rendered staff.
- Tablature
Technique Connection Metadata - A typed tablature connection for browser editing and playback hosts.
- Text
Annotation - A measure-level styled text entry exposed to browser hosts without SVG parsing.
Enums§
- Render
Annotation Error - Errors returned while validating host-provided render annotations.
- Render
Error - Errors returned by
render_svg/render_svg_with_layout. - Render
Preflight Kind - The bounded notation capabilities checked by
render_preflight.
Constants§
- BUILTIN_
GLYPH_ RESOURCE_ ID - Stable identifier for the renderer’s font-independent vector glyph set.
- GLYPH_
COVERAGE_ CONTRACT_ VERSION - Version of the built-in glyph coverage contract.
- SVG_
ANNOTATION_ COLLISION_ GAP_ PX - Fixed separation used by the deterministic SVG annotation collision pass.
- SVG_
CONTRACT_ VERSION - Version of the browser-facing
RenderMetadatacontract. - TAB_
METRICS_ CONTRACT_ VERSION - Version of the deterministic tablature metric contract.
Traits§
- Render
Annotation - Extension point for deterministic, host-defined SVG annotations.
Functions§
- glyph_
coverage - Describe the deterministic, font-independent glyphs shipped by this renderer.
- percussion_
notehead_ resource_ id - Return the stable built-in resource name for a bounded unpitched notehead shape.
- render_
preflight - Inspect renderer capability boundaries without producing SVG or partially rendering a score.
- render_
svg - Compute layout with
optionsand renderscoreto an SVG string. - render_
svg_ metadata - Return SVG dimensions and approximate hit-test bounds keyed by stable score addresses.
- render_
svg_ row - Render one system row from a precomputed layout. The returned SVG contains only that row and uses the same deterministic renderer as full-score output.
- render_
svg_ view - Render one linked
ScoreViewwithout mutating the sourceScore. - render_
svg_ view_ metadata - Return browser metadata for a resolved linked view without requiring a host to duplicate its layout/style resolution rules.
- render_
svg_ with_ annotations - Render a score and append deterministic, host-provided annotations.
- render_
svg_ with_ layout - Render
scoreto an SVG string using an already-computedLayoutResult. - tab_
fret_ metrics - Return the stable metrics used for tablature fret labels.