[Issue #3947] fixing \huge et al.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Issue #3947] fixing \huge et al.

Kieren MacMillan
Hello all,

Thanks to some help (on the user-list) from David K, I've started to attack issue #3947.
(I figured this would be a nice, relatively painless way to get my feet wet in the dev/git/patch process.)

The snippet included below is what I have so far. It appears to work as hoped.

Two questions:

1. Does the skip appear *roughly* right to people? (I plan to use a mathematical interpolation/model/formula, but wanted to get approval/concensus/comments first.)

2. Seems like a lot of redundant coding here… Should I add an abstracted function (e.g., fontsizer), which is then called by \huge et al.?

Thanks,
Kieren.

%%%  SNIPPET BEGINS
\version "2.19.61"


#(define-markup-command (huge layout props arg)
  (markup?)
  #:category font
  "Set font size to +2.

@lilypond[verbatim,quote]
\\markup {
  default
  \\hspace #2
  \\huge
  huge
}
@end lilypond"
  (interpret-markup layout (prepend-alist-chain 'baseline-skip 4 (prepend-alist-chain 'font-size 2 props)) arg))

#(define-markup-command (large layout props arg)
  (markup?)
  #:category font
  "Set font size to +1.

@lilypond[verbatim,quote]
\\markup {
  default
  \\hspace #2
  \\large
  large
}
@end lilypond"
  (interpret-markup layout (prepend-alist-chain 'baseline-skip 3.625 (prepend-alist-chain 'font-size 1 props)) arg))

#(define-markup-command (normalsize layout props arg)
  (markup?)
  #:category font
  "Set font size to default.

@lilypond[verbatim,quote]
\\markup {
  \\teeny {
    this is very small
    \\hspace #2
    \\normalsize {
      normal size
    }
    \\hspace #2
    teeny again
  }
}
@end lilypond"
  (interpret-markup layout (prepend-alist-chain 'baseline-skip 3 (prepend-alist-chain 'font-size 0 props)) arg))

#(define-markup-command (small layout props arg)
  (markup?)
  #:category font
  "Set font size to -1.

@lilypond[verbatim,quote]
\\markup {
  default
  \\hspace #2
  \\small
  small
}
@end lilypond"
  (interpret-markup layout (prepend-alist-chain 'baseline-skip 2.5 (prepend-alist-chain 'font-size -1 props)) arg))

#(define-markup-command (tiny layout props arg)
  (markup?)
  #:category font
  "Set font size to -2.

@lilypond[verbatim,quote]
\\markup {
  default
  \\hspace #2
  \\tiny
  tiny
}
@end lilypond"
  (interpret-markup layout (prepend-alist-chain 'baseline-skip 2.3 (prepend-alist-chain 'font-size -2 props)) arg))

#(define-markup-command (teeny layout props arg)
  (markup?)
  #:category font
  "Set font size to -3.

@lilypond[verbatim,quote]
\\markup {
  default
  \\hspace #2
  \\teeny
  teeny
}
@end lilypond"
  (interpret-markup layout (prepend-alist-chain 'baseline-skip 2.125 (prepend-alist-chain 'font-size -3 props)) arg))

loremIpsum = \markup \wordwrap {
  Lorem ipsum dolor sit amet, consectetur adipisicing elit,
  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  Ut enim ad minim veniam, quis nostrud exercitation ullamco
  laboris nisi ut aliquip ex ea commodo consequat.
  Duis aute irure dolor in reprehenderit in voluptate
  velit esse cillum dolore eu fugiat nulla pariatur.
  Excepteur sint occaecat cupidatat non proident,
  sunt in culpa qui officia deserunt mollit anim id est laborum.
}

\markup \loremIpsum
\markup \vspace #2
\markup \huge \loremIpsum
\markup \vspace #2
\markup \large \loremIpsum
\markup \vspace #2
\markup \normalsize \loremIpsum
\markup \vspace #2
\markup \small \loremIpsum
\markup \vspace #2
\markup \tiny \loremIpsum
\markup \vspace #2
\markup \teeny \loremIpsum
%%%  SNIPPET ENDS
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

Carl Sorensen-3
On 6/7/17 12:17 PM, "lilypond-devel on behalf of Kieren MacMillan"
<lilypond-devel-bounces+c_sorensen=[hidden email] on behalf of
[hidden email]> wrote:

>Hello all,
>
>Thanks to some help (on the user-list) from David K, I've started to
>attack issue #3947.
>(I figured this would be a nice, relatively painless way to get my feet
>wet in the dev/git/patch process.)
>
>The snippet included below is what I have so far. It appears to work as
>hoped.
>
>Two questions:
>
>1. Does the skip appear *roughly* right to people? (I plan to use a
>mathematical interpolation/model/formula, but wanted to get
>approval/concensus/comments first.)

The spacing appears pretty good to me.

>
>2. Seems like a lot of redundant coding hereŠ Should I add an abstracted
>function (e.g., fontsizer), which is then called by \huge et al.?

Seems like an abstracted function with two parameters (magstep and
baselineskip) would be about right.  Of course, if you can determine
baselineskip from magstep, you would only need one parameter.


You have not yet tested your baseline-skip parameter with a different
default-staff-size.  I think that you will probably need to include the
default baseline-skip when determining the new baseline-skip.  Font sizes
avoid this problem by using a scale parameter.  I don't know that it's
possible to use a scale parameter for baseline-skip.


>
>#(define-markup-command (huge layout props arg)
>  (markup?)
>  #:category font
>  "Set font size to +2.
>
>@lilypond[verbatim,quote]
>\\markup {
>  default
>  \\hspace #2
>  \\huge
>  huge
>}
>@end lilypond"
>  (interpret-markup layout (prepend-alist-chain 'baseline-skip 4
>(prepend-alist-chain 'font-size 2 props)) arg))

Is there any place else in the codebase where we include lilypond examples
in the doc strings?  It seems like we ought to try for consistency; either
use lilypond examples in all of the doc strings (maybe at least for markup
functions) or in none of them.  I don't know the right answer; I'm just
raising the question.


Looks like a great start.

Thanks,

Carl


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

Kieren MacMillan
Hi Carl,

Thanks for the helpful response.

> The spacing appears pretty good to me.

Excellent.

> Seems like an abstracted function with two parameters (magstep and
> baselineskip) would be about right.  Of course, if you can determine
> baselineskip from magstep, you would only need one parameter.

I'm optimistic I can.

> You have not yet tested your baseline-skip parameter
> with a different default-staff-size.

No indeed. Thanks for the tip!

> I don't know that it's possible to use a scale parameter for baseline-skip.

Hmmm… Well, since it seems that [roughly]

   staff-size #20 @ font size #0 => baseline-skip 3

I would hope I'd be able to work out some formula.

> Is there any place else in the codebase where we include lilypond examples
> in the doc strings?  It seems like we ought to try for consistency; either
> use lilypond examples in all of the doc strings (maybe at least for markup
> functions) or in none of them.  I don't know the right answer; I'm just
> raising the question.

It's a good question. I simply copied this code from define-markup-commands.scm. On quick glance, it appears that most of those functions have Lilypond examples in their doc string(s). In any case, I'll leave it as a different question, to be handled separately from the improvement of \huge et al.

> Looks like a great start.

Thanks,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

Carl Sorensen-3
On 6/7/17 2:01 PM, "Kieren MacMillan" <[hidden email]>
wrote:


>> Is there any place else in the codebase where we include lilypond
>>examples
>> in the doc strings?  It seems like we ought to try for consistency;
>>either
>> use lilypond examples in all of the doc strings (maybe at least for
>>markup
>> functions) or in none of them.  I don't know the right answer; I'm just
>> raising the question.
>
>It's a good question. I simply copied this code from
>define-markup-commands.scm. On quick glance, it appears that most of
>those functions have Lilypond examples in their doc string(s). In any
>case, I'll leave it as a different question, to be handled separately
>from the improvement of \huge et al.

It's a perfect answer -- that's what is currently being done in
define-markup-commands.scm, so we should continue doing that.

Thanks,

Carl


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

Kieren MacMillan
In reply to this post by Kieren MacMillan
Hi Carl,

> You have not yet tested your baseline-skip parameter with a different
> default-staff-size.  I think that you will probably need to include the
> default baseline-skip when determining the new baseline-skip.  Font sizes
> avoid this problem by using a scale parameter.  I don't know that it's
> possible to use a scale parameter for baseline-skip.

In my exchange with David K on -user, I asked why there are so many different functions for font sizing… Now I see that the existing \fontsize automagically adjusts both baseline-skip *and* word-space (which I hadn't even considered).

In light of that, doesn't it make sense to just redefine \huge et al. to call \fontsize directly?
cf. snippet (below, with comment strings removed here)

Why would it not have been this way to begin with? Is there some side-effect that I can't predict?

Thanks,
Kieren.

%%%  SNIPPET BEGINS
\version "2.19.61"

#(define-markup-command (huge layout props arg)
  (markup?)
  #:category font
  (interpret-markup layout props
    (markup #:fontsize 2 arg)))

#(define-markup-command (teeny layout props arg)
  (markup?)
  #:category font
  (interpret-markup layout props
    (markup #:fontsize -3 arg)))

loremIpsum = \markup \wordwrap {
  Lorem ipsum dolor sit amet, consectetur adipisicing elit,
  sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  Ut enim ad minim veniam, quis nostrud exercitation ullamco
  laboris nisi ut aliquip ex ea commodo consequat.
  Duis aute irure dolor in reprehenderit in voluptate
  velit esse cillum dolore eu fugiat nulla pariatur.
  Excepteur sint occaecat cupidatat non proident,
  sunt in culpa qui officia deserunt mollit anim id est laborum.
}

\markup \loremIpsum
\markup \vspace #2
\markup \huge \loremIpsum
\markup \vspace #2
\markup \teeny \loremIpsum
%%%  SNIPPET ENDS
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

David Kastrup
Kieren MacMillan <[hidden email]> writes:

> Hi Carl,
>
>> You have not yet tested your baseline-skip parameter with a different
>> default-staff-size.  I think that you will probably need to include the
>> default baseline-skip when determining the new baseline-skip.  Font sizes
>> avoid this problem by using a scale parameter.  I don't know that it's
>> possible to use a scale parameter for baseline-skip.
>
> In my exchange with David K on -user, I asked why there are so many
> different functions for font sizing… Now I see that the existing
> \fontsize automagically adjusts both baseline-skip *and* word-space
> (which I hadn't even considered).
>
> In light of that, doesn't it make sense to just redefine \huge et
> al. to call \fontsize directly?  cf. snippet (below, with comment
> strings removed here)
>
> Why would it not have been this way to begin with? Is there some
> side-effect that I can't predict?

Maybe check the effects that super- and subscripts cause on a block of
text?  I'd not be able to tell offhand whether that's a concern, nor
whether it possibly being a concern might have changed due to
line-spacing changes in the last stable versions.

--
David Kastrup

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

Kieren MacMillan
Hi David,

> Maybe check the effects that super- and subscripts cause on a block of text?

Good thought. Doesn't seem to have a negative effect.

Other thoughts?
Or should I start moving towards a submittable patch?

Thanks,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

Thomas Morley-2
In reply to this post by Carl Sorensen-3
2017-06-07 21:53 GMT+02:00 Carl Sorensen <[hidden email]>:

>
> Is there any place else in the codebase where we include lilypond examples
> in the doc strings?  It seems like we ought to try for consistency; either
> use lilypond examples in all of the doc strings (maybe at least for markup
> functions) or in none of them.  I don't know the right answer; I'm just
> raising the question.

From the comment on top of define-markup-commands.scm:
[...]
;;;
;;; Each markup command definition shall have a documentation string
;;; with description, syntax and example.

Cheers,
  Harm

_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Issue #3947] fixing \huge et al.

Kieren MacMillan
In reply to this post by Kieren MacMillan
Hello,

Just checking on this, since a week has passed since I asked…
Should I start moving towards a submittable patch?

Thanks,
Kieren.

> Hi David,
>
>> Maybe check the effects that super- and subscripts cause on a block of text?
>
>
> Good thought. Doesn't seem to have a negative effect.
>
> Other thoughts?
> Or should I start moving towards a submittable patch?

________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-devel mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-devel
Loading...