|
|
|
|
|
by ygra
1057 days ago
|
|
My guess would be that text layout and measuring is something that's very easy to offload to the browser, yet, if you want to do this without, you're pulling in a whole lot of other dependencies (text rendering is quite complex) that you maybe cannot reasonably call from JS. |
|
---
Just to give you an idea of how hard this would be, Mermaid let's people use custom fonts, with fallbacks, so diagrams can look quite different depending on what font people have installed.
The current default font is Tahoma [4], which is owned by Microsoft, so Linux desktops usually render the diagrams slightly differently than on Windows/MacOS desktops.
People can also have different default font size in their browser/OS settings, and that will affect things too.
Finally, you also have things like ClearType [5], where the text is rendered differently depending on the sub-pixel arrangement of your monitor!!
I think we could get a basic version that partially works by implementing only a subset of the layout functions and hard-coding one specific font in, but even that would still be a fair bit of work.
[1]: https://drafts.csswg.org/cssom-view/#dom-element-getbounding...
[2]: https://github.com/jsdom/jsdom
[3]: https://github.com/jsdom/jsdom/issues/1322
[4]: https://en.wikipedia.org/wiki/Tahoma_(typeface)
[5]: https://en.wikipedia.org/wiki/ClearType