when I set html lang attribute to ja or zh the diagram text bock exceed the border.
like this
sample code is here ↓
when I set html lang attribute to ja or zh the diagram text bock exceed the border.
like this
sample code is here ↓
Thanks for the reproducible case. We’ll investigate.
It seems like this is changing the rendering on the canvas, but that is not reflected in the text measurement, because the text is measured in an inaccessible, in-memory canvas context that does not have the “lang” attribute set.
We may make it easier to expose that in-memory canvas in GoJS 3.0, but it might still be difficult to switch it between multiple languages, because there is only one in-memory context for all Diagrams on the page. We’ll consider the API options here. But for now, I don’t think we can help you with this problem, you may have to set the diagram DIV lang to “en”
thank you simon,
I set the top element of HTML with <html lang="ja">
I believe it would be the same if set on a div
tag.
I can handle the switch language with the font-family
in CSS. why I change the lang is Android determines the language by the lang
attribute.
For now, I’ll use lang=en
. then, On Android, it will appear as a mix of Japanese and Chinese, I’ll just ignore this. other device works perfect change font-family to change language.
Furthermore, I don’t switch languages frequently. So once I decide when displaying it, I won’t change it afterward.
It may be a tiny bit safer actually to use “unknown” instead of “en”
So I suggest this:
<html lang="ja">
<div lang="unknown"> <!-- the diagram -->
</html>
Oh maybe it works Let me try it.