On Sep 16, 2008, at 20:17, lmhelp wrote:
Hi
<snip />
How could I make the svg group fit into a 4cm x 4cm block?
Probably by doing a dilatation (homothety) of the svg group...
I considered using the fo:instream-foreign-object properties:
content-width="scale-to-fit"
content-height="scale-to-fit"
scaling="uniform"
(or any other one that would be more appropriated of course!)
Unfortunately, I know too little SVG to be able to tell off-hand what
the expected result is if the viewbox is too small to fit the content
(clipping?)
Anyway, you're on the right track, I think.
Regardless of the dimensions specified in the SVG, all you would need
in FO is:
<fo:instream-foreign-object
height="4cm" width="4cm"
content-height="scale-to-fit" content-width="scale-to-fit">
Whether you need uniform or non-uniform scaling depends on whether
the SVG canvas is defined to be square (width=height, like the
instream-foreign-object) or rectangular. To fit a rectangular shape
into a square box, the aspect ratio obviously cannot be maintained.
'content-height' and 'content-width' indicate what should happen with
the intrinsic dimensions of the SVG. (Note that these could be
specified without units, as device-dependent pixels --in that case,
you can use the 'source-resolution' entry in the user-configuration
to determine the dpi ratio when interpreting these; default is the
same as 'target-resolution', or 72; see [FOP_DIR]/conf/fop.xconf)
If they are 'auto' or not specified, then:
- if the SVG is wider/higher than 4cm, it will overflow or be clipped
(depending on the 'overflow' property; to clip, set
'overflow="hidden"' on the i-f-o)
- if it is narrower/lower, then 'display-align' (vertical) and 'text-
align' (horizontal) should determine where/how the image is placed
inside the 4x4 viewbox
- if the dimensions are equal, nothing worth mentioning
A value of 'scale-to-fit' will grow or shrink the intrinsic height/
width. Values of 'scale-down-to-fit' and 'scale-up-to-fit' (XSL 1.1;
implemented in FOP Trunk, IIC; not sure about 0.95) will respectively
shrink or grow the image if it is larger or smaller, but leave it
unmeddled if it already fits.
HTH!
Cheers
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]