[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: caps font shape not working
From: |
Nicolas Sceaux |
Subject: |
Re: caps font shape not working |
Date: |
Thu, 16 Mar 2006 00:00:21 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) |
Han-Wen Nienhuys <address@hidden> writes:
> Mats Bengtsson wrote:
>> Looks like a bug! I forward it to bug-lilypond.
>
> I fixed it on the Lily side, by adding 'caps shape to font.scm, but
> you also have to have a Small-caps font available to Pango.
>
> Probably the best option is to remove the reference caps from the
> documentation and/or reinstate Nicolas' Poor Man's Caps function
> again.
The following one should deal better with lower/upper case.
(define-markup-command (smallCaps layout props text) (markup?)
"Turn text, which should be a string, to small caps."
(define (make-small-caps-markup chars)
(cond ((null? chars)
(markup))
((char-whitespace? (car chars))
(markup #:fontsize -3 #:simple (string-upcase (list->string (cdr
chars)))))
(else
(markup #:hspace -1
#:fontsize -3 #:simple (string-upcase (list->string
chars))))))
(define (make-not-small-caps-markup chars)
(cond ((null? chars)
(markup))
((char-whitespace? (car chars))
(markup #:simple (list->string (cdr chars))))
(else
(markup #:hspace -1
#:simple (list->string chars)))))
(define (small-caps-aux done-markups current-chars rest-chars small?
after-space?)
(cond ((null? rest-chars)
;; the end of the string: build the markup
(make-line-markup (reverse! (cons ((if small?
make-small-caps-markup
make-not-small-caps-markup)
(reverse! current-chars))
done-markups))))
((char-whitespace? (car rest-chars))
;; a space char.
(small-caps-aux done-markups current-chars (cdr rest-chars) small?
#t))
((or (and small? (char-lower-case? (car rest-chars)))
(and (not small?) (not (char-lower-case? (car rest-chars)))))
;; same case
;; add the char to the current char list
(small-caps-aux done-markups
(cons (car rest-chars)
(if after-space?
(cons #\space current-chars)
current-chars))
(cdr rest-chars)
small?
#f))
(else
;; case change
;; make a markup with current chars, and start a new list with new
char
(small-caps-aux (cons ((if small?
make-small-caps-markup
make-not-small-caps-markup)
(reverse! current-chars))
done-markups)
(if after-space?
(list (car rest-chars) #\space)
(list (car rest-chars)))
(cdr rest-chars)
(not small?)
#f))))
(interpret-markup layout props (small-caps-aux (list)
(list)
(cons #\space (string->list
text))
#f
#f)))