Adjusting float height on paged media

Problem:
When using floats on paged media, if the floats are rather tall  
relative to the page height get moved to the next page too easily and  
leave a lot of unused space on the page from which they get moved  
forward.

Solution:
The formatter should be able to shrink float height up to an author- 
specified amount to keep the float on the page.

Case 1:
There's a photo floating near the bottom edge of the page. The width  
of the photo is set to a length. The height is determined by the  
intrinsic aspect ratio of the bitmap by height: auto;. The author is  
willing to let the formatter *crop* the image vertically by <length>  
delta_h where percentages refer to the normal height: auto; of the  
replaced element itself (not containing block!). If letting the height  
be auto would make the float move to the next page but reducing the  
height of the float by delta_h would keep the float on the same page,  
the formatter should crop the height as little as possible but just  
enough to keep it on the same page. The author should be able to  
specify if cropping happens from top, bottom or equally from both top  
and bottom of the replaced element.

Case 2:
There's a drawing floating near the bottom edge of the page. The width  
of the photo is set to a length. The height is determined by the  
intrinsic aspect ratio of the bitmap or of the SVG view port by  
height: auto;. The author is willing to let the formatter *scale* the  
image vertically by <length> delta_h where percentages refer to the  
normal height: auto; of the replaced element itself (not containing  
block!) *and* scale the width at the same time so that the aspect  
ratio is kept. If letting the height be auto would make the float move  
to the next page but reducing the height of the float by delta_h would  
keep the float on the same page, the formatter should scale the  
replaced element as little as possible but just enough to keep it on  
the same page.

I suggest adding features that address the two cases recounted above.  
(I've tried using CSS for typesetting book-like content for paged  
media twice. The first time I hit case 2 some time into the project.  
The second time I hit case 1 immediately.)

It seems to me that image-fit is close to this, but as far as I can  
tell, it doesn't support scaling of the box itself in case 2 and min- 
height doesn't appear to interact with the page edge as desired. Also,  
min-height percentages are relative to the wrong thing for the use case.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Monday, 22 December 2008 13:15:04 UTC