font spezifizieren

Begonnen von erich, Montag, 12. März 2018, 08:44

« vorheriges - nächstes »

erich

Hallo allen

Ich möchte in dem Script

\version "2.19.61"

#(define ((make-custom-dot-bar-line dot-positions) grob extent)
  (display-scheme-music (ly:grob-default-font grob))
   "Draw dots (repeat sign dots) at @var{dot-positions}. The
coordinates of @var{dot-positions} are equivalent to the
coordinates of @code{StaffSymbol.line-positions}, a dot-position
of X and a line-position of X indicate the same vertical position."
   (let* ((staff-space '1.3)
          (dot (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot"))
          (stencil empty-stencil))
     
     (for-each
      (lambda (dp)
        (set! stencil (ly:stencil-add stencil
                        (ly:stencil-translate-axis dot (* dp (/ staff-space 2)) Y))))
      dot-positions)
     stencil))

#(add-bar-glyph-print-procedure ":" (make-custom-dot-bar-line '(-3 3)))

\new Staff \with {
  \override StaffSymbol.line-positions = #'(-4 -2 2 4)
  \override StaffSymbol.staff-space = #1.3 }
  { g'1   \bar ":|." }

in der Zeile
(dot (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot"))
die Anweisung
(ly:grob-default-font grob)
durch "emmentaler-20" ersetzen.

Wie mache ich das genau?

Die display-Anweisung liefert #<Font_metric ("emmentaler-20" . 0.569055118110236)>

aber einfach ("emmentaler-20" . 0.569055118110236) einsetzen funktioniert nicht.

Edit 13.3.07:25: auch verstehe ich die Konstruktion von
#(define ((make-custom-dot-bar-line dot-positions) grob extent)
nicht insbesondere die "((" nach define

Gruß
Erich

P.S. Oh, das steht am falschen Ort, sorry! kann man das einfach verschieben?

harm6

#1
Hallo Erich,

was möchtest Du genau und warum, daß
(1) immer emmentaler genommen wird
oder daß
(2) immer emmentaler einer bestimmten Größe genommen wird
?

(1) kann man einrichten. Zumindest insoweit, als daß immer der font genommen wird, der im \paper spezifiziert ist.
(2) fände ich seltsam.

Aber ich bin kein font-Experte (so gar nicht...). Vielleicht antwortet noch jemand mit mehr Kenntnissen auf diesem Gebiet.

Gruß,
  Harm

erich

#2
Hallo Harm,

als Erklärung finde ich
Zitat
Function: ly:grob-default-font grob

    Return the default font for grob grob.
und
Zitat
Function: ly:font-get-glyph font name

    Return a stencil from font for the glyph named name. If the glyph is not available, return an empty stencil.

    Note that this command can only be used to access glyphs from fonts loaded with ly:system-font-load; currently, this means either the Emmentaler or Emmentaler-Brace fonts, corresponding to the font encodings fetaMusic and fetaBraces, respectively.

Ich habe den Abstand der Notenlinien verkleinert und möchte
nun dazu passend einfach genau zwei Doppelpunkte vor dem Wiederholungszeichen ausgeben.

Gruß
Erich


erich

Hallo allen,

ich hab's geschaft:

\version "2.19.61"

#(define (make-custom-dot-bar-line grob extent)

   (let* ((dot (ly:font-get-glyph (ly:grob-default-font grob) "dots.dot"))
          (stencil empty-stencil))
     (for-each
      (lambda (dp)
        (set! stencil (ly:stencil-add stencil
                        (ly:stencil-translate-axis dot (* dp 0.65) Y))))
      '(-3 1))
     stencil))

#(add-bar-glyph-print-procedure ":" make-custom-dot-bar-line)

\new Staff \with {
  \override StaffSymbol.line-positions = #'(-4 -2 2 4)
  \override StaffSymbol.staff-space = #1.3 }
  {g'1 \bar ":|."}


Ich muss nun nur die Liste '(-3 1) korrigieren, wenn die Punkte an anderer Stelle erscheinen sollen.

Gruß
Erich