Skip to main content

Crate acorde_render_svg

Crate acorde_render_svg 

Source
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§

AddressBounds
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.
GlyphCoverage
Explicit coverage information for the renderer’s built-in glyph resource.
HarmonyRangeMetadata
A ranged harmony annotation with stable score addresses for browser editors.
HarpPedalDiagramMetadata
A harp pedal diagram with its stable staff-local measure location.
MicrotoneMarkerCoverage
Host-neutral capability information for the renderer’s explicit microtone marker.
NoteSemanticMetadata
Stable note-level semantic metadata that avoids forcing browser hosts to parse SVG elements.
RenderMetadata
Lightweight browser-facing metadata for a rendered score.
RenderPreflightIssue
A source-located renderer capability warning discovered before SVG emission.
RenderedViewMetadata
Browser-facing identity and effective style for a resolved linked view.
ScoreTextMetadata
A score-level styled text entry exposed without requiring hosts to parse SVG or interchange XML.
StaffPresentationMetadata
SvgAnnotation
A host-provided, non-semantic annotation to place on top of rendered SVG.
SvgAnnotationCollisionPolicy
Collision ownership and permitted escape lane for one host annotation.
SvgAnnotationMetrics
Font-independent SVG-pixel bounds relative to an annotation’s (x, y) anchor.
SvgRenderOptions
Options controlling SVG output. All fields have defaults — safe to deserialize from partial JSON (e.g. "{}" from a WASM caller that only wants defaults).
TabFretMetrics
Font-independent metrics for one rendered tablature fret label.
TablatureChangeMetadata
A tablature tuning or capo configuration that takes effect at a physical measure.
TablaturePositionMetadata
A tablature position with a stable source address for browser editing hosts.
TablatureStaffMetadata
Typed tablature configuration for a rendered staff.
TablatureTechniqueConnectionMetadata
A typed tablature connection for browser editing and playback hosts.
TextAnnotation
A measure-level styled text entry exposed to browser hosts without SVG parsing.

Enums§

RenderAnnotationError
Errors returned while validating host-provided render annotations.
RenderError
Errors returned by render_svg / render_svg_with_layout.
RenderPreflightKind
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 RenderMetadata contract.
TAB_METRICS_CONTRACT_VERSION
Version of the deterministic tablature metric contract.

Traits§

RenderAnnotation
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 options and render score to 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 ScoreView without mutating the source Score.
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 score to an SVG string using an already-computed LayoutResult.
tab_fret_metrics
Return the stable metrics used for tablature fret labels.