GNOME Bugzilla – Bug 684763
Wrong text alignment on vdx export
Last modified: 2014-08-29 17:03:52 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>
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*/
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.
Looks like a duplicate of 701106 ?
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 ***
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));
Created attachment 284802 [details] [review] Align VDX Text by fixing locpin position to centre of text.
Created attachment 284803 [details] Result of importing attached VDX
Created attachment 284804 [details] Misalign result of importing attached vdx exporting as vdx and reimporting without patch
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.
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 ***