After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 482585 - UML Comment wrapping overflows the object
UML Comment wrapping overflows the object
Status: RESOLVED FIXED
Product: dia
Classification: Other
Component: objects
0.96.1
Other Linux
: Normal normal
: 0.97
Assigned To: Dia maintainers
Dia maintainers
Depends on:
Blocks:
 
 
Reported: 2007-10-02 13:59 UTC by Roland Stigge
Modified: 2008-03-02 03:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Bug Example (Window Screenshot Example) (15.17 KB, image/png)
2007-10-02 14:01 UTC, Roland Stigge
  Details
Compute the max line width in a wrapped comment (1.68 KB, patch)
2008-03-01 21:14 UTC, Saurabh Nanda
none Details | Review

Description Roland Stigge 2007-10-02 13:59:44 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
Comment 1 Roland Stigge 2007-10-02 14:01:00 UTC
Created attachment 96513 [details]
Bug Example (Window Screenshot Example)
Comment 2 Saurabh Nanda 2008-03-01 18:24:08 UTC
I vote for this bug. Please fix this.
Comment 3 Hans Breuer 2008-03-01 18:38:05 UTC
This is not a matter of voting. Instead someone capable to fix this needs to just do it. Patches accepted.
Comment 4 Saurabh Nanda 2008-03-01 21:14:27 UTC
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.
Comment 5 Saurabh Nanda 2008-03-01 21:17:18 UTC
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.
Comment 6 Hans Breuer 2008-03-01 22:40:46 UTC
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

Comment 7 Saurabh Nanda 2008-03-02 03:52:31 UTC
Thanks Hans. This makes me happy, I was up till 3:00 AM last night trying to figure out the code.