Deutsches Lilypond Forum (Archiv)

Allgemein => Fragen zu Funktionen => Thema gestartet von: Manuela am Montag, 13. April 2015, 10:22

Titel: Kreis mit Text und definiertem Durchmesser - geht das?
Beitrag von: Manuela am Montag, 13. April 2015, 10:22
Hi an alle,

ich weiß, Lilypond ist eigentlich nicht dafür gedacht  ;).

Ich kann Kreise mit Text drinnen zeichnen und angeben, wie viel Abstand zwischen Text und Kreislinie sein soll, d.h. die Größe des Kreises variiert je nach Textlänge.
\markup {
  \circle {
    Hi
  }
}
Ich kann Kreise ohne Text zeichnen und den Durchmesser angeben.
\markup {
  \draw-circle #2 #0.5 ##f
  \hspace #2
  \draw-circle #2 #0 ##t
}
Was ich nicht kann ist Kreise mit definiertem Durchmesser und Text drin zeichnen. Oder geht das doch?
Titel: Re: Kreis mit Text und definiertem Durchmesser - geht das?
Beitrag von: kilgore am Montag, 13. April 2015, 19:27
nicht besonders elegant aber so geht es auch recht schnell:

{ c'^\markup \override #'(thickness . 4 ) \circle { \pad-around #1 Hi }
  c'^\markup \circle { \pad-around #2 Hi }
}

oder mit \combine und etwas einstellen:

{ c'^\markup  {
  \combine \center-align
  \translate #'( 0 . -.75 ) "Hi"
  \draw-circle #2 #0.5 ##f
} }
Titel: Re: Kreis mit Text und definiertem Durchmesser - geht das?
Beitrag von: RobUr am Dienstag, 14. April 2015, 01:38
Hallo Manuela,

ich empfehle folgende Lösung aus unserem kreativen Forum: Studierzeichen : Kombination 2 (https://liarchiv.joonet.de/index.php?topic=1279.msg7040#msg7040)

Gruß, Robert
Titel: Re: Kreis mit Text und definiertem Durchmesser - geht das?
Beitrag von: harm6 am Dienstag, 14. April 2015, 01:39
Hallo,

schau mal, ob Du mit folgendem klar kommst.

\version "2.19.17"

#(define-markup-command (combine-xy-centered layout props args)
  (markup-list?)
  #:properties ((last-arg-at-baseline? #f))
  (let* ((stils (map (lambda (arg) (interpret-markup layout props arg)) args))
         (last-stil (if (not (null? args))
                        (interpret-markup layout props (last args))
                        #f))
         (last-y-ext (if last-stil
                         (ly:stencil-extent last-stil Y)
                         '(0 . 0))))
                     
    (ly:stencil-translate-axis
      (apply ly:stencil-add
        (map
          centered-stencil
          (map (lambda (arg) (interpret-markup layout props arg)) args)))
      (if last-arg-at-baseline?
          (/ (- (interval-length last-y-ext)
                (/ (ly:output-def-lookup layout 'blot-diameter) 2))
             2)
          0)
      Y)))


\markup {
  "some text"
  \combine-xy-centered {
    \draw-circle #2 #0.1 ##f
    \draw-circle #1.7 #0.1 ##f
    \draw-circle #1.4 #0.1 ##f
    \draw-circle #1.1 #0.1 ##f
    \draw-circle #0.8 #0.1 ##f
    \draw-circle #0.5 #0.1 ##f
    \draw-circle #0.2 #0.1 ##f
    \bold \with-color #red "Hi"
  }
  "some text"
}

\markup {
  "some text"
  \override #'(last-arg-at-baseline? . #t)
  \combine-xy-centered {
    \draw-circle #2 #0.1 ##f
    \draw-circle #1.7 #0.1 ##f
    \draw-circle #1.4 #0.1 ##f
    \draw-circle #1.1 #0.1 ##f
    \draw-circle #0.8 #0.1 ##f
    \draw-circle #0.5 #0.1 ##f
    \draw-circle #0.2 #0.1 ##f
    \bold \with-color #red "Hi"
  }
  "some text"
}


Bin momentan zu müde für weitere Erklärungen.
Falls Du Fragen hast - - morgen ;)

Gruß,
  Harm
Titel: Re: Kreis mit Text und definiertem Durchmesser - geht das?
Beitrag von: Manuela am Dienstag, 14. April 2015, 10:47
Danke für eure Antworten. Ich melde mich wieder, sobald ich mich mit euren Vorschlägen und Lösungen beschäftigt habe, das wird aber wahrscheinlich bis zum WE dauern.