This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[docbook-apps] Graphic scaling in HTML Help (was: Graphic scaling, yet again)


Hello,

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:

  scalefit="1"
  width="100%"
  contentdepth="100%"

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.


-- 
Paul.

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

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]