Substitute for flowImage to inline images in text from extension

Discussion about writing code for Inkscape.
pelle
Posts: 42
Joined: Wed Mar 05, 2008 8:23 am

Substitute for flowImage to inline images in text from extension

Postby pelle » Wed Oct 26, 2016 5:59 pm

I want my extension (https://github.com/lifelike/countersheetsextension) to be able to insert images in flowing text. SVG 1.2 supports this by using flowImage elements together with flowPara. Inkscape however only supports flowPara. I googled and all I could find was a bug report for this from 2005 (https://bugs.launchpad.net/inkscape/+bug/171049).

It is probably not a trivial thing to add, so I am thinking of workarounds. One thing that might work is to insert a small flowPara with just a single glyph where I want the Image to be, write out the SVG to a temporary file, and then call "inkscape --query-id" on the temporary file to get the coordinates that glyph was rendered to, then insert the image there. That would probably work and I have been known to make more hideous hacks than that, but I hope there is something slightly better. Maybe if I can set a image pattern fill on a glyph and there is a good square-shaped glyph to use that could be inserted in the text and would look like an inserted image? But I tried to set a fill pattern on a flowPara and could not get it to work (Inkscape just deletes my fill-attribute, so I guess it is not supported and perhaps not allowed in SVG).

Other ideas?

User avatar
prkos
Posts: 1537
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Substitute for flowImage to inline images in text from extension

Postby prkos » Wed Oct 26, 2016 8:30 pm

Is it also in SVG 2?

Here is some more information about SVG support in Inkscape (scroll down to How does Inkscape implement SVG?)

Sounds like a very nice feature, to have flowed objects within text. Maybe a discussion on the developer mailing list would be more lively, have you tried there? Or the Inkscape IRC chat?
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

pelle
Posts: 42
Joined: Wed Mar 05, 2008 8:23 am

Re: Substitute for flowImage to inline images in text from extension

Postby pelle » Thu Oct 27, 2016 6:09 am

Yes, flow layout in SVG sounds useful (and Inkscape has at least partial support). Here is the description for SVG 1.2: https://www.w3.org/TR/2004/WD-SVG12-20041027/flow.html. But no I can't find a mention for what the plan is for 2.0. Seems like flowImage is not included, or any of the other flow elements (including those used by Inkscape already)?

There is already the old bug report and I don't really have anything to add other than "me too". But I could use a workaround while waiting (no real plans to try to help out with Inkscape development at the moment).

pelle
Posts: 42
Joined: Wed Mar 05, 2008 8:23 am

Re: Substitute for flowImage to inline images in text from extension

Postby pelle » Thu Oct 27, 2016 6:13 am

OK, SVG 2.0 uses CSS to layout text in various shapes with automatic line-breaks. Looks better than the old flow-hacks, but unfortunately I do not see any mentions of support for inlining images there.

https://www.w3.org/TR/SVG2/text.html#Te ... ontentArea

User avatar
prkos
Posts: 1537
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: Substitute for flowImage to inline images in text from extension

Postby prkos » Thu Oct 27, 2016 8:56 pm

That sounds good too.

But you'll get better information on the dev list, especially Tav who is on the SVG working group ;)
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests