lilypond-devel
[Top][All Lists]
Advanced

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

Re: Issue 5324: \abs-fontsize and set-global-staff-size in books (issue


From: torsten . haemmerle
Subject: Re: Issue 5324: \abs-fontsize and set-global-staff-size in books (issue 341450043 by address@hidden)
Date: Mon, 13 Aug 2018 05:58:34 -0700

Reviewers: dak,

Message:
On 2018/08/13 12:17:29, dak wrote:
Does not help with the other problems we had with fontsize mismatches
(out of
multiple calls of set-global-staff-size), right?

What would a correct solution look like?

Hmmm, what were the other fontsize mismatch problems?

The *only* problem this solves is a "successful" try_retrieve that
delivers the wrong (outdated) scale_ factor after
#(set-global-staff-size …).

The other solution I proposed (checking output_scale each time a font is
retrieved from the buffer and eventually re-calculating the scale_
value) would be safer in so far as it ensures the correct scale_ factor
no matter how or why output_scale has changed (not just by
set-global-staff-size).
Would that be of any help? I could provide an alternative patch here.

It'd be good to check the "other fontsize mismatch problems", too, in
any case.

Thanks,
Torsten


Description:
Issue 5324: \abs-fontsize and set-global-staff-size in books

The font buffering hashtable will provide an outdated LilyPond
scale factor after changing global staff size between books. Mainly
\abs-fontsize concerned, because \fontsize will usually not match
a Pango font-size used in a differently scaled book and fresh fonts
will have to be loaded anyway.

The straight-forward solution is to simply apply #ly:restet-all-fonts
from within #set-global-staff-size.

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

Affected files (+35, -0 lines):
  A input/regression/book-change-global-staffsize-abs-fonts.ly
  M scm/paper.scm


Index: input/regression/book-change-global-staffsize-abs-fonts.ly
diff --git a/input/regression/book-change-global-staffsize-abs-fonts.ly b/input/regression/book-change-global-staffsize-abs-fonts.ly
new file mode 100644
index 0000000000000000000000000000000000000000..888b71f4fe96c8f2171b62bf08359bac46f98ecb
--- /dev/null
+++ b/input/regression/book-change-global-staffsize-abs-fonts.ly
@@ -0,0 +1,34 @@
+\version "2.21.0"
+
+\header {
+  texidoc = "Changing @code{global-staff-size} between consecutive
+             @code{\\book}s must not impair font spacing.
+             @code{\\abs-fontsize}.
+             The following output shows a 10pt book after a standard
+             20pt book:"
+}
+\paper { indent = 0 left-margin = 10 line-width = 75 }
+\header {
+  title = \markup \abs-fontsize #10 "Changing global staff size"
+  subtitle = \markup \abs-fontsize #10 "from 20pt to 10pt in the 2nd book"
+  tagline = ##f
+}
+testMusic = {
+  c'4_\markup \abs-fontsize #10 "\abs-fontsize #10 text"
+     _\markup \abs-fontsize #10 \line { "\abs-fontsize #10
+                                        \dynamic" \dynamic "fff" }
+     ^\markup \fontsize #0 "\fontsize #0"
+     ^\markup \fontsize #6 "\fontsize #6"
+  d' e' f'
+}
+
+
+#(set-global-staff-size 20)
+#(define output-suffix "1")
+\book { \score { \testMusic } }
+
+% This book will be shown in the regression tests/collated files:
+#(set-global-staff-size 10)
+#(define output-suffix #f)
+\book { \score { \testMusic } }
+
Index: scm/paper.scm
diff --git a/scm/paper.scm b/scm/paper.scm
index 23ec05a70f25715225123160ae71a352d41d6140..029e9c401f6be2da18c0c6ba56a35acb54d04457 100644
--- a/scm/paper.scm
+++ b/scm/paper.scm
@@ -120,6 +120,7 @@
     (if in-layout?
         (ly:warning (_ "set-global-staff-size: not in toplevel scope")))

+    (ly:reset-all-fonts)
     (layout-set-absolute-staff-size-in-module new-scope
                                               (* sz (eval 'pt new-scope)))
     (module-define! current-mod '$defaultpaper new-paper)))



reply via email to

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