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 Charles Palmer <ch...@dspdesign.com> on 2000/12/04 20:44:16 UTC

Scaling of images

I've been messing around trying to put images into a document. I seem to have found experimentally that:

(1) placing an image into a fo:block-container that is too small results in the image not being rendered (no error message is generated).

(2) placing the same block-container inside a table cell results in the image being scaled to fit the cell.

Question: Is this expected behaviour? If so then sorry for being thick - could you point me to the right place in the spec.

Suggestion: If it is expected then is it sensible to print a warning message if the image is not rendered? (I note that if I have a leader which is too long to fit in a table cell then I get a warning message telling me it is being truncated.) 

I'm using fop_0_15_0.

Here is the code that shows the image being treated differently:

         <fo:block-container border-color="red" border-style="solid" border-width="2pt" height="8cm" width="15cm" padding="1pt">
            <fo:block text-align-last="end">
               <fo:external-graphic src="file:../tp300/tp300_photo.jpg"/>
            </fo:block>
         </fo:block-container>
         <fo:table>
            <fo:table-column column-width="3cm"/>
            <fo:table-body>
               <fo:table-row>
                  <fo:table-cell>
                     <fo:block-container border-color="red" border-style="solid" border-width="2pt" height="15cm" width="15cm" padding="1pt">
                        <fo:block space-before.optimum="10pt">
                           <fo:external-graphic src="file:../tp300/tp300_photo.jpg"/>
                        </fo:block>
                     </fo:block-container>
                  </fo:table-cell>
               </fo:table-row>
            </fo:table-body>
         </fo:table>


thanks - Charles palmer


Re: Scaling of images

Posted by Fotis Jannidis <fo...@lrz.uni-muenchen.de>.
From:           	Charles Palmer <ch...@dspdesign.com>

> I've been messing around trying to put images into a document. I
> seem to have found experimentally that: 
> 
> (1) placing an image into a fo:block-container that is too small
> results in the image not being rendered (no error message is
> generated). 

this is a bug. The desired behaviour would be, either that the image 
is clipped to the available space or that it overflows. We can decide 
which one we want to use, because default value for "overflow" is 
"auto": 
"The behavior of the "auto" value is user agent dependent,
but should cause a scrolling mechanism to be provided for 
overflowing boxes." (Mmh, it is certainly difficult to write a media 
independent specification which doesn't make some assumptions 
about the medium) 

> (2) placing the same block-container inside a table cell results
> in the image being scaled to fit the cell. 

I haven't studied the table section thoroughly, but scaling the image 
automatically is afaik not the thing to do. If content-height is not set, 
its value is "auto" and that means: take the intrinsic height. 
 
> Suggestion: If it is expected then is it sensible to print a
> warning message if the image is not rendered? (I note that if I
> have a leader which is too long to fit in a table cell then I get
> a warning message telling me it is being truncated.) 

It sets "auto" for overflow to the value "error-if-overflow"; maybe we 
should handle this uniformly in Fop and document it. But I have to 
admit: clipping a leader is much easier than a image. 

Fotis