diff options
author | Ludovic Courtès | 2010-11-07 22:29:59 +0100 |
---|---|---|
committer | Ludovic Courtès | 2010-11-07 22:29:59 +0100 |
commit | c8c67b39bb0ee3147a1fcfef9716c79034c073df (patch) | |
tree | 6cab264dfc4479c852ea585f81cb738262a39a49 | |
parent | d06a6987fb7b425d35f39c9f3457e4540077929d (diff) | |
download | skribilo-c8c67b39bb0ee3147a1fcfef9716c79034c073df.tar.gz skribilo-c8c67b39bb0ee3147a1fcfef9716c79034c073df.tar.lz skribilo-c8c67b39bb0ee3147a1fcfef9716c79034c073df.zip |
lout: Improve handling of `(font :size N ...)'.
* src/guile/skribilo/engine/lout.scm (lout-font-size): Remove.
(lout-size-ratio): New procedure.
(font): Use it. Change both the font size and the inter-line gap
proportionally.
-rw-r--r-- | src/guile/skribilo/engine/lout.scm | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index d692358..d10dbcf 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -970,22 +970,13 @@ (string-append (number->string width) "p")))) ;*---------------------------------------------------------------------*/ -;* lout-font-size ... */ -;*---------------------------------------------------------------------*/ -(define (lout-font-size size) - (case size - ((4) "3.5f") - ((3) "2.0f") - ((2) "1.5f") - ((1) "1.2f") - ((0) "1.0f") - ((-1) "0.8f") - ((-2) "0.5f") - ((-3) "0.3f") - ((-4) "0.2f") - (else (if (number? size) - (if (< size 0) "0.3f" "1.5f") - "1.0f")))) +;* lout-size-ratio ... */ +;*---------------------------------------------------------------------*/ +(define (lout-size-ratio size) + ;; Return a font or break ratio for SIZE, an integer. If SIZE is zero, 1.0 + ;; is returned; if it's positive, then a ratio > 1 is returned; if it's + ;; negative, a ratio < 1 is returned. + (expt 1.2 size)) (define (lout-color-specification skribe-color) ;; Return a Lout color name, ie. a string which is either an English color @@ -1737,8 +1728,8 @@ (markup-writer 'font :options '(:size :face) :before (lambda (n e) - (let ((size (lout-font-size (markup-option n :size)))) - (format #t "\n~a @Font { " size))) + (let ((ratio (lout-size-ratio (markup-option n :size)))) + (format #t "\n~af @Font ~avx @Break { " ratio ratio))) :after (lambda (n e) (display " }\n"))) |