How to preserve space character in SVG

0 votes
asked Dec 6 in Question / help by anonymous

I am creating a component diagram.  In which, I would like the spaces given in between words to be preserved.

e.g.

@startuml
["Hello                World"]
@enduml

The generated PNG preserves the spaces accordingly.

image

https://www.plantuml.com/plantuml/img/SoWkIImgAStDuOfMyaZDoSbNG0FX-KKvAKgnN0wfUIb0PG00

But the generated SVG is not preserving the spaces.  Its like this

https://www.plantuml.com/plantuml/svg/SoWkIImgAStDuOfMyaZDoSbNG0FX-KKvAKgnN0wfUIb0PG00

How can I preserve the spaces in SVG as well?

commented 4 days ago by Vivek
I also figured out that the <text> tag of svg has an attribute called "xml:space" which can be set to "preserve" in order to preserve the spacing.

<svg>
<text xml:space="preserve">Hello           world</text>
</svg>

or even the top level stylesheet like the below can also preserve the spacing:

<svg>
<style>
text {
  white-space: pre;
}
</style>
<text>Hello           world</text>
</svg>


So now the question is, how can we specify these attributes or the CSS property in PUML file so that the generated SVG can contain these modifiers for the desired results.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
...