61 lines
2.8 KiB
Rust
61 lines
2.8 KiB
Rust
#![forbid(unsafe_code)]
|
|
//! # epiphany-render-svg
|
|
//!
|
|
//! Agent I's **SVG renderer** behind the Epiphany `RenderIR` interface (spec
|
|
//! **Chapter 7** §"RenderIR"): it turns a
|
|
//! [`ResolvedLayoutIR`] into well-formed
|
|
//! **SVG 1.1**, drawing each glyph from **genuine Bravura SMuFL** data: inline
|
|
//! outline `<path>`s by default, or `<text>` set in an `@font-face`-embedded
|
|
//! subset. It is the visible end of the v0 `Score → layout IR` pipeline: from a
|
|
//! resolved layout, produce an image a musician would recognise.
|
|
//!
|
|
//! ## Scope and status
|
|
//!
|
|
//! Per the QUICKSTART development pattern (`spec/PHASE2_QUICKSTART.md`, Agent I),
|
|
//! the renderer was golden-locked against the **stub solver's** output first, then
|
|
//! against the real [`epiphany_engrave`](../epiphany_engrave/index.html) solver
|
|
//! once real notation and re-spacing landed. The renderer consumes any solver's
|
|
//! [`ResolvedLayoutIR`]: it preserves the
|
|
//! resolved geometry, provenance traces, XML validity, deterministic output, and
|
|
//! glyph-mode choice without making engraving-semantic decisions.
|
|
//!
|
|
//! ## What it draws, and the non-overreach rule
|
|
//!
|
|
//! The bundled outlines are extracted from the official OFL `Bravura.otf` (see
|
|
//! `tools/extract_bravura_outlines.py` and `tools/OFL.txt`) in staff-space,
|
|
//! y-up coordinates. The renderer makes SVG-encoding choices only and never
|
|
//! engraving-semantic ones; see the private `svg` module for the coordinate
|
|
//! system, the provenance-tracing contract, and the diagnostic-not-paper-over
|
|
//! rule.
|
|
//!
|
|
//! ## Font availability
|
|
//!
|
|
//! Two self-contained modes ([`GlyphMode`]):
|
|
//!
|
|
//! * [`GlyphMode::PathOutline`] (default) inlines genuine Bravura outlines as
|
|
//! `<path>`s — no font dependency, byte-golden-locked, the pixel-verified
|
|
//! reference (QUICKSTART, Agent I, recommendation).
|
|
//! * [`GlyphMode::EmbeddedFont`] references glyphs by SMuFL codepoint via a
|
|
//! `<text>` element and an `@font-face`-embedded Bravura *subset* (the same
|
|
//! SHA-pinned font the outlines come from, base64 in `font_subset_generated`,
|
|
//! regenerated by `tools/extract_bravura_outlines.py --font-out`). Still
|
|
//! self-contained — the font travels in the SVG — and text-selectable, at the
|
|
//! cost of a larger file; glyph placement is consistent with the path mode by
|
|
//! construction, while exact rasterisation is the consumer's font renderer's.
|
|
|
|
mod font_subset_generated;
|
|
mod outline;
|
|
mod outlines_generated;
|
|
mod svg;
|
|
pub mod xml;
|
|
|
|
pub use outline::{bundled_glyph_count, smufl_codepoint};
|
|
pub use svg::{
|
|
render, Diagnostic, GlyphClass, GlyphMode, RenderOptions, RenderOutput, RenderStats,
|
|
};
|
|
pub use xml::{check_well_formed, XmlError};
|
|
|
|
// Re-exported so callers can name the renderer's input without also importing
|
|
// epiphany-layout-ir directly.
|
|
pub use epiphany_layout_ir::{ResolvedLayoutIR, ScaleContext};
|