Description

1st version, only read global data and dump the text as it is.

It seems very unlikely technically feasible to convert a text window to SVG. Problem areas: • Leading whitespace –preserve. • Empty lines –ditto preserve. • wrap –improper for every text element. • Format positions are indexed, and must be calculated from surrounding text.

Unfortunately, this will rule out every composite window, based on text.

Tags are stored as styles, the application is not as simple as that, however. First this tagconfigure function is called before there is any text added. And each tag may shift the baseline for a given line. Using logical dimensions – based on index doesn't help either; they are not the same anyway.

A full dump of text-to-SVG means to reimplement the text window –so to say. Not worth it, leave a simple version without any applied styles.

Conserve the tags inside the text window; at least to the possible amount. get all the used tags. Parse each line separately and look up what tag is used inside this line, then set the linespace for this line to the highest linespace used in this line. Proceed further for the next text item.

It doesn’t seem tspan supports class hence the tag information will be lost text must be disassembled in a per-line fashion, except where there is no tag at all.

The given code cannot deal with overlapping tags. Only a single tag element is assumed. The results from overlapping tags are undefined.

Walking the tags: preserving spaces and margins inside embedded tags should be possible, too. A left margin and right/center alignment could be mapped on dx similar rmargin on a post-dx value, generated for the following tspan element.

Tags with background are preserved, but... The rectangle is being placed under the text element.

Background for single line tags span the entire window width.

lmargin1 is being used to align text, but not the background rectangle. Do not mix rectangle and lmargin1!