How best to handle long text?

  • Mawg

    Mawg - 2012-07-18

    I wrote a program which parses the output of my unit testing and produces an input file for MSC Generator.

    If I have a long message name it is shown completely if I have multiple columns (which mean a wide diagram), but if I only have a few columns (narrow diagram), then only part of the text is shown.

    (by default, it is right aligned, so I prepend (the not very well documented) "\pl" for left align, which heps a little, but I still lose text at the right).

    Is there anyway to cause MSC Generator to auto-wrap and split the line into multiple lines? Or just to make the diagram big enough to hold all of the text?

  • Zoltán Turányi

    Sorry for being unresponsive till now. I have not added any automatic word wrapping to break a label. You can insert '\n' symbols into a label to cause it to break.

    I can add word wrapping, but then how would Msc-generator know how wide you want the label? Shall I add an attribute? Any suggestions?

    How do you think the documentation could be improved for \pl? I thought it is pretty OK, but apparently were mistaken :-)

  • Mawg

    Mawg - 2012-12-24

    Looking again, the docs for \pl are fine.

    I could add \n myself, if you suggest a fromula (maybe you can tell me what is the documnt width in chars, depending on the amount of columns (hmm, plus factor in font size)). I can do that - it's not that I am lazy (grin), but if you do it then everyone benefits.

    As to how wide, there are two possibilities: 1) adding a text/box/etc to a single column and 2) a banner across teh entire MSC.

    In case 1) I think that each column "owns" a box which is as wide as a column and is centred om that column:

         |                |              |
     -----------          |              |
     |         |          |              |
     -----------          |              |
         |                |              |
         |          -------------        |
         |          |           |        |
         |          -------------        |
         |                |              |

    So. if you can auto-wrap within that box. I don't mind if I have at add another tag to the text to indicate that it should auto-wrap if it reaches the right border of the box.

    In case 2, I am surprised that currently the text is simply cut-off at the right edge of the diagram (half a column width to the right of the last column). It should be easy enough to auto-wrap that, with a tag if necessary.

    I say that it surprised me, because when I use a "comment" which begins at the right-most edge of the diagram, you add as much space as is needed to show it all.

    I hope that this is clear; please let me know if not.

    And keep up the good work on this excellent application!

  • Zoltán Turányi

    Hi Graham,

    Thanks for the insigths above. Indeed this is an area for improvement.

    Right now, there are two modes for determining the spacing between entities. You can select between them via the 'hscale' chart option. If 'hscale' is set to a specific number (default is 1) the entities will be spaced evenly - the larger the number the further apart. If 'hscale' is set to 'auto', then entities are spaced as wide apart as needed for all the text to have enough room. That is, if the label of an arrow is wide, entities are set so far apart that the label is not longer than the arrow. The same for boxes and so on. In this mode, the distance between entities is not uniform.

    (I am not sure you have tried "hscale=auto" and if so what did you think about it. Please let me know.)

    The latter mode was added lately and I kind of think of it as the best way to lay out charts: this is the mode that uses horizontal space most economically. (My general problem is that charts usually take up too much space.) So I neglected the other mode.

    (When adding support for comments, I have opted to make them auto-scaling horizontally, even if hscale is set to a number - but as you have observed this somehow breaks the logic, as in this mode no other element auto-scales horizontally.)

    In the auto-scaling mode, I think there is little sense in automatic word wrapping. In that mode, horizontal spacing is determined from the user defined word wrapping and not the other way around. There is no "inherent" space owned by entities to do automatic word wrapping based on.

    However, for the fix-scaling modes, this is definitely possible, or even required. So I take this as a feature request. What I plan is as follows. I will add a new option 'wrap' to elements with label to turn automatic word wrapping on and off. These will be silently ignored if 'hscale' is set to 'auto'. Having this on will prevent the label from flowing out of its available space. I will also add a chart option 'wrap' to turn this on globally (with the per-element attribute overriding the global settings, as for 'compress'). The setting the global option will generate a warning message if hscale=auto. Would this be a good way to do it?

    (In any case please do not expect a quick resolution of this, I do not have that much time for this tool. :-|)

    Have a happy new year!

  • Mawg

    Mawg - 2013-01-07

    Thank you very much for taking the time to help.

    hscale=auto helps a little, but it also reduces the font of the entire MSC

    Since you don't have much time for this project, I will have to live with that, but if you ever want a sample input from me, please let me know.

    Thanks again and best wishes for 2013

  • Zoltán Turányi

    Hi Graham,

    Please provide your sample to me.
    Actually hscale=auto should not reduce the font size. Perhaps it makes the chart wider (this is the whole point of it) and if viewed the same size, the fonts look smaller..?
    Perhaps it is equally bad for you.
    Anyway this is on my todo list and you will be the first to know when something happened.

    Best Wishes for 2013,


Log in to post a comment.