lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

output-svg.scm: better defaults for font-family (issue 290850043 by addr


From: paulwmorris
Subject: output-svg.scm: better defaults for font-family (issue 290850043 by address@hidden)
Date: Fri, 19 Feb 2016 03:34:28 +0000

Reviewers: ,

Message:
Please review. See the discussion in this thread on the bug list:

http://lists.gnu.org/archive/html/bug-lilypond/2016-02/msg00079.html

Thanks,
-Paul

Description:
output-svg.scm: better defaults for font-family

if the user has not set the font, use a
meaningful svg default ('serif' 'sans-serif'
or 'monospace') for the font-family property

Please review this at https://codereview.appspot.com/290850043/

Affected files (+7, -2 lines):
  M scm/output-svg.scm


Index: scm/output-svg.scm
diff --git a/scm/output-svg.scm b/scm/output-svg.scm
index ca086318d7810d1f4769d59e6d2e88d4fc28668d..2f2ab1ff2395cf92977f0bde24903a6c3ecbfa32 100644
--- a/scm/output-svg.scm
+++ b/scm/output-svg.scm
@@ -132,8 +132,13 @@
          (match (if match-1 match-1 match-2)))

     (if (regexp-match? match)
-        (begin
-          (set-attribute 'font-family (match:prefix match))
+        ;; use meaningful svg defaults if font has not been set by user
+        (let ((font-fam (match:prefix match))
+              (lookup '(("LilyPond Serif" . "serif")
+                        ("LilyPond Sans Serif" . "sans-serif")
+                        ("LilyPond Monospace" . "monospace"))))
+          (set-attribute 'font-family (or (assoc-ref lookup font-fam)
+                                          font-fam))
           (if (string? (match:substring match 1))
               (set-attribute 'font-weight "bold"))
           (if (string? (match:substring match 2))





reply via email to

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