Please provide a skinparam to set the text aligment to center

+1 vote
asked Mar 23, 2017 in Closed feature request by anonymous

The component title used to be centered which was true even for multi-line text. Now the text lines are rendered left-aligned. I liked it better before.

I'd like a way get the old behavior using a skinparam.

PNG of this code: ["component title\n more component info"]<<myStereotype>> now looks like:

------------------------------
|       <<myStereotype>>     |
| component title            |
| more component info        |
------------------------------

but it used to look like:

------------------------------
|       <<myStereotype>>     |
|       component title      |
|     more component info    |
------------------------------

However this only seems to happen, when the title exceeds some length. Weird.

1 Answer

+1 vote
answered Mar 26, 2017 by plantuml (295,800 points)
selected Mar 23, 2018 by Anthony-Gaudino
 
Best answer

You're right, the alignment is now left by default.

If you want to change this, you can download last beta
https://www.dropbox.com/s/koo42q3d9gxw288/plantuml.jar?dl=0

And use:

@startuml
skinparam defaultTextAlignment center
[component title\n more component info] <<myStereotype>>
@enduml

Does it sound good to you ?

commented Mar 26, 2017 by anonymous
Perfect! Many thanks!
commented Dec 13, 2017 by Andreas Kågedal
The "default" in the parameter name `defaultTextAlignment` implies that it is possible to change the text alignment for specific texts (hopefully, in a specific note box for instance). Otherwise, the parameter would be called `textAlignment`.  Is this true? and if so, how is it done?
...