Hi Kieren,

> One quick (?) question: Can you think of a way to make lyrics follow the 
curve,
> rather than each word being on a rigid flat baseline? (With small syllables,
> it’s fine of course, but longer syllables like “round” highlight what I 
mean.)

Actually thought about that one. The problem is that Lilypond does not offer 
much control over the font rendering engine behind it. Doing this essentially 
requires us to manage font rendering ourselves.

Now, if we were to limit ourselves to the svg backend this is actually really 
nicely possible: SVG allows for rendering text along paths using the textPath 
tag.

But with postscript backend we’d need to handle all aspects of font rendering 
ourselves, including letter spacing, kerning, ligatures, ...

Now we could try to e.g. first split a word into atomic glyphs (single letters 
and ligatures). Then we could extract letter metrics and kerning from rendering 
single atoms and pairs of atoms. This then allows us to render a word as a 
cloud of single atomic glyphs, which can be transformed individually. E.g. 
this

%%%
#(define (cumsum carry x . rest)
   (if (null? rest)
       (list (+ carry x))
       (cons (+ carry x) (apply cumsum (+ carry x) rest))))

#(define-markup-command (render-atoms layout props atoms)
   (markup-list?)
   (let* ((atom-stcs (interpret-markup-list layout props atoms))
          (pair-mups (map make-concat-markup (map list atoms (cdr atoms))))
          (pair-stcs (map (lambda (m) (interpret-markup layout props m)) pair-
mups))
          (atom-widths (map (lambda (s) (interval-length (ly:stencil-extent s 
X))) atom-stcs))
          (pair-widths (map (lambda (s) (interval-length (ly:stencil-extent s 
X))) pair-stcs))
          (kerned-widths (map - pair-widths (cdr atom-widths)))
          (offsets (apply cumsum 0 (cons 0 kerned-widths)))
          (translated-stcs (map (lambda (s o) (ly:stencil-translate-axis s o 
X)) atom-stcs offsets))
          (boxed-stcs (map (lambda (s) (box-stencil s 0.02 0)) translated-
stcs)))
     (apply ly:stencil-add boxed-stcs)))

\markup \render-atoms { a b c fi g h }
%%%

implements a short markup function that does just that (except for determining 
if a pair of letters is a ligature), which I don’t know how to handle 
consistently. Maybe just ignore ligatures and build everything with font-
features "-liga".

But this could then be turned into a sting-transformer, affecting all markup 
strings in the document. Then the system transformer can actually transform 
the placement of each single atomic glyph.

The attached version does that.

Kind of a problem though is that the circular staff setting is not quite 
optimal 
for concurrent stuff: Here the outer staves will have much more space than the 
inner. Since here the Lyrics spacing assumes the same scale for all staves the 
Lyric placements get’s a bit weird for the outer Lyrics.

Cheers,
Tina

> I assume each glyph would have to be independently rotated a small amount, 
so I
> have no idea if it’s even technically possible… but I’ve learned never to
> assume that something is beyond the ability of Lilypond (and its true Jedi
> Masters, like you and Jean).
> 
> That’s the last tweak that I think would make this code truly jaw-dropping.
> 
> Cheers,
> Kieren.
> __________________________________________________
> 
> My work day may look different than your work day. Please do not feel 
obligated
> to read or respond to this email outside of your normal working hours.

Attachment: circular4.pdf
Description: Adobe PDF document

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to