GNOME Bugzilla – Bug 482585
UML Comment wrapping overflows the object
Last modified: 2008-03-02 03:52:31 UTC
Hi, a Debian user reported the following: =========================================================================== Sometimes when displaying comments in a UML class object, the wrapping fails to keep the text inside the object. Screenshot here: http://www.crustynet.org.uk/~chrisb/dia-wrap-bug.png It looks like it may be constraining the width of the object to the width of the first line, even though the second line is longer. =========================================================================== I can reproduce this. See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=439371 bye, Roland
Created attachment 96513 [details] Bug Example (Window Screenshot Example)
I vote for this bug. Please fix this.
This is not a matter of voting. Instead someone capable to fix this needs to just do it. Patches accepted.
Created attachment 106353 [details] [review] Compute the max line width in a wrapped comment I think the way dia_font_string_width computes the width of a string with line breaks is incorrect. I was unable to fix the dia_font_string_with function so I put a "monkey" patch around it's usage in umlclass_calculate_operation_data. I call dia_font_string_width for each line in a wrapped comment and take the max width.
Disclaimer #1: I haven't written C code in last six years. I'm sure my patch is pretty sloppy. Disclaimer #2: I have not compiled this patch as downloading all the dependencies to compile dia would not be possible on my dialup. It would be great if you can apply this patch and try it, regardless.
Thanks for the patch. Although it was not the right place it gave me the idea where to fix the issue. BTW: using 'diff -u' is preferred because it gives much more readable patches. 2008-03-01 Hans Breuer <hans@breuer.org> * lib/font.c : dia_font_get_sizes() was wrongly assuming single line passed in. Patch inspired by Saurabh Nanda, fixes bug #482585
Thanks Hans. This makes me happy, I was up till 3:00 AM last night trying to figure out the code.