I've done exactly this myself.
QtSvg only supports the static features of SVG Tiny. From that spec on wrapping text:
Unfortunately Inkscape does none of these things in its multi-line text. If memory serves it uses an attribute from the draft SVG Full 1.2 (flowRoot and flowRegion). I simply created multiple text objects for multi-line fixed text. For columns of variable text I retrieved a named bounding box and rendered the text within the rectangle after rendering the template. You could try manually using a textarea.Each 'text' element causes a single string of text to be rendered. The 'text' element performs no automatic line breaking or word wrapping. To achieve the effect of multiple lines of text, use one of the following methods:
* Use the 'textArea' element to specify a rectangular area in which to flow the text.
* Pre-compute the line breaks (which can be done by the author or authoring tool) and use individual 'text' elements to manually place the lines of text. (Note: this is discouraged for accessibility reasons.)
* Express the text to be rendered in another XML namespace such as XHTML [XHTML] embedded inline within a 'foreignObject' element. (Note: the exact semantics of this approach are not completely defined at this time.)
In my application background shading was optional and only rendered when requested (I painted selected SVG objects by id). I had to be careful that the background was painted before the overlying lines or it would obscure them. If you do something similar this is something to watch for.2. Another related to rendering, as you can see in the SVG, I have a background in which represents the receipt structure. Well, Qt only is rendering only the backgrond color and the external borders. The lines inside the background, does not appear (which again, it works in all browsers and SVG viewers).
When I get to my Qt dev machine I'll try your code and see if I can see the the same problem.
Edit:
It does that for me too.





Reply With Quote
Bookmarks