lilypond-user-fr
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Au sujet de titres


From: Valentin Villenave
Subject: Re: Au sujet de titres
Date: Fri, 24 Jan 2020 10:27:29 +0000

On 1/24/20, Christophe Pochon <address@hidden> wrote:
> Et là j'ai réussi à supprimer la distance entre le titre et la musique :

Pas mal ; de mon côté j’ai essayé de rendre tout ça plus flexible,
mais je rame pour arriver à calculer une hauteur satisfaisante. Si
quelqu’un qui s’y connait mieux en trigonométrie peut se pencher sur
la question…

%%%%%

\version "2.19.20"

#(define-markup-command (arcText layout props radius txt)
   (number? string?)
   (let* ((font-size 4)
          (pi (atan 0 -1))
          (txt-len
           (cdr (ly:stencil-extent
                 (interpret-markup layout props txt) X)))
          (circle-len (* pi radius 2))
          (angle-rad (/ circle-len (/ txt-len 2)))
          (height (+ font-size (* radius (- 1 (cos angle-rad)))))
          (width (+ (* 2 font-size)
                   (abs (* 2 radius (sin angle-rad))))))
     (interpret-markup layout props
       (markup ; #:box
        #:with-dimensions
        (cons (* width -.5) (* width .5))
        (cons (* height -.5) (* height .5))
        #:raise (- radius) ; non!
        #:raise (* height .5) ; nooon!!
        #:raise (- font-size) ; naoooon!!!!
        #:postscript
        (format #f "
/r ~a def
/ch 1 string def
/Times findfont
~a scalefont
setfont
/text (~a) def
/depar text stringwidth pop 90 mul ~a div
r div def
depar rotate
text {
  ch 0 3 2 roll put
  /l ch stringwidth pop def
  /dec l r atan 2 div neg def
  0 0 moveto dec rotate l neg 2 div r rmoveto
  ch show dec rotate
} forall
" radius  font-size txt pi)))))

\header {
  title = \markup \arcText #20 "petit texte"
 % title = \markup \arcText #40 "long long long long long texte"
 % title = \markup \arcText #10 "long long long long long texte"
}
\relative c'' {
  c1
}

%%%

V.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]