Omochice/pele/text does not have a README file

    AdvanceTable

    pub(all) struct AdvanceTable {
    advances : Map[Int, Double]
    narrow : Double
    wide : Double
    }

    Advance widths of one style of a font, in font units.

    Label

    pub(all) struct Label {
    lines : Array[Array[Span]]
    widths : Array[Double]
    width : Double
    height : Double
    size : Double
    line_height : Double
    heights : Array[Double]?
    }

    Text laid out in lines of spans, measured.

    MathBody

    pub(all) enum MathBody {
    Svg(String)
    Html(String)
    }

    Markup the host typeset, drawn in a nested <svg> or in a <foreignObject>.

    MathMarkup

    pub(all) struct MathMarkup {
    body : MathBody
    width : Double
    height : Double
    }

    Typeset math that passed pele's check, with the size of the box it is drawn in.

    Span

    pub(all) struct Span {
    text : String
    style : Int
    icon : String?
    width : Double
    math : MathMarkup?
    }

    A run of text with one emphasis, or an icon or typeset math in place of text.

    TextMeasurer

    pub(all) struct TextMeasurer {
    width_of : (String, Double, Int) -> Double
    }

    Measures the advance width of text, in pixels.

    TextMeasurer::width

    fn TextMeasurer::width(self : TextMeasurer, text : String, size : Double, style : Int) -> Double

    The width of text at font size size with the emphasis bits in style.

    STYLE_BOLD

    let STYLE_BOLD : Int

    Emphasis bit of a text span.

    STYLE_ITALIC

    let STYLE_ITALIC : Int

    Emphasis bit of a text span.

    STYLE_MONO

    let STYLE_MONO : Int

    Emphasis bit of a text span.

    STYLE_SUB

    let STYLE_SUB : Int

    Emphasis bit of a text span, set for subscript.

    STYLE_SUP

    let STYLE_SUP : Int

    Emphasis bit of a text span, set for superscript.

    STYLE_UNDERLINE

    let STYLE_UNDERLINE : Int

    Emphasis bit of a text span, set for underlined text.

    decode_entities

    fn decode_entities(text : String) -> String

    Turns Mermaid's hidden #name; codes and HTML entities into characters.

    has_math

    fn has_math(line : Array[Span]) -> Bool

    Whether a line holds typeset math.

    icon_markup

    fn icon_markup(name : String) -> String

    The drawing the host has for the icon name, empty when it has none or no resolver is set.

    label_line

    fn label_line(label : Label, i : Int) -> Label

    Line i of the label as a label of its own.

    layout_label

    fn layout_label(raw : String?, markdown : Bool, measurer : TextMeasurer, size : Double, max_width : Double, base? : Int) -> Label

    Lays out label text with inline HTML emphasis, explicit breaks, and wrapping at max_width. markdown also reads * and _ emphasis; base is the emphasis of the whole label.

    line_middle

    fn line_middle(label : Label, i : Int) -> Double

    The middle of line i, from the top of the label.

    marker_end

    fn marker_end(text : String, i : Int) -> Int

    The end of fl°°?\w+¶ß at i, or -1.

    math_active

    fn math_active() -> Bool

    Whether labels are laid out with a typesetter.

    metrics_measurer

    let metrics_measurer : TextMeasurer

    Estimates widths from a table of Arial advances. pele falls back to it where no canvas is available, which is always the case here.

    table_measurer

    fn table_measurer(table_of : (Int) -> AdvanceTable, units_per_em : Double) -> TextMeasurer

    Measures text with the advance table table_of gives for each style, at units_per_em units to the em. Control characters, and code units the Arial table gives no width, take none unless their table names them.

    typeset

    fn typeset(tex : String, size : Double) -> MathMarkup?

    The host's markup for tex at font size size, or None when there is no typesetter or the markup fails pele's check.

    with_heights

    fn with_heights(label : Label) -> Label

    The label with line heights for the math it holds, or without them when no line needs more than line_height.

    with_icons

    fn[T] with_icons(icons : (String) -> String??, run : () -> T raise?) -> T raise?

    Runs run with icons as the host's icon resolver for the labels it lays out.

    with_math

    fn[T] with_math(math : (String, Double) ->
    Json
    ??, run : () -> T raise?) -> T raise?

    Runs run with math as the typesetter that labels ask, and with nothing typeset yet.

    without_math

    fn[T] without_math(run : () -> T raise?) -> T raise?

    Runs run with no typesetter, as Mermaid draws diagram titles as text.

    written_codes

    fn written_codes(text : String) -> String

    text with each of Mermaid's placeholders written back as the #name; or #123; code it hides, as /fl°°?(\w+)¶ß/g finds them.