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: Christophe Pochon
Subject: Re: Au sujet de titres
Date: Fri, 24 Jan 2020 15:11:38 +0100

Là, on n'est pas loin de la solution :

%%%%%
#(define-markup-command (arcText layout props radius txt)
   (number? string?)
   (let* ((font-size 8)
          (pi (atan 0 -1))
          (txt-len (* (/ font-size 4)
           (cdr (ly:stencil-extent
                 (interpret-markup layout props txt) X))))
          (circle-len (* pi radius 2))
          (angle-rad (/ txt-len radius))
          (height (* radius (- 1 (cos (/ angle-rad 2)))))
          (width
                   (abs (* 2 radius (sin (/ angle-rad 2))))))
     (interpret-markup layout props
       (markup ;#:box
        #:with-dimensions
        (cons (* width -.5) (* width .5))
        (cons (* height -.5) (* height .5))
        #:raise (- radius) ; non!
 
        #: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
}
%%%%%%%5
Christophe Pochon



Le ven. 24 janv. 2020 à 14:33, Denis Bitouzé <address@hidden> a écrit :
Le 24/01/20 à 13h40, Christophe Pochon a écrit :

> En gros, il s'agit de calculer la hauteur et la largeur du titre, en
> fonction du texte du titre, du rayon du cercle

Quel cercle ?

> et de la taille de la police.

Un dessin pourrait aider.
--
Denis

reply via email to

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