Jany
February 16, 2017, 2:54pm
1
Hello,
I would like to display camel-case variable names in GoJS text blocks. I want to impose a fixed width to the text block, and have GoJS split the text on camel-case word boundaries. To do so, I tried to insert the dedicated Unicode characters in the text, but GoJS seems to only consider spaces for word wrap. How could I achieve this?
Here is the code I tried: I modified the TextBlock sample on wrapping. I included a drawing of the results I expect.
diagram.add(
$(go.Part, "Vertical",
$(go.TextBlock, { text: "my Text Block", background: "lightgreen", margin: 2,
width: 50, wrap: go.TextBlock.WrapDesiredSize }),
$(go.TextBlock, { text: "my\u200BText\u200BBlock", background: "lightgreen", margin: 2,
width: 50, wrap: go.TextBlock.WrapDesiredSize }),
$(go.TextBlock, { text: "my\u00ADText\u00ADBlock", background: "lightgreen", margin: 2,
width: 50, wrap: go.TextBlock.WrapDesiredSize })
));
The zero-width space (), abbreviated ZWSP, is a non-printing character used in computerized typesetting to indicate word boundaries to text-processing systems in scripts that do not use explicit spacing, or after characters (such as the slash) that are not followed by a visible space but after which there may nevertheless be a line break. It is also used with languages without visible space between words, for example, Japanese. Normally, it is not a visible separation, but it may expand in pa In...
Pages for logged out editors learn more
In computing and typesetting, a soft hyphen (ISO 8859: 0xAD, Unicode .mw-parser-output .monospaced{font-family:monospace,monospace}U+00AD SOFT HYPHEN, HTML: ­ or ­ or ­) or syllable hyphen (EBCDIC: 0xCA), abbreviated SHY, is a code point reserved in some coded character sets for the purpose of breaking words across lines by inserting visible hyphens. Two alternative ways of using the soft hyphen character for this purpose have emerg...
simon
February 16, 2017, 3:05pm
2
I see what you mean, we don’t treat those characters as whitespace and we probably should.
We’ll discuss this internally and release an update soon, probably next week.
Jany
February 16, 2017, 3:51pm
3
Thanks for your quick reply!
walter
February 19, 2017, 9:20pm
4
This enhancement will be in version 1.7, next week.