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] | [Elist Home]


Subject: Re: DOCBOOK-APPS: Problem converting DB to PDF...


On Tue, Feb 20, 2001 at 04:04:27AM -0500, Adam Di Carlo wrote:
> I have an unreleased but I think pretty decent system, 'preheat'.
> This is a scheme-based system.  You specify a little scheme file with
> the local stuff to build and customization, for instance:

Oh God.  Just as soon as I think I've cleared some free time, something
new and interesting comes along.

:-)

We should really try and get together at some point and go through this
stuff in more detail.  I get the feeling there are several groups all
working towards similar goals, and there are just too many mailing lists
to keep track of.

> Anyhow, Nik, your system looks good -- good enough to go through and
> cull ideas from.

There's one change I had to make to the description I posted.  In
FreeBSD you now (or will have to very shortly, when I commit it) write
something like

    <imagedata fileref="figure1" format="PNG">

or '... format="EPS"', depending on the *source* format of the image.
You still only have one ImageData element per image, but you have to
specify the format.

Why?

I discovered that if I convert PNG images to EPS files and then run them
through TeX they appear about twice the size they should do.  For
example, an 80x24 xterm takes up almost half the page.

Scaling the images works, but then you have a problem.

                                     Image Format

  Output Format           PNG                           EPS

  HTML              Native format, looks OK       Is converted to PNG
                                                  using png2eps, looks
						  OK

  Postscript        Is converted to EPS, 
                    needs scaling by 50%          Native format, looks OK

  PDF               Native format, needs
                    scaling by 50%                Is converted to PDF, 
		                                  looks OK

The PNG images are the problem.  You need to scale them in the
Postscript and PDF case.  You can do this in one of two ways:

1.  Write 

      <imagedata fileref="figure1" scale="50">

    in your document.  The problem with this is HTML images will be
    scaled, and so will the EPS and PDF images.  So then you have to
    create all your EPS images twice the size they need to be, *and* 
    scale them all by 50% when you convert EPS to PNG.

    Unacceptable.

2.  Update the stylesheet to scale all images by 50% if the scale
    attribute is not set.  Less work for the author, but has the other
    problems that (1) has.

Neither of these are acceptable.

So, my third solution was to mandate the use of the 'format' attribute.
But we use to specify what the original image format was.  So if you
have a PNG image, you write

    <imagedata filereg="figure1" format="PNG">

Then redefine the Graphic handling in the stylesheet, like so;

    (define ($graphic$ fileref
                       #!optional (display #f) (format #f)
                                  (scale #f)   (align #f))
      (let* ((graphic-format (if format format ""))
             (graphic-scale  (if scale
                                 (/  (string->number scale) 100)
                                 (if (and tex-backend
                                          (equal? graphic-format "PNG"))
                                      0.5 1)))
             (graphic-align  (cond ((equal? align (normalize "center"))
                                    'center)
                                   ((equal? align (normalize "right"))
                                    'end)
                                   (else
                                    'start))))
       (make external-graphic
          entity-system-id: (graphic-file fileref)
          notation-system-id: graphic-format
          scale: graphic-scale
          display?: display
          display-alignment: graphic-align)))

which automatically scales the image by 50% if the following holds

  1.  The author didn't specify a "scale" attribute themselves.

  2.  tex-backend is #t

  3.  The "format" attribute is "PNG"

A kludge, but it works.

> > I fetched the above mentioned FreeBSD Makefiles and adapted them 
> > especially to Debian/GNU Linux (pathnames, etc.). Up to now there is no 
> > additional documentation except the .mk files itself - and the original 
> > posting of Nik of course! 
> > 
> > You will find a tarball at: http://www.miwie.org/docbkmake/
> > 
> > Feedback is welcome :-)
> 
> FYI, freebsd.dsl is already shipped on debian systems, in the
> docbook-stylesheets package.

Ah, I didn't know that.

What's the best way to make sure that you guys are informed when changes
are committed?

N
-- 
Internet connection, $19.95 a month.  Computer, $799.95.  Modem, $149.95.
Telephone line, $24.95 a month.  Software, free.  USENET transmission,
hundreds if not thousands of dollars.  Thinking before posting, priceless.
Somethings in life you can't buy.  For everything else, there's MasterCard.
  -- Graham Reed, in the Scary Devil Monastery


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


Powered by eList eXpress LLC