1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! # formulary
//!
//! Native [MathML Core](https://www.w3.org/TR/mathml-core/) layout in Rust.
//! Parse presentation MathML, lay it out using the font's OpenType MATH table,
//! and get back a resolution-independent [`Layout`] — glyph ids and rules with
//! baseline metrics — that you rasterize through your own text pipeline.
//!
//! No webview, no rasterization in the core, no I/O: you bring the font bytes
//! (any font with a MATH table, e.g. STIX Two Math or New Computer Modern).
//!
//! Parsing follows MathML Core's error recovery: unknown or structurally
//! invalid elements render as `mrow` fallbacks and are reported in
//! [`MathRoot::warnings`]; only malformed XML is a hard error.
//!
//! ```
//! use formulary::{parse, layout, LayoutOptions, MathFont};
//!
//! let font_data = std::fs::read("fonts/STIXTwoMath-Regular.otf").unwrap();
//! let font = MathFont::new(&font_data, 0).unwrap();
//! let tree = parse("<math><mi>x</mi><mo>+</mo><mn>2</mn></math>").unwrap();
//! let laid = layout(&tree, &font, &LayoutOptions { font_size: 16.0 });
//! assert!(laid.width > 0.0);
//! ```
pub use ;
pub use ;
pub use ;
pub use ;