Autor Thema: Eigene Zeichen, die mit Fontsize skalieren ?  (Gelesen 2020 mal)

mgd

  • Member
Eigene Zeichen, die mit Fontsize skalieren ?
« am: Sonntag, 24. Mai 2015, 13:48 »
Hallo Forum !

Ich habe im LSR unter http://lsr.di.unimi.it/LSR/Item?id=891 ein snippet zum Zeichnen eigener Symbole gefunden. Das funktioniert soweit auch sehr schön. Jetzt würde ich ein solches Symbol gern mit \fontsize skalieren können. Im LSR habe ich unter http://lsr.di.unimi.it/LSR/Item?id=623 ein snippet gefunden, dass mir zeigt, wie man z.B. einen eigenen Schlüssel mit der Schriftgröße skaliert.

Wie würde ich das bei "freiem" Text machen, also z.B. hier:
\version "2.18.2"

vertLine =
\markup \stencil
#(make-connected-path-stencil
  '((0 2.1)  ;; path coordinates
    (0 -0.3))
  0.2  ;; line thickness
  1  ;; X-axis scaling factor
  1  ;; Y-axis scaling factor
;  0.75  ;; Y-axis scaling factor
  #f  ;; auto-connect path to origin point? (0 0)
  #f) % filled path?
vertSep = \markup { \hspace #0.5 \vertLine \hspace #0.5 }

\markup {
      \left-align \line { When the Lord turn'd again the cap- \vertSep tivity of \vertSep Sion : }
}
\markup {
      \left-align \fontsize #-2 \line { When the Lord turn'd again the cap- \vertSep tivity of \vertSep Sion : }
}
\markup {
      \left-align \fontsize #5 \line { When the Lord turn'd again the cap- \vertSep tivity of \vertSep Sion : }
}

Nur in der ersten der 3 Zeilen ist der vertikale Separator in der relativ korrekten Größe.

Frohe Pfingsten,
Michael

Pusteblumi

  • Member
Re: Eigene Zeichen, die mit Fontsize skalieren ?
« Antwort #1 am: Montag, 25. Mai 2015, 22:32 »
Hallo Michael,

die Frage kann ich leider auch nicht beantworten.
Aber wäre es interessant, einfach ein "|"-Zeichen mit veränderten Abmessungen zu verwenden?
z.B. so:

\version "2.18.2"

vertSep = \markup { \hspace #0.1 \scale #'(1.0 . 1.6) \lower #0.2 "|" \hspace #0.1 }

\markup {
      \left-align \line { When the Lord turn'd again the cap- \vertSep tivity of \vertSep Sion : }
}
\markup {
      \left-align \fontsize #-2 \line { When the Lord turn'd again the cap- \vertSep tivity of \vertSep Sion : }
}
\markup {
      \left-align \fontsize #5 \line { When the Lord turn'd again the cap- \vertSep tivity of \vertSep Sion : }
}

Viele Grüße,
Klaus

mgd

  • Member
Re: Eigene Zeichen, die mit Fontsize skalieren ?
« Antwort #2 am: Dienstag, 26. Mai 2015, 00:16 »
Excellenter Vorschlag !

Das löst zwar nicht den allgemeinen Fall, aber mein konkretes Problem wird so perfekt erledigt :)

Vielen Dank,
Michael

mgd

  • Member
Re: Eigene Zeichen, die mit Fontsize skalieren ?
« Antwort #3 am: Dienstag, 26. Mai 2015, 00:53 »
Leider ein klein wenig zu früh gefreut...das "\lower #0.2" wird nicht mit \fontsize mitskaliert. Das fällt deutlicher auf, je größer der Font ist.

Und ich habe noch ein weiteres Zeichen, dass im originalen Fall nicht vorhanden war, dass ich ebenfalls analog skalieren möchte. Hier das erweiterte Beispiel:
\version "2.18.2"

#(define-markup-command (underdot layout props arg)
  (markup?)
"Place a dot below @var{arg} using @code{\\center.column}"
    (interpret-markup layout props
      (markup #:override '(baseline-skip . 0.5) #:center-column (arg "."))))

vertLine =
\markup \stencil
#(make-connected-path-stencil
  '((0 2.1)  ;; path coordinates
    (0 -0.3))
  0.2  ;; line thickness
  1  ;; X-axis scaling factor
  1  ;; Y-axis scaling factor
;  0.75  ;; Y-axis scaling factor
  #f  ;; auto-connect path to origin point? (0 0)
  #f) % filled path?
vertSepalt = \markup { \hspace #0.5 \vertLine \hspace #0.5 }
vertSepneu = \markup { \scale #'(1.0 . 1.63) \lower #0.26 "|" }

vertLineDot =
\markup \stencil
#(make-connected-path-stencil
  '((0 2.1)  ;; path coordinates
    (0 0))
  0.2  ;; line thickness
  1  ;; X-axis scaling factor
  1  ;; Y-axis scaling factor
;  0.75  ;; Y-axis scaling factor
  #f  ;; auto-connect path to origin point? (0 0)
  #f) % filled path?
scaleVertLineDot =
#(lambda (grob)
    (let* ((sz (ly:grob-property grob 'font-size 0.0))
           (mult (magstep sz)))
        (set! (ly:grob-property grob 'stencil)
          (ly:stencil-scale
            vertLineDot
            mult mult))))
vertSepDotalt = \markup { \hspace #0.5 \combine \underdot \vertLineDot \hspace #1 }
vertSepDotneub = \markup { \scale #'(1.0 . 1.45) \lower #0.1 "|" }
% diese beiden Varianten mit Punkt funktionieren nicht
%vertSepDotneu = \markup { \combine \underdot \vertSepDotneub }
%vertSepDotneu = \markup { \scale #'(1.0 . 1.45) \lower #0.1 \combine \underdot "|" }

\markup {
      \left-align \line { the cap- \vertSepneu \vertSepalt \vertSepDotneub \vertSepDotalt tivity of \vertSepneu \vertSepalt \vertSepDotneub \vertSepDotalt Sion : }
}
\markup {
      \left-align \fontsize #-2 \line { the cap- \vertSepneu tivity of \vertSepneu Sion : }
}
\markup {
      \left-align \fontsize #5 \line { the cap- \vertSepneu tivity of \vertSepneu Sion : }
}
\markup {
      \left-align \fontsize #10 \line { the cap- \vertSepneu tivity of \vertSepneu Sion : }
}

Andere Ideen ?

Liebe Grüße,
Michael
« Letzte Änderung: Dienstag, 26. Mai 2015, 00:56 von mgd »

Pusteblumi

  • Member
Re: Eigene Zeichen, die mit Fontsize skalieren ?
« Antwort #4 am: Dienstag, 26. Mai 2015, 01:55 »
Hmmm... stimmt. Dann vielleicht so?

\version "2.18.2"

vertSep = \markup { \hspace #0.1 \general-align #Y #-0.6 \scale #'(1.0 . 1.6) "|" \hspace #0.1 }
vertSepDot = \markup {
  \hspace #0.1
  \general-align #Y #-0.6
  \center-column {
    \scale #'(1.0 . 1.3) "|"
    \translate-scaled #'(0 . 2.5)
    "."
  }
  \hspace #0.1
}

\markup {
  \left-align \fontsize #-10 \line { When the Lord turn'd again the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \fontsize #-5 \line { When the Lord turn'd again the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \line { When the Lord turn'd again the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \fontsize #5 \line { When the Lord turn'd again the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \fontsize #10 \line { the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \fontsize #15 \line { the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}

Viele Grüße,
Klaus

mgd

  • Member
Re: Eigene Zeichen, die mit Fontsize skalieren ?
« Antwort #5 am: Dienstag, 26. Mai 2015, 09:43 »
Wunderbar, das sieht ganz danach aus, als ob es alle Anforderungen erfüllt :)

Ich habe noch ein wenig mit den Parametern gespielt und sie so angepasst, dass sie für mein Auge "richtig" erscheinen. Der Vollständigkeit halber folgt hier nun meine finale Anpassung. Im Beispiel sind dann alte und neue Version nebeneinander, damit sie besser vergleichbar sind.

\version "2.18.2"

#(define-markup-command (underdot layout props arg)
  (markup?)
"Place a dot below @var{arg} using @code{\\center.column}"
    (interpret-markup layout props
      (markup #:override '(baseline-skip . 0.5) #:center-column (arg "."))))

vertLine =
\markup \stencil
#(make-connected-path-stencil
  '((0 2.1)  ;; path coordinates
    (0 -0.3))
  0.2  ;; line thickness
  1  ;; X-axis scaling factor
  1  ;; Y-axis scaling factor
;  0.75  ;; Y-axis scaling factor
  #f  ;; auto-connect path to origin point? (0 0)
  #f) % filled path?
vertSepalt = \markup { \hspace #0.5 \vertLine \hspace #0.5 }

vertLineDot =
\markup \stencil
#(make-connected-path-stencil
  '((0 2.1)  ;; path coordinates
    (0 0))
  0.2  ;; line thickness
  1  ;; X-axis scaling factor
  1  ;; Y-axis scaling factor
;  0.75  ;; Y-axis scaling factor
  #f  ;; auto-connect path to origin point? (0 0)
  #f) % filled path?
vertSepDotalt = \markup { \hspace #0.5 \combine \underdot \vertLineDot \hspace #1 }

vertSep = \markup { \general-align #Y #-0.7 \scale #'(1.0 . 1.615) "|" }
vertSepDot = \markup {
  \general-align #Y #-0.6
  \center-column {
    \scale #'(1.0 . 1.44) "|"
    \translate-scaled #'(0 . 2.6)
    "."
  }
}

\markup {
  \left-align \fontsize #-10 \line { When the Lord turn'd again the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \fontsize #-5 \line { When the Lord turn'd again the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
      \left-align \line { the cap- \vertSepalt \vertSep \vertSepDot \vertSepDotalt tivity of \vertSepalt \vertSep \vertSepDot \vertSepDotalt Sion : }
}
\markup {
      \left-align \fontsize #5 \line { the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \fontsize #10 \line { the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}
\markup {
  \left-align \fontsize #15 \line { the cap- \vertSep \vertSepDot tivity of \vertSep Sion : }
}

Vielen Dank für deine Mühe,
Michael