Different handling of x, y for path vs. text breaking text clipping
Hi all,
I'm trying to get clipping on text read in from EMF to work properly and r13463 (and maybe earlier) is doing something odd in that it is treating path and text coordinates differently, but ONLY when it reads the SVG "hot off the press" from the EMF read. If the exact same SVG is first emitted to a file and then read in directly, it works fine. Here is one such file(retrieve only directory):
http://saf.bio.caltech.edu/pub/pickup/mangle_clip.svg
that has the clipping more or less right when viewed in Firefox and when opened in Inkscape. But when the source EMF file is read directly, the coordinates of the <text> pieces are transformed and a <transform> tag is added to the <text>, the coordinates of the <path> draw are not transformed. Since both reference the same clipping path, this breaks clipping for text, because the coordinates of the clip-path must match up with those of the <text> IN the <text>, not AFTER it. If the text were not being clipped, the transform would not make a difference (but it is, so it does).
The link above is the output of the following code fragment:
(void) myEnhMetaFileProc(contents,length, &d); free(contents);
if (d.pDesc){ free( d.pDesc ); }
std::cout << std::endl << d.outsvg << std::endl;
SPDocument *doc = SPDocument::createNewDocFromMem(d.outsvg.c_str(), strlen(d.outsvg.c_str()), TRUE);
And things go wrong when the SVG as text in memory goes through createNewDocFromMem but not when the SVG as text in a file goes through whatever path the usual SVG file open uses.
Does this issue sound familiar to anyone, and if so, what is the workaround?
Thanks,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech
On 23-Jul-2014 17:47, mathog wrote:
Sorry, forgot to post the link to the mangled one. The preceding one is what comes out of the EMF read and is passed to createNewDocFromMem, the next one is what Inkscape then makes of it.
http://saf.bio.caltech.edu/pub/pickup/mangled_clip.svg
Look at, for instance, all the pieces related to "clipEmfPath1". The units for the clipPath are the same in the two files
d="m 993.743,142.499 14.997,0 0,30 -14.997,0 z"
and the units for the "star" are the same in its <path>
d="m 1016.02,168.299 -7.95,-6.975 -8.102,6.825 4.202,-9.675 -9.002,-5.625 10.572,1.05 2.48,-10.35 2.32,10.35 10.58,-0.75 -9.15,5.4 z"
but note that the unmangled one has no associated transform, and the mangled one now includes
transform="matrix(0.28222223,0,0,0.28222223,0,-9.9911637e-7)"
The clip on that path still works in the mangled one because the clip is applied before the coordinates are scaled.
Not so for text. In the unmangled one it is:
transform="matrix(1.000000,-0.000000,0.000000,1.000000,991.492631,146.998908)" x="0.000000" y="2.497559"
which is overlaps with the clip. However the mangled one has:
x="279.82126" y="42.191227"
which does not overlap. In this case the transform has been applied (permanently) before the clip is applied, so it does not work.
Regards,
David Mathog mathog@...1176... Manager, Sequence Analysis Facility, Biology Division, Caltech
participants (1)
-
mathog