You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Aaron Optimizer Digulla <di...@hepe.com> on 2001/01/12 10:51:20 UTC

Again bugs with SVGs and some solutions

I've found the bug in my SVG-viewBox code. Now I have only
these bugs left:

- Check renderSVGArea in PDFRenderer.java. One of the first lines
reads:

    int x = this.currentXPosition;

This uses the current X position which is usually not what I
want (if I have a centered text just before my SVG, then
the SVG will be left aligned with that text). I replaced this
with

    int x = this.currentAreaContainerXPosition;

which is *almost* what I need. Now the SVG is always left aligned
with respect to the fo:block it is in. This means I cannot center
or otherwise align the SVG. I guess this is something you try to
fix with the current thread about "making SVG an inline element
like a character". Any ideas when this will be ready ?

- When I run the example files, all SVGs are omitted because the
clipping code in PDFRenderer.renderSVGArea needs to know the width
and height of the SVG (which is omitted in the SVG examples).
This the cliprect is at the correct position but has a size of
0x0. The SVG standard says that the image should be omitted if
width and height are 0 but I'm uneasy if that should also
be the case if width and height are not specified !

My solution would be to check if a size has been specified and
only clip in this case (at some point, you will have to specify
a size and you can clip then, so it should be safe. How can I check
if an attribute was specified or not ?

-- 
==============================================
Sowatec AG,       CH-8330 Pfäffikon (ZH)
Witzbergstr. 7,   http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
----------------------------------------------
Aaron "Optimizer" Digulla, digulla@sowatec.com
==============================================

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Again bugs with SVGs and some solutions

Posted by Keiron Liddle <ke...@aftexsw.com>.
Aaron Optimizer Digulla wrote:

> 
> Well, they didn't with my patch but I found the bug (instead of
> translating the coordinate system, the code in PDFRenderer.java
> calles svgRenderer.renderSVG() with an offset; this didn't work
> when a viewBox was used because a viewBox can move the origin).
> 
> Anyone interested in my viewBox patch ?
> 
I'll take a look at it.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Again bugs with SVGs and some solutions

Posted by Aaron Optimizer Digulla <di...@hepe.com>.
On Fri, Jan 12, 2001 at 09:51:58PM +1000, Keiron Liddle wrote:

> > - When I run the example files, all SVGs are omitted because the
> > clipping code in PDFRenderer.renderSVGArea needs to know the width
> > and height of the SVG (which is omitted in the SVG examples).
> > This the cliprect is at the correct position but has a size of
> > 0x0. The SVG standard says that the image should be omitted if
> > width and height are 0 but I'm uneasy if that should also
> > be the case if width and height are not specified !
> 
> Which example files, all the ones in docs/examples/svg work for me.

Well, they didn't with my patch but I found the bug (instead of
translating the coordinate system, the code in PDFRenderer.java
calles svgRenderer.renderSVG() with an offset; this didn't work
when a viewBox was used because a viewBox can move the origin).

Anyone interested in my viewBox patch ?

-- 
==============================================
Sowatec AG,       CH-8330 Pfäffikon (ZH)
Witzbergstr. 7,   http://www.sowatec.com
Tel: +41-(0)1-952 55 55
Fax: +41-(0)1-952 55 66
----------------------------------------------
Aaron "Optimizer" Digulla, digulla@sowatec.com
==============================================

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Again bugs with SVGs and some solutions

Posted by Keiron Liddle <ke...@aftexsw.com>.

Aaron Optimizer Digulla wrote:

> I've found the bug in my SVG-viewBox code. Now I have only
> these bugs left:
> 
> - Check renderSVGArea in PDFRenderer.java. One of the first lines
> reads:
> 
>     int x = this.currentXPosition;
> 
> This uses the current X position which is usually not what I
> want (if I have a centered text just before my SVG, then
> the SVG will be left aligned with that text). I replaced this
> with
> 
>     int x = this.currentAreaContainerXPosition;
> 
> which is *almost* what I need. Now the SVG is always left aligned
> with respect to the fo:block it is in. This means I cannot center
> or otherwise align the SVG. I guess this is something you try to
> fix with the current thread about "making SVG an inline element
> like a character". Any ideas when this will be ready ?

Currently it is only relevant to have an svg element in its own 
fo:block, until inline objects work.

> 
> 
> - When I run the example files, all SVGs are omitted because the
> clipping code in PDFRenderer.renderSVGArea needs to know the width
> and height of the SVG (which is omitted in the SVG examples).
> This the cliprect is at the correct position but has a size of
> 0x0. The SVG standard says that the image should be omitted if
> width and height are 0 but I'm uneasy if that should also
> be the case if width and height are not specified !

Which example files, all the ones in docs/examples/svg work for me.
The size of the svg depends on
- the size specified for the instream-foreign-object
or
- the size on the svg element
or
- size of the svg contents (not done)

clipping depends on the overflow of the instream-foreign-object and the 
viewbox of the svg.

> 
> 
> My solution would be to check if a size has been specified and
> only clip in this case (at some point, you will have to specify
> a size and you can clip then, so it should be safe. How can I check
> if an attribute was specified or not ?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org