Files
Kirill Bulatov 78a8526196 Update merman to 0.9.3 (#66874)
Closes #66582
Closes #62410
Closes #62913
Closes https://github.com/zed-industries/zed/pull/65192

* Label measurement
merman 0.9 no longer ships font metrics, and sizes label boxes from a
font-agnostic estimate.
`SvgRenderer::measure_text_width` lays out a line with the renderer's
own `usvg` options, and merman's width callback uses it, so layout and
painting share font matching, fallback and shaping.
This also fixes labels overflowing their nodes with a wide UI font.

* Font data
`fontdb` reopens and maps a file-backed font on every glyph lookup,
which made each measurement with a system font cost 1 to 5ms.
The SVG renderer now reads each font file selected for text once, within
a 64MiB total budget, and serves later lookups from memory.
A 36-character measurement with Menlo went from 2.8ms to 0.06ms.

* Configuration
merman 0.9 follows Mermaid 12 defaults: the `neo` look, 120px wrapping
and a 120px minimum node width.
Zed keeps the classic look, 200px wrapping and no minimum width, as
before.
merman also stopped restricting `themeVariables` in diagram directives;
Zed restricts it again, together with `fontSize`.

* Styling
merman now defines label text once in `<defs>` and references it with
`<use>`, so descendant selectors and position lookups no longer reach
it.
Node accents, mindmap section colors and edge label backgrounds are
adapted to that structure.
Label typography comes from merman instead of a forced 16px, and label
viewports are not clipped.

* Limits
* Text measurement has a per-render work budget, so a label of
zero-width characters fails the render instead of measuring ever longer
prefixes.
* merman 0.9.3 has a hard-coded limit on CSS matching work in its label
fallback.
Flowcharts above about 310 nodes and class diagrams above about 375
members fail with `svg_fallback_selector_index exceeded`.
`main` renders 500 nodes and 400 members.

* Behavior changes
* ER relationship labels are 14px, merman's size; they were forced to
16px.
* A `gantt.fontSize` directive is ignored, because `fontSize` is
restricted at any depth.
* A per-node `font-size` style is now painted; before, only the node box
grew.
    * A single label line above roughly 90KB fails to render.

### Known regression


Release Notes:

- Fixed Mermaid state descriptions overlapping in the Markdown preview.
- Fixed Mermaid sequence diagram titles being cut off.
- Fixed Mermaid labels overflowing their nodes with wide fonts.
- [GPUI] Added `SvgRenderer::measure_text_width`, and made SVG text
rendering keep used font files in memory.
2026-11-12 14:52:36 +00:00
..
2026-11-12 14:52:36 +00:00
2026-11-12 14:52:36 +00:00
2026-11-12 14:52:36 +00:00