]> git.donarmstrong.com Git - lilypond.git/commitdiff
Markup commands: define \abs-fontsize command
authorNicolas Sceaux <nicolas.sceaux@free.fr>
Sat, 28 Jun 2008 16:35:05 +0000 (18:35 +0200)
committerNicolas Sceaux <nicolas.sceaux@free.fr>
Sat, 28 Jun 2008 16:35:05 +0000 (18:35 +0200)
scm/define-markup-commands.scm

index 01709380776fd5b911ef8559afc07f14ff470c26..4abfbc311fed3efae95ea90749d90431dfd36321 100644 (file)
@@ -1420,6 +1420,31 @@ any sort of property supported by @rinternals{font-interface} and
                     (cons '((font-size . -5) (font-encoding . fetaNumber)) props)
                     arg))
 
+(define-builtin-markup-command (abs-fontsize layout props size arg)
+  (number? markup?)
+  font
+  ((word-space 1)
+   (baseline-skip 2))
+  "Use @var{size} as the absolute font size to display @var{arg}.
+Adjust baseline skip and word space accordingly.
+@lilypond[verbatim,quote]
+\\markup {
+  default text font size
+  \\hspace #2
+  \\abs-fontsize #16 { text font size 16 }
+  \\hspace #2
+  \\abs-fontsize #12 { text font size 12 }
+}
+@end lilypond"
+  (let* ((ref-size (ly:output-def-lookup layout 'text-font-size 12))
+        (magnification (/ size ref-size)))
+    (interpret-markup layout
+                     (cons `((baseline-skip . ,(* magnification baseline-skip))
+                             (word-space . ,(* magnification word-space))
+                             (font-size . ,(magnification->font-size magnification)))
+                           props)
+                     arg)))
+
 (define-builtin-markup-command (fontsize layout props increment arg)
   (number? markup?)
   font