The participant rectange seems to big if a line break is used witin the particiant name

0 votes
asked Jun 13 in Question / help by stefan_stsc (150 points)

Hi,

I tested the sequence diagram from this example where the participant contains multiple lines.
In my result the green rectangle is bigger than needed. It looks like the size is calculated from
the whole text ignoring the new line character. I use the version 1.2018.06 and TeX Live 2018

Did i miss some settings here?

Thanks Stefan

1 Answer

0 votes
answered Jun 13 by plantuml (179,660 points)
selected Jun 14 by stefan_stsc
 
Best answer

Unfortunately it's not due to newline. The issue is explained here http://forum.plantuml.net/6495/wrong-class-widths-after-latex-export

This one is very difficult to solve. There is an undocumented "tikzFont" parameter that you can use.

For example,

@startuml
skinparam tikzFont 0.8;4.5
participant "I have a really" as A
participant "long name" as B
participant "I have a really\nlong name" as C
@enduml

seems to give good result.

There are two parameters to extrapolate between Java font size and Tikz font size. Those two parameters can be changed using "skinparam tikzFont".

The first one (1.2 beeing it's default value) is a simple zoom factor. A value of 1.2 means that we take the Java "Serif" font size and we multiply the result by 1.2 to have the expected Tikz font width.

The second one (4.0 beeing it's default value) is more tricky to explain. We try to detect large characters like "w" which are really different in Tikz and in Java. To do so, we compute Java "Serif" width of the text to be printed using both a slightly smaller font size and a slightly bigger font size. The difference between those two values gives an idea of the quantity of "large" characters in the string to be printed. This difference will be multiply by 4.0 and decrease from the total width. (Ok that's weird, but it seems to give good results).

Since we did not find any good solution to this issue, we are very open to suggestions!

Thanks,

commented Jun 14 by stefan_stsc (150 points)
Hi  Thanks for the tip.
...