SVG styles being ignored

Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SVG styles being ignored

Samuel Penn-2
Hi all,

I have a document which imports an SVG as a full page graphic. It used to display fine, but recently I started having problems with it. The problems started after I recently edited the image in Inkscape (it's been unchanged for a couple of years). Since the image was created in Inkscape, and has only ever been edited in Inkscape, I'm not sure why it's started having problems now.

I'm using FOP 2.3 on Ubuntu 18.04, with Java 11.0.4

The first issue was that the image was displayed at the wrong size - it was resized so only the top left quarter of the image was displayed (but sized to fill the entire page). I've tracked this down to a change in how Inkscape is setting the page width and height in the document. It used to specify (according to my gitlab history):
    width="744.09448819"
    height="1052.3622047"
Inkscape recently changed things to:
    width="210mm"
    height="297mm"

Since it's an A4 page (210mm x 297mm), the change seems perfectly reasonable, but FOP doesn't seem to like it. Changing the units back to the unitless values seems to have fixed that, so this issue is more a curiosity than a problem for me at the moment.

The bigger issue is that FOP has stopped rendering styles on some graphics. This seems to be mostly limited to text styles - colours and border styles. Even if I convert the text to a path, then it is still displayed as flat colour. I've put some examples of the problem I'm seeing, along with a cut down FO file, here:


with-styles.png shows how the image should look (and does look in Inkscape)
no-styles.png shows how the image is rendered by FOP when it's converted to a PDF.

I've also included the SVG file, generated PDF and my fop.conf file.
The SVG includes the font Archivo Black (which is referenced in the fop.conf), but I see the problem with standard fonts as well.

Also included, is test-wrong-size.pdf, which shows how the PDF is rendered before I changed the page units from mm.

So far the only work around I've found is to export the image as PNG from Inkscape, and include that in the document instead. I'd prefer to be able to directly include the SVG though.

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: SVG styles being ignored

Oskar Berggren
Batik bug since 2015:

Sometimes coincidences are ridiculous... I discovered the existence of this problem only yesterday and tried to bring some attention to it:


Den ons 11 sep. 2019 kl 21:09 skrev Samuel Penn <[hidden email]>:
Hi all,

I have a document which imports an SVG as a full page graphic. It used to display fine, but recently I started having problems with it. The problems started after I recently edited the image in Inkscape (it's been unchanged for a couple of years). Since the image was created in Inkscape, and has only ever been edited in Inkscape, I'm not sure why it's started having problems now.

I'm using FOP 2.3 on Ubuntu 18.04, with Java 11.0.4

The first issue was that the image was displayed at the wrong size - it was resized so only the top left quarter of the image was displayed (but sized to fill the entire page). I've tracked this down to a change in how Inkscape is setting the page width and height in the document. It used to specify (according to my gitlab history):
    width="744.09448819"
    height="1052.3622047"
Inkscape recently changed things to:
    width="210mm"
    height="297mm"

Since it's an A4 page (210mm x 297mm), the change seems perfectly reasonable, but FOP doesn't seem to like it. Changing the units back to the unitless values seems to have fixed that, so this issue is more a curiosity than a problem for me at the moment.

The bigger issue is that FOP has stopped rendering styles on some graphics. This seems to be mostly limited to text styles - colours and border styles. Even if I convert the text to a path, then it is still displayed as flat colour. I've put some examples of the problem I'm seeing, along with a cut down FO file, here:


with-styles.png shows how the image should look (and does look in Inkscape)
no-styles.png shows how the image is rendered by FOP when it's converted to a PDF.

I've also included the SVG file, generated PDF and my fop.conf file.
The SVG includes the font Archivo Black (which is referenced in the fop.conf), but I see the problem with standard fonts as well.

Also included, is test-wrong-size.pdf, which shows how the PDF is rendered before I changed the page units from mm.

So far the only work around I've found is to export the image as PNG from Inkscape, and include that in the document instead. I'd prefer to be able to directly include the SVG though.

Thanks.


Reply | Threaded
Open this post in threaded view
|

Re: SVG styles being ignored

Thomas Radtke-2
And btw., Batik needs attributes width and height beside viewport in the svg root element. I noticed this when an recently uploaded SVG rendered correctly everywhere except in FOP generated PDFs. What happened was that Illustrator CC apparently stopped writing both arguments. Touching the file with Inkscape didn't help as it refused to add them.

Currently I always have to enter those values myself and actually are thinking about adding an xslt script to my CMS to add width and height after uploading SVGs :-(.

Best regards,

Thomas

Am 11.09.2019 um 23:41 schrieb Oskar Berggren:
Batik bug since 2015:

Sometimes coincidences are ridiculous... I discovered the existence of this problem only yesterday and tried to bring some attention to it:


Den ons 11 sep. 2019 kl 21:09 skrev Samuel Penn <[hidden email]>:
Hi all,

I have a document which imports an SVG as a full page graphic. It used to display fine, but recently I started having problems with it. The problems started after I recently edited the image in Inkscape (it's been unchanged for a couple of years). Since the image was created in Inkscape, and has only ever been edited in Inkscape, I'm not sure why it's started having problems now.

I'm using FOP 2.3 on Ubuntu 18.04, with Java 11.0.4

The first issue was that the image was displayed at the wrong size - it was resized so only the top left quarter of the image was displayed (but sized to fill the entire page). I've tracked this down to a change in how Inkscape is setting the page width and height in the document. It used to specify (according to my gitlab history):
    width="744.09448819"
    height="1052.3622047"
Inkscape recently changed things to:
    width="210mm"
    height="297mm"

Since it's an A4 page (210mm x 297mm), the change seems perfectly reasonable, but FOP doesn't seem to like it. Changing the units back to the unitless values seems to have fixed that, so this issue is more a curiosity than a problem for me at the moment.

The bigger issue is that FOP has stopped rendering styles on some graphics. This seems to be mostly limited to text styles - colours and border styles. Even if I convert the text to a path, then it is still displayed as flat colour. I've put some examples of the problem I'm seeing, along with a cut down FO file, here:


with-styles.png shows how the image should look (and does look in Inkscape)
no-styles.png shows how the image is rendered by FOP when it's converted to a PDF.

I've also included the SVG file, generated PDF and my fop.conf file.
The SVG includes the font Archivo Black (which is referenced in the fop.conf), but I see the problem with standard fonts as well.

Also included, is test-wrong-size.pdf, which shows how the PDF is rendered before I changed the page units from mm.

So far the only work around I've found is to export the image as PNG from Inkscape, and include that in the document instead. I'd prefer to be able to directly include the SVG though.

Thanks.



--

Mit freundlichen Grüßen / with best regards

i.A. Dr. Thomas Radtke

Technische Redaktion / Technical Writer

Dr. Thomas Radtke
Fon +49 (0) 4498 8964
Fax +49 (0) 4498 687
[hidden email]
HANSA Klimasysteme GmbH
Stockweg 19
26683 Saterland (Germany)
www.hansa-klima.de

Geschäftsführer: Rolf Neumann, Jan Neumann, Carsten Fenne
Registergericht Oldenburg, HRB 151863

Reply | Threaded
Open this post in threaded view
|

Re: SVG styles being ignored

Samuel Penn-2
In reply to this post by Oskar Berggren
Thanks. I'll add a vote to the bug.

I agree that it's more than minor, because it basically means I can't import SVGs.


Sam.


-------- Original Message --------
On 11 Sep 2019, 22:41, Oskar Berggren < [hidden email]> wrote:

Batik bug since 2015:

Sometimes coincidences are ridiculous... I discovered the existence of this problem only yesterday and tried to bring some attention to it:


Den ons 11 sep. 2019 kl 21:09 skrev Samuel Penn <[hidden email]>:
Hi all,

I have a document which imports an SVG as a full page graphic. It used to display fine, but recently I started having problems with it. The problems started after I recently edited the image in Inkscape (it's been unchanged for a couple of years). Since the image was created in Inkscape, and has only ever been edited in Inkscape, I'm not sure why it's started having problems now.

I'm using FOP 2.3 on Ubuntu 18.04, with Java 11.0.4

The first issue was that the image was displayed at the wrong size - it was resized so only the top left quarter of the image was displayed (but sized to fill the entire page). I've tracked this down to a change in how Inkscape is setting the page width and height in the document. It used to specify (according to my gitlab history):
    width="744.09448819"
    height="1052.3622047"
Inkscape recently changed things to:
    width="210mm"
    height="297mm"

Since it's an A4 page (210mm x 297mm), the change seems perfectly reasonable, but FOP doesn't seem to like it. Changing the units back to the unitless values seems to have fixed that, so this issue is more a curiosity than a problem for me at the moment.

The bigger issue is that FOP has stopped rendering styles on some graphics. This seems to be mostly limited to text styles - colours and border styles. Even if I convert the text to a path, then it is still displayed as flat colour. I've put some examples of the problem I'm seeing, along with a cut down FO file, here:


with-styles.png shows how the image should look (and does look in Inkscape)
no-styles.png shows how the image is rendered by FOP when it's converted to a PDF.

I've also included the SVG file, generated PDF and my fop.conf file.
The SVG includes the font Archivo Black (which is referenced in the fop.conf), but I see the problem with standard fonts as well.

Also included, is test-wrong-size.pdf, which shows how the PDF is rendered before I changed the page units from mm.

So far the only work around I've found is to export the image as PNG from Inkscape, and include that in the document instead. I'd prefer to be able to directly include the SVG though.

Thanks.