Skip to content

v2.7.0 — Diagrams in your app's font

Choose a tag to compare

@clintecker clintecker released this 20 Oct 21:00
· 7 commits to main since this release
1f9a18a

Diagram labels can now be set in the font the rest of your app uses. A new
DiagramTheme.fontFamily takes a family name, and every label is measured
and drawn in that family, so boxes still fit the text. At the default (nil,
the system font), output is byte-identical to 2.6.0. Additive: no existing
call changes.

  • DiagramTheme.fontFamily sets and measures every label in a chosen
    family (DiagramTheme(prefersDark: false, fontFamily: "Inter")), for the
    raster renders (MermaidView, image, pdfData, attachmentString). Body
    text takes the family's regular face where it has no medium, so text never
    draws wider than it was measured. A family the device doesn't have is the
    system font, byte for byte, on Apple platforms and Linux. It's part of the
    theme's cache fingerprint. scene/svg stay in the system font. Additive;
    the default is unchanged. (#77)

Thanks to @hipstersmoothie, who built this so chat apps can draw diagrams in
the interface font their users pick.