CairoSVG icon indicating copy to clipboard operation
CairoSVG copied to clipboard

Option to Union overlapping shapes

Open leomoon opened this issue 4 years ago • 5 comments

Is it possible to add an option to union the overlapping shapes before converting?

leomoon avatar Nov 10 '20 00:11 leomoon

I don’t know. Maybe there’s such a feature in Cairo, but it’s unlikely. What’s your use case?

liZe avatar Nov 12 '20 09:11 liZe

So I use CairoSVG to vectorize Persian text and import it into programs that don't support Persian directly. The vectorizing part works perfectly. There are only overlapping characters which will behave strange in graphic software when extruding.

exported-vector

To fix this right now, I have open Inkscape and use Union before importing into the graphic software. It would be really nice to have a union option.

leomoon avatar Nov 12 '20 17:11 leomoon

Oh, OK, very interesting!

liZe avatar Nov 12 '20 17:11 liZe

Qt seems to support that through the united operator in the QPainterPath. Maybe you could use a similar code to do that, even if Cairo does not support it directly.

aziesemer avatar Nov 12 '20 17:11 aziesemer

Actually, there are libraries for that in python: https://stackoverflow.com/questions/2667748/how-do-i-combine-complex-polygons

aziesemer avatar Nov 12 '20 17:11 aziesemer