RichAnno scrambled on SVG export
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
RichAnno scrambled on SVG export
- open this example file:
result:
As you can see, the RichTextAnno is scrambled in the SVG.
- now use the menu File -> Export PDF
result: everything looks fine: This issue is independent in the SVG namespace issue.
- use the menu TechDraw -> Export page as SVGresult:
As you can see, the RichTextAnno is scrambled in the SVG.
- now use the menu File -> Export PDF
result: everything looks fine: This issue is independent in the SVG namespace issue.
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: RichAnno scrambled on SVG export
The font size for RTA is being written in "user coordinates" (10x in our case), but being interpreted as "absolute coordinates" when read.
Not sure why plain Annotation is not affected by this.
Will have to change the way RTA font size is written to Svg.
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: RichAnno scrambled on SVG export
2 of 3 issues (text size & position) fixed by this git commit d68fcb8cc5.
If I've understood what I read, there is no easy fix to the line spacing problem. We'll need
to split the text into individual lines and position each one separately.
Re: RichAnno scrambled on SVG export
I tested and this is what I get now:wandererfan wrote: ↑Wed Feb 05, 2020 12:41 am 2 of 3 issues (text size & position) fixed by this git commit d68fcb8cc5.
This is what I got before your commit:
Here is the SVG for the box as it should look: (I exported the TD page to PDF, then opened the PDF with Inkscape, cleaned it up and saved it as plain SVG.) This SVG shows correct on all 3 browsers I can test (Chrome, Firefox and Edge). This should helps us to find out how to export the RichText box to SVG.
Re: RichAnno scrambled on SVG export
Can we make TechDraw unit test to spot any future regressions of RichTextAnno ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: RichAnno scrambled on SVG export
The problem is that we don't make the Svg in the case of RichTextAnno. We rely on a chain of QTextEdit/QTextDocument/QSvgGenerator and I don't know how many other Qt routines to produce Svg that is equivalent to the original rich text.uwestoehr wrote: ↑Wed Feb 05, 2020 11:05 am (I exported the TD page to PDF, then opened the PDF with Inkscape, cleaned it up and saved it as plain SVG.) This SVG shows correct on all 3 browsers I can test (Chrome, Firefox and Edge). This should helps us to find out how to export the RichText box to SVG.
I'm leaning towards exporting the RichTextAnno as plain text. This seems to be reliable in terms of delivering a useful result, but of course most of the formatting is lost. That seems better than delivering corrupted text.
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: RichAnno scrambled on SVG export
This commit git commit f00fca547 changes Svg export of RichTextAnno to use plain text. Plain Text appears in approximately the right place on the page and is easily changed in Inkscape.
Re: RichAnno scrambled on SVG export
But this does destroy the rich text feature and when inserting rich text, I explicitly want this.wandererfan wrote: ↑Fri Feb 14, 2020 12:57 pm This commit git commit f00fca547 changes Svg export of RichTextAnno to use plain text. Plain Text appears in approximately the right place on the page and is easily changed in Inkscape.
If there is no border, OK, but now the text size, shape and decorations are all lost. So in fact it is a plain text annotation.
There is also a regression because when you open the example file of my initial commit you get on opening this error:
Code: Select all
Reading failed from embedded file: PartShape8.brp (133002 bytes, 49082 bytes compressed)
- wandererfan
- Veteran
- Posts: 6317
- Joined: Tue Nov 06, 2012 5:42 pm
- Contact:
Re: RichAnno scrambled on SVG export
At the moment, the choice is between scrambled rich text or plain text. Rich text to Svg isn't on the table.
Not sure what this means. We don't read any brep files in TD.There is also a regression because when you open the example file of my initial commit you get on opening
this error:Code: Select all
Reading failed from embedded file: PartShape8.brp (133002 bytes, 49082 bytes compressed)