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 684763 - (VDX_LocPin) Wrong text alignment on vdx export
(VDX_LocPin)
Wrong text alignment on vdx export
Status: RESOLVED DUPLICATE of bug 650527
Product: dia
Classification: Other
Component: exports
0.97.x
Other Windows
: Normal enhancement
: ---
Assigned To: Dia maintainers
Dia maintainers
Depends on:
Blocks:
 
 
Reported: 2012-09-25 07:33 UTC by Oswald
Modified: 2014-08-29 17:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
render-test.vdx saved with Dia master (363.94 KB, application/vnd.ms-visio.viewer)
2012-09-25 18:28 UTC, Hans Breuer
  Details
Align VDX Text by fixing locpin position to centre of text. (643 bytes, patch)
2014-08-29 10:41 UTC, Oswald
none Details | Review
Result of importing attached VDX (86.56 KB, image/png)
2014-08-29 10:42 UTC, Oswald
  Details
Misalign result of importing attached vdx exporting as vdx and reimporting without patch (85.37 KB, image/png)
2014-08-29 10:43 UTC, Oswald
  Details

Description Oswald 2012-09-25 07:33:41 UTC
Text is not aligned correctly when exporting as vdx (Visio XML) since the so-called LocPinX and LocPinY is not specified as I guess should be the middle of a text's Xform:

E.g. It is currently:
<XForm>
  <Angle>0.000000</Angle>
  <FlipX>0</FlipX>
  <FlipY>0</FlipY>
  <Height>0.087335</Height>
  <LocPinX>0.000000</LocPinX>
  <LocPinY>0.000000</LocPinY>
  <PinX>0.492126</PinX>
  <PinY>8.926673</PinY>
  <ResizeMode>0</ResizeMode>
  <Width>1.484695</Width>
</XForm>

When in fact it should be (Note LocPinY is Height/2 and LocPinX is Width/2):
<XForm>
  <Angle>0.000000</Angle>
  <FlipX>0</FlipX>
  <FlipY>0</FlipY>
  <Height>0.087335</Height>
  <LocPinX>0.742348</LocPinX>
  <LocPinY>0.043668</LocPinY>
  <PinX>0.492126</PinX>
  <PinY>8.926673</PinY>
  <ResizeMode>0</ResizeMode>
  <Width>1.484695</Width>
</XForm>
Comment 1 Oswald 2012-09-25 09:22:42 UTC
I think only the LocPinX should be set to half of the width in vdx-export.c
near the comment:
/* Hack to give it an approximate bounding box */
XForm.Height = renderer->fontheight/vdx_Font_Size_Conversion;
XForm.Width = strlen(text)*renderer->fontheight/vdx_Font_Size_Conversion;
XForm.LocPinX = XForm.Width/2.0; /*OvG: Fix Text Alignment*/
Comment 2 Oswald 2012-09-25 09:26:09 UTC
I think only the LocPinX should be set to half of the width in vdx-export.c
near the comment:
/* Hack to give it an approximate bounding box */
XForm.Height = renderer->fontheight/vdx_Font_Size_Conversion;
XForm.Width = strlen(text)*renderer->fontheight/vdx_Font_Size_Conversion;
XForm.LocPinX = XForm.Width/2.0; /*OvG: Fix Text Alignment*/
Comment 3 Hans Breuer 2012-09-25 18:28:43 UTC
Created attachment 225155 [details]
render-test.vdx saved with Dia master

Attached you will find one of Dia's standard test files saved as VDX.
IMO the issue you described is already solved on Dia master by bug 650527.
It is not fixed differently than you suggested IIRC.

Please give the version number of the Dia version you are reporting issue against.
Comment 4 Claudio Saavedra 2013-11-19 15:00:23 UTC
Looks like a duplicate of 701106 ?
Comment 5 Hans Breuer 2013-11-19 20:29:53 UTC
I see no relation to bug 701106, but my comment #3 says this issue is already saved by bug 650527. Not sure why I didn't resolve as duplicate than.

*** This bug has been marked as a duplicate of bug 650527 ***
Comment 6 Oswald 2014-08-29 09:49:15 UTC
Bug was not corrected by resolving
 
https://bugzilla.gnome.org/show_bug.cgi?id=650527

as 650527 did not address centre aligning it on the LocPinX

See proposed patch:
---------------------------------------------------------------------------

diff -urN dia-pristine/dia/plug-ins/vdx/vdx-export.c dia-workarea/dia/plug-ins/vdx/vdx-export.c
--- dia-pristine/dia/plug-ins/vdx/vdx-export.c	2014-08-29 11:28:30.392970100 +0200
+++ dia-workarea/dia/plug-ins/vdx/vdx-export.c	2014-08-29 11:38:15.776452100 +0200
@@ -1293,6 +1293,8 @@
     XForm.Height = renderer->fontheight/vdx_Font_Size_Conversion;
     /* some arbitrary resizing of the paragraph box to make the text always fit */
     XForm.Width = visio_length(text_width);
+	/* Centre Align */
+	XForm.LocPinX = XForm.Width/2.0;
 
     /* Character properties */
     memset(&Char, 0, sizeof(Char));
Comment 7 Oswald 2014-08-29 10:41:09 UTC
Created attachment 284802 [details] [review]
Align VDX Text by fixing locpin position to centre of text.
Comment 8 Oswald 2014-08-29 10:42:33 UTC
Created attachment 284803 [details]
Result of importing attached VDX
Comment 9 Oswald 2014-08-29 10:43:43 UTC
Created attachment 284804 [details]
Misalign result of importing attached vdx exporting as vdx and reimporting without patch
Comment 10 Hans Breuer 2014-08-29 11:58:07 UTC
There seems to be a misundertanding: bug 650527 is resolved with target milestone 0.98 and it fixes the issue for me. Of course it does not fix already released version 0.97.2.
Also, please avoid judging Dia's export facility by it's import facility. They could be symmetrical buggy or one could confuse an export bug as an import bug or vice versa. My tests of VDX export are with Microsoft Visio Viewer 2010 (on Windows).
Finally according to my reading of http://msdn.microsoft.com/en-us/library/ff765844%28v=office.14%29.aspx LocPinX should only influence rotation, not general position.
So I think the duplicating was right, but I still wonder which version of Dia was used to produce the above screen shots. With both versions I checked (head of master and head of dia-0-97 branch) the text positioning from attachment 225155 [details] looks correct.
Comment 11 Hans Breuer 2014-08-29 17:03:52 UTC
The mispalcment as in attachment 284804 [details] is created by saving to vdx with Dia from dia-0-97 branch. That's because the fixes from bug 650527#c5 are not merged to dia-0-97 branch. Given that I have no intention to do that, back to duplicate.

*** This bug has been marked as a duplicate of bug 650527 ***