Re: Allow left-handed fret-markups (issue 339270043 by thomasmorle...@gmail.com)
On 2018/01/23 09:55:04, dak wrote: mailto:thomasmorle...@gmail.com writes: > Yep, the difference between left- and right-handed are certain negative > instead of a positive values. > I'd love to use a multiplier retrieved from left-handed. > Though, how to code properly and user-friendly. > One could do > (1) separate conditions (that's what I've done). Disadvantage: code is > more complex. No multiplier. > (2) Let 'left-handed accept RIGHT/LEFT. Disadvantage is the need to > input it via an quasiquoted list > (3) Let 'left-handed accept -1/1. Disadvantage: it may be not that > obvious to the user what -1/1 actually means > (4) Let 'left-handed accept symbols left/right. Disadvantage: need to > transform these symbols into -1/1. > Something like (if (eq? left-handed 'left) -1 1) needs to be added. > (4) Drop 'left-handed and get the -1/1 from (sign string-distance) > > Opinions? We use enough properties of the LEFT/RIGHT kind ((2) and (3) are really the same option apart from examples/docs) that I don't see a reason to diverge here. A property 'handedness set to LEFT or RIGHT would be in that ballpark. Well, we would need to teach the user why \markup \override #'(fret-diagram-details . ((handedness . LEFT))) \fret-diagram #"6-x;5-3-3;4-2-2;3-o;2-1;1-o;" not works, without using proper quasiquote/unquote. That's why I listed (2) _and_ (3) Btw, I found only a single place where we use `(... ,RIGHT ) etc in the docs: http://lilypond.org/doc/v2.19/Documentation/notation/displaying-pitches#ottava-brackets Without explaining what ` and , actually means, though. https://codereview.appspot.com/339270043/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Allow left-handed fret-markups (issue 339270043 by thomasmorle...@gmail.com)
thomasmorle...@gmail.com writes: > Yep, the difference between left- and right-handed are certain negative > instead of a positive values. > I'd love to use a multiplier retrieved from left-handed. > Though, how to code properly and user-friendly. > One could do > (1) separate conditions (that's what I've done). Disadvantage: code is > more complex. No multiplier. > (2) Let 'left-handed accept RIGHT/LEFT. Disadvantage is the need to > input it via an quasiquoted list > (3) Let 'left-handed accept -1/1. Disadvantage: it may be not that > obvious to the user what -1/1 actually means > (4) Let 'left-handed accept symbols left/right. Disadvantage: need to > transform these symbols into -1/1. > Something like (if (eq? left-handed 'left) -1 1) needs to be added. > (4) Drop 'left-handed and get the -1/1 from (sign string-distance) > > Opinions? We use enough properties of the LEFT/RIGHT kind ((2) and (3) are really the same option apart from examples/docs) that I don't see a reason to diverge here. A property 'handedness set to LEFT or RIGHT would be in that ballpark. It's similar to text-direction. > https://codereview.appspot.com/339270043/ -- David Kastrup ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Allow left-handed fret-markups (issue 339270043 by thomasmorle...@gmail.com)
On 2018/01/22 23:52:29, Carl wrote: Looks good to me, but I have one suggestion. Thanks, Carl https://codereview.appspot.com/339270043/diff/1/scm/fret-diagrams.scm File scm/fret-diagrams.scm (right): https://codereview.appspot.com/339270043/diff/1/scm/fret-diagrams.scm#newcode365 scm/fret-diagrams.scm:365: ((and (eq? orientation 'landscape) left-handed) I would tend to write this as ((eq? orientation 'landscape) (cons fret-coordinate (if left-handed (- (1- string-count) string-coordinate) (- string-coordinate (1- string-count))) (eq? orientation 'opposing-landscape) (cons (- fret-coordinate) (if left-handed (- string-coordinate (1- string-count)) (- (1- string-count) string-coordinate))) (else (cons (if left-handed (- string-coordinate) string-coordinate) (- fret-coordinate) I think it shows the structure better (i.e. it shows three different orientations, and it explicitly shows where the left-handed changes things (y coordinate for landscape, x coordinate for regular). But I don't insist on this by any means. Yep, the difference between left- and right-handed are certain negative instead of a positive values. I'd love to use a multiplier retrieved from left-handed. Though, how to code properly and user-friendly. One could do (1) separate conditions (that's what I've done). Disadvantage: code is more complex. No multiplier. (2) Let 'left-handed accept RIGHT/LEFT. Disadvantage is the need to input it via an quasiquoted list (3) Let 'left-handed accept -1/1. Disadvantage: it may be not that obvious to the user what -1/1 actually means (4) Let 'left-handed accept symbols left/right. Disadvantage: need to transform these symbols into -1/1. Something like (if (eq? left-handed 'left) -1 1) needs to be added. (4) Drop 'left-handed and get the -1/1 from (sign string-distance) Opinions? https://codereview.appspot.com/339270043/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Re: Allow left-handed fret-markups (issue 339270043 by thomasmorle...@gmail.com)
Looks good to me, but I have one suggestion. Thanks, Carl https://codereview.appspot.com/339270043/diff/1/scm/fret-diagrams.scm File scm/fret-diagrams.scm (right): https://codereview.appspot.com/339270043/diff/1/scm/fret-diagrams.scm#newcode365 scm/fret-diagrams.scm:365: ((and (eq? orientation 'landscape) left-handed) I would tend to write this as ((eq? orientation 'landscape) (cons fret-coordinate (if left-handed (- (1- string-count) string-coordinate) (- string-coordinate (1- string-count))) (eq? orientation 'opposing-landscape) (cons (- fret-coordinate) (if left-handed (- string-coordinate (1- string-count)) (- (1- string-count) string-coordinate))) (else (cons (if left-handed (- string-coordinate) string-coordinate) (- fret-coordinate) I think it shows the structure better (i.e. it shows three different orientations, and it explicitly shows where the left-handed changes things (y coordinate for landscape, x coordinate for regular). But I don't insist on this by any means. https://codereview.appspot.com/339270043/ ___ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel
Allow left-handed fret-markups (issue 339270043 by thomasmorle...@gmail.com)
Reviewers: , Message: please review Description: Allow left-handed fret-markups By adding a new boolean subproperty: left-handed. - Extends Documentation/notation/fretted-strings.itely - Extends Documentation/changes.tely - Extenss scm/define-grob-properties.scm - Adds regtest input/regression/fret-diagrams-left-handed.ly - Disables the possibility to use negative string-distance Please review this at https://codereview.appspot.com/339270043/ Affected files (+84, -8 lines): M Documentation/changes.tely M Documentation/notation/fretted-strings.itely A input/regression/fret-diagrams-left-handed.ly M scm/define-grob-properties.scm M scm/fret-diagrams.scm Index: Documentation/changes.tely diff --git a/Documentation/changes.tely b/Documentation/changes.tely index 1a4fcc59e51b93cf5d7792a7ba6a135907c627f0..7f726381be7aa5bac00b211936fd3baff1494d6d 100644 --- a/Documentation/changes.tely +++ b/Documentation/changes.tely @@ -62,6 +62,19 @@ which scares away people. @end ignore @item +Fret-diagrams may now be printed left-handed, setting @code{left-handed} to +@code{#t} (as a subproperty of @code{fret-diagram-details}). +@lilypond[verbatim,quote] +\markup + \center-column { +"C" +"(left-handed)" + \override #'(fret-diagram-details . ((left-handed . #t))) + \fret-diagram "6-x;5-3-3;4-2-2;3-o;2-1;1-o;" + } +@end lilypond + +@item The @code{output-classic-framework} procedure and the @code{-dclip-systems} are now available with the @code{SVG} backend. Index: Documentation/notation/fretted-strings.itely diff --git a/Documentation/notation/fretted-strings.itely b/Documentation/notation/fretted-strings.itely index a93627a871894a848db2aedf1a58da5859889fcd..a57463376418fabb3e012f269d190f048b926067 100644 --- a/Documentation/notation/fretted-strings.itely +++ b/Documentation/notation/fretted-strings.itely @@ -930,6 +930,20 @@ markup string. >> @end lilypond +@cindex left-handed fret-diagrams + +Fret-diagrams may be printed left-handed + +@lilypond[verbatim,quote] +\markup + \center-column { +"C" +"(left-handed)" + \override #'(fret-diagram-details . ((left-handed . #t))) + \fret-diagram "6-x;5-3-3;4-2-2;3-o;2-1;1-o;" + } +@end lilypond + @cindex fret-diagram-terse markup @funindex \fret-diagram-terse Index: input/regression/fret-diagrams-left-handed.ly diff --git a/input/regression/fret-diagrams-left-handed.ly b/input/regression/fret-diagrams-left-handed.ly new file mode 100644 index ..fc92f7893fd1cf5a91a44cea8c88508bee22d3e7 --- /dev/null +++ b/input/regression/fret-diagrams-left-handed.ly @@ -0,0 +1,32 @@ +\header { +texidoc = " +Fret-diagrams may be printed left-handed +" +} + +\version "2.19.21" + +fretTst = { + %% C major for guitar + c'1 ^\markup { \fret-diagram "6-x;5-3-3;4-2-2;3-o;2-1;1-o;"} +} + +\new Voice { + \textLengthOn + \fretTst + \once \override TextScript.fret-diagram-details.left-handed = ##t + \fretTst + \bar "||" + \override TextScript.fret-diagram-details.orientation = +#'landscape + \fretTst + \once \override TextScript.fret-diagram-details.left-handed = ##t + \fretTst + \bar "||" + \override TextScript.fret-diagram-details.orientation = +#'opposing-landscape + \fretTst + \once \override TextScript.fret-diagram-details.left-handed = ##t + \fretTst + \bar "|." +} Index: scm/define-grob-properties.scm diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 0acc741f1cb93ad13ffa151b8fafc745df9037f0..4dcfa08f003e4c52ba8c28bdb65d4bd45258d9a5 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -398,6 +398,9 @@ Default@tie{}0.05. @w{@code{-1}}, @code{LEFT}, or @code{DOWN} for left or down; @code{1}, @code{RIGHT}, or @code{UP} for right or up. Default @code{RIGHT}. @item +@code{left-handed} -- Print the fret-diagram left- or right-handed. +Default @code{#f}. +@item @code{mute-string} -- Character string to be used to indicate muted string. Default @code{\"x\"}. @item Index: scm/fret-diagrams.scm diff --git a/scm/fret-diagrams.scm b/scm/fret-diagrams.scm index 6dda45292852bdc0937521eda8abb1286d343b91..085511c4c105087f1ff7ac15bf038906be337246 100644 --- a/scm/fret-diagrams.scm +++ b/scm/fret-diagrams.scm @@ -304,8 +304,12 @@ with magnification @var{mag} of the string @var{text}." (details (merge-details 'fret-diagram-details props '())) (fret-distance (assoc-get 'fret-distance details 1.0)) - (string-distance + (string-distance-from-details (assoc-get 'string-distance details 1.0)) + ;; disable negative `string-distance' + ;; mmh -- should we print a message/warning? + (string-distance (abs string-distance-from-details)) + (left-handed (assoc-get 'left-handed details #f)) (string-count (assoc-get 'string-count details 6)) ;; needed for everything (my-fret-count @@ -358,13