OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Graphic scaling in HTML Help (was: Graphic scaling, yet again)


This post is informational only.

On Thu, May 05, 2005 at 01:53:34PM +0930, Paul A. Hoadley wrote:

> I have a particular project where the primary output has been PDF
> for some time, but where I now need to generate HTML Help.  There
> are a lot of images in figures, some large and some small.  My aim
> has been to leave images that fit in the available space as they
> are, and to scale down images that are too large.

With the recent changes to fo/graphics.xsl, the following attributes
on 'imagedata' achieve this:


I figured that the easiest way to achieve this for HTML Help would be
to set 'ignore.image.scaling', and work with CSS.  This would allow me
to have a single 'imagedata' element for both PDF and HTML Help.

The CSS property that pretty much precisely mirrors the semantics of
the FO generated above would be:

  max-width: 100%;

Indeed, as tested in Firefox, this produces the same effect with a
single difference: the browser can be re-sized but the PDF page can't.
Because of this, I decided to set an arbitrary limit of something like
400px, since scaling a full-screen screenshot lower than this starts
to lose too much information:

  max-width: 400px;

However, IE, and hence the HTML Help browser, doesn't support the
'max-width' property.  To my astonishment, what it does support is
Javascript fragments in CSS.  (Do all browsers do this?  I don't
know.)  The following property (on the appropriate image elements)
achieves the same result:

  width: expression(Math.min(parseInt(this.offsetWidth), 400) + 'px');

That is, fix the width of the content (the screenshots) at the minimum
of their intrinsic width and 400px.

The good news is that the CSS for HTML Help can obviously be targetted
at a single browser: IE.  There's no need to try and support this kind
of weird workaround and more conventional approaches for other
browsers at the same time.


w  http://logicsquad.net/
h  http://paul.hoadley.name/

PGP signature

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]