merman-render 0.4.1

Headless layout + SVG renderer for Mermaid (parity-focused; upstream SVG goldens).
Documentation
// This file is generated by `xtask`.

pub fn lookup_svg_override_em(font_key: &str, text: &str) -> Option<(f64, f64)> {
    match font_key {
        "trebuchetms,verdana,arial,sans-serif" => lookup_in_trebuchetms_verdana_arial_sans_serif(),
        _ => None,
    }
    .and_then(|tbl| lookup_in(tbl, text))
}

fn lookup_in(tbl: &'static [(&'static str, f64, f64)], text: &str) -> Option<(f64, f64)> {
    let mut lo = 0usize;
    let mut hi = tbl.len();
    while lo < hi {
        let mid = (lo + hi) / 2;
        let (k, l, r) = tbl[mid];
        match k.cmp(text) {
            std::cmp::Ordering::Equal => return Some((l, r)),
            std::cmp::Ordering::Less => lo = mid + 1,
            std::cmp::Ordering::Greater => hi = mid,
        }
    }
    None
}

fn lookup_in_trebuchetms_verdana_arial_sans_serif() -> Option<&'static [(&'static str, f64, f64)]> {
    Some(SVG_OVERRIDES_TREBUCHETMS_VERDANA_ARIAL_SANS_SERIF)
}

static SVG_OVERRIDES_TREBUCHETMS_VERDANA_ARIAL_SANS_SERIF: &[(&str, f64, f64)] = &[
    ("", 0.0, 0.8125),
    (",<>:-", 0.0, 2.0),
    ("-:<>,", 0.0, 2.0),
    (":-)", 0.0, 0.9375),
    ("A", 0.0, 0.8125),
    ("A typical interaction<br/>But now in two lines", 0.0, 8.375),
    ("API", 0.0, 1.6875),
    ("Alice", 0.0, 2.25),
    ("Alice & John", 0.0, 5.4375),
    ("Alice calls John.", 0.0, 6.6875),
    ("Alice note", 0.0, 4.1875),
    ("Alice-in-Wonderland", 0.0, 8.625),
    ("Alice2", 0.0, 2.75),
    ("Alice<br/>Johnson", 0.0, 3.3125),
    ("Alice=Wonderland", 0.0, 7.6875),
    ("Another Group", 0.0, 6.125),
    ("Are you OK?", 0.0, 5.4375),
    ("B", 0.0, 0.8125),
    ("BillingService", 0.0, 5.8125),
    ("Bob", 0.0, 1.75),
    ("Bob note", 0.0, 3.6875),
    ("Bob thinks", 0.0, 4.4375),
    ("Book something", 0.0, 6.625),
    ("BookingService", 0.0, 6.5),
    ("Bye", 0.0, 1.6875),
    ("Bye c !", 0.0, 2.9375),
    ("C", 0.0, 0.8125),
    ("Carl", 0.0, 1.75),
    ("Carol", 0.0, 2.25),
    ("Carol, let me introduce Alice?", 0.0, 12.0),
    ("Charlie", 0.0, 2.9375),
    ("Consumer", 0.0, 4.125),
    ("Credentials rejected", 0.0, 8.0),
    ("D", 0.0, 0.8125),
    ("DB", 0.0, 1.4375),
    ("Dashboard", 0.0, 4.4375),
    ("Database", 0.0, 3.75),
    ("David", 0.0, 2.5625),
    ("Diagram Title", 0.0, 5.625),
    ("Did you want to go to the game tonight?", 0.0, 16.25),
    ("Donald", 0.0, 3.0625),
    ("Done", 0.0, 2.25),
    ("E", 0.0, 0.8125),
    ("Endpoint", 0.0, 3.75),
    ("Establish a connection to the DB", 0.0, 13.1875),
    ("Eve", 0.0, 1.625),
    ("Every day", 0.0, 4.1875),
    ("Every minute", 0.0, 5.5),
    ("Extra response", 0.0, 6.0),
    ("FRIENDS", 0.0, 3.6534926470588234),
    ("Favela", 0.0, 2.8125),
    ("Feel sick...", 0.0, 4.375),
    ("Feeling fresh like a daisy", 0.0, 10.1875),
    ("Fight against hypochondria", 0.0, 11.0625),
    ("Fine!", 0.0, 2.1875),
    ("Fine, thank you. And you?", 0.0, 10.6875),
    ("Great!", 0.0, 2.5625),
    ("HealthCheck", 0.0, 5.375),
    ("Healthcheck", 0.0, 5.125),
    ("Hello", 0.0, 2.3125),
    ("Hello Alice!", 0.0, 5.0),
    ("Hello Alice, I'm fine and you?", 0.0, 12.125),
    ("Hello Alice, please meet Carol?", 0.0, 12.75),
    ("Hello Bob, how are - you?", 0.0, 10.6875),
    ("Hello Bob, how are you ?", 0.0, 10.3125),
    ("Hello Bob, how are you?", 0.0, 10.0625),
    ("Hello Bob, how is Charley?", 0.0, 11.1875),
    ("Hello Bob?", 0.0, 4.625),
    ("Hello Charley, how are you?", 0.0, 11.5),
    ("Hello Donald?", 0.0, 5.9375),
    ("Hello John,", 0.0, 4.6875),
    ("Hello John, how are you?", 0.0, 10.3125),
    ("Hello John,<br/>how are you?", 0.0, 5.4375),
    ("Hello again", 0.0, 4.75),
    ("Hello b?", 0.0, 3.5),
    ("Hello c!", 0.0, 3.3125),
    ("Hey", 0.0, 1.8125),
    ("Hi", 0.0, 1.125),
    ("Hi Alice", 0.0, 3.4375),
    ("Hi Alice, I can hear you!", 0.0, 9.9375),
    ("Hi Bob", 0.0, 3.0),
    ("Hi Carl!", 0.0, 3.375),
    ("Hi Joan", 0.0, 3.1875),
    ("Hi John", 0.0, 3.25),
    ("Hi Mandy", 0.0, 4.1875),
    ("Hi!", 0.0, 1.375),
    ("How about you John?", 0.0, 8.8125),
    ("How about you?", 0.0, 6.6875),
    ("I agree", 0.0, 2.75),
    ("I am good thanks", 0.0, 6.9375),
    ("I am good thanks!", 0.0, 7.25),
    ("I feel great!", 0.0, 4.6875),
    ("I ♥ you ∞ times more!", 0.0, 8.9375),
    ("I ♥ you!", 0.0, 3.25),
    ("I fl°°9829¶ß you fl°infin¶ß times more!", 0.0, 15.75),
    ("I fl°°9829¶ß you!", 0.0, 7.0),
    ("It's good!", 0.0, 3.75),
    ("J", 0.0, 0.8125),
    ("Joan", 0.0, 1.875),
    ("John", 0.0, 1.9375),
    ("John, can you hear me?", 0.0, 9.4375),
    ("John2", 0.0, 2.375),
    ("Johnson", 0.0, 3.3125),
    ("Jolly good!", 0.0, 4.5),
    ("L", 0.0, 0.8125),
    ("Log different error", 0.0, 7.5625),
    ("Log error", 0.0, 3.9375),
    ("Mandy", 0.0, 2.9375),
    ("Message", 0.0, 3.5625),
    ("Network timeout", 0.0, 6.875),
    ("Not so good :(", 0.0, 5.875),
    ("Oh Bob, I'm so happy to be here!", 0.0, 13.3125),
    ("Parallel one", 0.0, 4.8125),
    ("Parallel overlap", 0.0, 6.375),
    ("Parallel three", 0.0, 5.375),
    ("Parallel two", 0.0, 4.875),
    ("Q", 0.0, 0.8125),
    ("Rational thoughts!", 0.0, 7.5),
    ("Rational thoughts<br/>prevail...", 0.0, 7.125),
    ("Red Box", 0.0, 3.625),
    ("Repo", 0.0, 2.1875),
    ("See you later!", 0.0, 5.5625),
    ("Service", 0.0, 3.0),
    ("Start billing process", 0.0, 8.0),
    ("Start booking process", 0.0, 8.6875),
    ("Successfully posted", 0.0, 8.125),
    ("Thanks for asking", 0.0, 7.25),
    ("Time spent looking for movie", 0.0, 13.101706112132353),
    ("We are too many", 0.0, 6.8125),
    ("What do you think about it?", 0.0, 11.1875),
    (
        "When the user is authenticated, they can now submit new posts",
        0.0,
        25.3125,
    ),
    ("Where are you?", 0.0, 6.3125),
    ("Where is Alice?", 0.0, 6.375),
    ("World", 0.0, 2.5625),
    ("Yeah! See you there.", 0.0, 8.3125),
    ("a", 0.0, 0.8125),
    ("b", 0.0, 0.8125),
    ("bidirectional_dotted", 0.0, 8.1875),
    ("bidirectional_solid", 0.0, 7.625),
    ("boundary", 0.0, 3.875),
    ("c", 0.0, 0.8125),
    ("connect", 0.0, 3.125),
    ("default", 0.0, 2.8125),
    ("dotted", 0.0, 2.5625),
    ("dotted_cross", 0.0, 5.0625),
    ("dotted_open", 0.0, 5.0),
    ("dotted_point", 0.0, 5.0625),
    ("dsa", 0.0, 1.375),
    ("getUserb", 0.0, 3.625),
    ("hello", 0.0, 2.0625),
    ("how are you?", 0.0, 5.4375),
    ("is sick", 0.0, 2.5625),
    ("is well", 0.0, 2.6875),
    ("isSick", 0.0, 2.5),
    ("isWell", 0.0, 2.5625),
    ("lead", 0.0, 1.75),
    ("left note", 0.0, 3.3125),
    ("message", 0.0, 3.4375),
    ("multiline", 0.0, 3.6875),
    ("multiline<br />text", 0.0, 3.6875),
    ("multiline<br \\t/>text", 0.0, 8.25),
    ("multiline<br/>text", 0.0, 3.6875),
    ("multiline<br>text", 0.0, 3.6875),
    ("no", 0.0, 1.0625),
    ("ok", 0.0, 1.0625),
    ("over single", 0.0, 4.4375),
    ("over two", 0.0, 3.5),
    ("ping", 0.0, 1.8125),
    ("rgb(0, 0, 0)", 0.0, 4.5625),
    ("rgb(191, 223, 255)", 0.0, 7.5625),
    ("rgb(200, 150, 255)", 0.0, 7.5625),
    ("rgb(200, 255, 200)", 0.0, 7.5625),
    ("right note", 0.0, 3.9375),
    ("show failure", 0.0, 5.0),
    ("solid", 0.0, 2.0),
    ("solid_cross", 0.0, 4.5),
    ("solid_open", 0.0, 4.4375),
    ("solid_point", 0.0, 4.5625),
    ("test", 0.0, 1.5),
    ("text", 0.0, 1.625),
    ("userb", 0.0, 2.25),
    ("when the booking process fails", 0.0, 12.4375),
    ("yes", 0.0, 1.375),
    ("\u{200b}", 0.0, 0.8125),
];