Re: (dsssl) Vertical centering

Subject: Re: (dsssl) Vertical centering
From: Dan Richter <daniel.richter@xxxxxxxxx>
Date: Tue, 29 Apr 2003 09:54:06 +0200

I haven't found a single reference about how to vertically center a
flow object!

I don't know of any way to vertically center, but you can accomplish something similar with space-before and/or space-after. Set it to about the height of the page. You might even be able to work out something cute like (/ (- %page-height% (*your-font-size*)) 2). This won't account for mult-line titles, but I should think that approximate centering would be sufficient.


Just for fun, here are some excerpts from my titlepage generating code. Note that I had to define the meaning of "white". More importantly, I use "invisible text" to ensure spacing because simply using space-before on the first element of the titlepage doesn't accomplish what I want. Maybe someone else on the list can tell me why.

(define (My-Titlepage-Element node side)
  (if (equal? side 'recto)
      (with-mode My-Titlepage-Recto-Mode
        (process-node-list node))
      (with-mode My-Titlepage-Verso-Mode
        (process-node-list node))))

(mode My-Titlepage-Recto-Mode
  (element title
    (make paragraph
      (make paragraph     ;; This paragraph has no content.
        space-after: 6cm  ;; It's just for spacing.
        color: white      ;; White = invisible.
        (literal "."))
      (make paragraph
        font-size: 20pt
        font-weight: 'bold
        font-family-name: %title-font-family% ;; Defined in dbparam.dsl
        quadding: 'center
        space-after: 4cm
        (process-children))))
  (element subtitle
     ;; Other stuff here.
  ))

(mode Wimba-Titlepage-Verso-Mode
  ;; ...
  )

========== Dan Richter ============== mailto:Dan@xxxxxxxxx ===========
 This may sound a little foreign to all you folks coming from a
 non-Unix background, but PHP doesn't cost anything. You can use it
 for commercial and/or non-commercial use all you want. You can give
 it to your friends, print it out and hang it on your wall or eat it
 for lunch. Welcome to the world of Open Source software! Smile, be
 happy, the world is good.
     - Quoted from http://www.php.net


DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist


Current Thread