stathissideris / ditaa

ditaa is a small command-line utility that can convert diagrams drawn using ascii art ('drawings' that contain characters that resemble lines like | / - ), into proper bitmap graphics.
GNU Lesser General Public License v3.0
924 stars 87 forks source link

How to centre text in a box? #38

Open cocowalla opened 5 years ago

cocowalla commented 5 years ago

I'm having difficulty centring text across 2 lines in a box, depending on the length of both lines. For example:

+--------------+
|  Some text   |
| across lines |
+--------------+

It seems that no matter what I try, when this diagram is rendered the top line is always either left or right aligned, never centred.

Would appreciate some guidance!

lljr commented 5 years ago

I think centering is an extremely tricky behavior and it probably is a good idea to fix this issue. So far, the way I deal with this is this

 +-------------+
 |  some text  |
 | across lines| 
 +-------------+

This sort of centers the text but leaves more white space after the text ends. @cocowalla