Re: \uppercase function

2023-06-16 Thread Kieren MacMillan
Hi Jean,

> \markup uppercase =
> \markup \with-string-transformer
>   #(lambda (layout props str) (string-upcase str))
> \etc

That’s what I’m talkin’ about!   :)

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: \uppercase function

2023-06-16 Thread Jean Abou Samra
Le vendredi 16 juin 2023 à 15:13 +0100, Mark Knoop a écrit :
> Wait, I see there is already a \fontCaps command - does that not work?

That's small caps, not normal caps.



signature.asc
Description: This is a digitally signed message part


Re: \uppercase function

2023-06-16 Thread Jean Abou Samra
Le vendredi 16 juin 2023 à 09:41 -0400, Kieren MacMillan a écrit :

> Hi all!
> 
> Anyone have a good \uppercase function they could share?
> 
> I tried to make one, and it doesn’t throw an error, but also doesn’t work:
> 
> ```
> \version "2.25.2"
> 
> #(define-markup-command (uppercase layout props arg) (markup?)
>    (interpret-markup layout props (string-upcase (markup->string arg
> 
> \header {
>   title = "My Awesome Piece"
> }
> 
> \paper {
>   scoreTitleMarkup = \markup \uppercase \fromproperty #'header:title
> }
> 
> { c1 }
> ```

It's expected that this doesn't work, since you feed "\fromproperty 
#'header:title" to markup->string, but you don't give the properties to 
markup->string, so it doesn't know what value the "header:title" property. 
Replacing `(markup->string arg)` with `(markup->string arg #:layout layout 
#:props props)` should work. Better yet, use string transformers (since 
2.23.12), which solve exactly this problem:

```
\version "2.24.1"

\markup uppercase =
\markup \with-string-transformer
  #(lambda (layout props str) (string-upcase str))
\etc


\header {
  title = "My Awesome Piece"
}

\paper {
  scoreTitleMarkup = \markup \uppercase \fromproperty #'header:title
}

{ c1 }
```



Jean






signature.asc
Description: This is a digitally signed message part


Re: \uppercase function

2023-06-16 Thread Mark Knoop
Wait, I see there is already a \fontCaps command - does that not work?

At 15:10 on 16 Jun 2023, Mark Knoop wrote:
> Not offhand, but I'd start with make-small-caps in
> define-markup-commands.scm and strip out the is-lower logic.

> At 09:41 on 16 Jun 2023, Kieren MacMillan wrote:
>> Hi all!

>> Anyone have a good \uppercase function they could share?

>> I tried to make one, and it doesn’t throw an error, but also doesn’t
>> work:

>> \version "2.25.2"

>> #(define-markup-command (uppercase layout props arg) (markup?)
>>(interpret-markup layout props (string-upcase (markup->string arg

>> \header {
>>   title = "My Awesome Piece"
>> }

>> \paper {
>>   scoreTitleMarkup = \markup \uppercase \fromproperty #'header:title
>> }

>> { c1 }

>> Thanks,
>> Kieren.


--
Mark Knoop



Re: \uppercase function

2023-06-16 Thread Mark Knoop
Not offhand, but I'd start with make-small-caps in
define-markup-commands.scm and strip out the is-lower logic.

At 09:41 on 16 Jun 2023, Kieren MacMillan wrote:
> Hi all!

> Anyone have a good \uppercase function they could share?

> I tried to make one, and it doesn’t throw an error, but also doesn’t
> work:

> \version "2.25.2"

> #(define-markup-command (uppercase layout props arg) (markup?)
>(interpret-markup layout props (string-upcase (markup->string arg

> \header {
>   title = "My Awesome Piece"
> }

> \paper {
>   scoreTitleMarkup = \markup \uppercase \fromproperty #'header:title
> }

> { c1 }

> Thanks,
> Kieren.

--
Mark Knoop



\uppercase function

2023-06-16 Thread Kieren MacMillan
Hi all!

Anyone have a good \uppercase function they could share?

I tried to make one, and it doesn’t throw an error, but also doesn’t work:

\version "2.25.2"

#(define-markup-command (uppercase layout props arg) (markup?)
   (interpret-markup layout props (string-upcase (markup->string arg

\header {
  title = "My Awesome Piece"
}

\paper {
  scoreTitleMarkup = \markup \uppercase \fromproperty #'header:title
}

{ c1 }

Thanks,
Kieren.
__

My work day may look different than your work day. Please do not feel obligated 
to read or respond to this email outside of your normal working hours.




Re: \uppercase function

2015-04-09 Thread David Nalesnik
Hi Kieren,

On Thu, Apr 9, 2015 at 9:48 AM, Kieren MacMillan 
kieren_macmil...@sympatico.ca wrote:

 Hi all,

 I’m looking for an \uppercase function to use in Lilypond — this one
 (which I found somewhere, but can’t remember where now) doesn’t seem to
 work:

 \version 2.19

 #(define-markup-command (uppercase paper props markup-argument) (markup?)
 (interpret-markup paper (prepend-alist-chain 'case 'up props)
 markup-argument))

 \markup \uppercase “Test

 Any hints or solutions would be appreciated.


You are only using part of the code which I find here:
http://www.autoindustry536.bllog.opensubscriber.com/message/lilypond-de...@gnu.org/12807136.html


Note that the following will work with your simple example, though
\uppercase has to be directly before the markup:
#(define-markup-command (uppercase layout props markup-argument)
   (markup?)
   (interpret-markup layout props
 (string-upcase (markup-string markup-argument


HTH,
David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \uppercase function

2015-04-09 Thread David Nalesnik
On Thu, Apr 9, 2015 at 10:31 AM, David Nalesnik david.nales...@gmail.com
wrote:



 Note that the following will work with your simple example, though
 \uppercase has to be directly before the markup:


I meant in case you do something like:

\markup \bold \italic \uppercase Test

The \uppercase needs to be the last command issued.

DN
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \uppercase function

2015-04-09 Thread Kieren MacMillan
Hi David,

 you could just as easily write the following:
 
 \header {
  myTitle = #myOtherTitle
  title = \markup {
from \italic #(string-upcase myTitle)
  }
 }

Yes, but at that point, why not just write

 \header {
   title = “MY OTHER TITLE
 }

??  ;)

Here’s the concrete use-case:
1. I have musical theatre pieces with (naturally enough) title case titles, 
such as “My Lucky Day”.
2. When they’re included in the Piano/Conductor score (or other score from the 
regular performance materials), the title should remain in title case.
3. When they’re included in a songbook, I’m trying to show the title in the the 
expected format, which is all-caps (cf. modern Warner-Chappell imprints), e.g., 
“MY LUCKY DAY”.
4. I want to accomplish this entirely in the stylesheets, and not have to have 
two different ways of inputting the title in the code/content.

It seems odd to me that it’s so convoluted a process — and apparently so 
different, depending on whether it’s a string or a property.  =\

Thanks,
Kieren.

___

Kieren MacMillan, composer
www:  http://www.kierenmacmillan.info
email:  i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \uppercase function

2015-04-09 Thread David Nalesnik
Kieren,

On Thu, Apr 9, 2015 at 10:37 AM, Kieren MacMillan 
kieren_macmil...@sympatico.ca wrote:

 Hi David,

  You are only using part of the code which I find here:
 http://www.autoindustry536.bllog.opensubscriber.com/message/lilypond-de...@gnu.org/12807136.html

 Yes! That was it. Thanks for the link.

  Note that the following will work with your simple example, though
 \uppercase has to be directly before the markup:
  #(define-markup-command (uppercase layout props markup-argument)
 (markup?)
 (interpret-markup layout props
   (string-upcase (markup-string markup-argument

 My issue is the same as in that 2009 post:

 \uppercase \fromproperty #’header:title

 fails. Any thoughts on how to fix that?


Nicholas's \simple function requires a string, and mine requires that we be
able to get at the string within a markup argument.   Ordinarily, getting
the string wouldn't be a problem.   Not so with the markup returned by the
fromproperty command: the function markup-string won't work here.

Nevertheless, we can easily get the title string by referring to the
variable myTitle:

\version 2.19

#(define-markup-command (uppercase paper props markup-argument)
   (markup?)
   Make the markup uppercase.
  Syntax: \\uppercase \string\
   (interpret-markup paper (prepend-alist-chain 'case 'up props)
 markup-argument))

#(define-markup-command (simple paper props str) (string?)
   Depending on the `case' property, may change the case
of the string before interpreting it.
   (let ((text-case (chain-assoc-get 'case props 'normal)))
 (interpret-markup paper props
   (case text-case
 ((up) (string-upcase str))
 ((down) (string-downcase str))
 ;; TODO: small caps, capitalized text, etc
 (else str)


\header {
  myTitle = myTitle
  title = \markup {
from \uppercase \simple #myTitle
  }
}
\markup {
  \null
}

%%%
Though you could just as easily write the following:

\header {
  myTitle = #myOtherTitle
  title = \markup {
from \italic #(string-upcase myTitle)
  }
}
\markup {
  \null
}

%%%

HTHm
David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \uppercase function

2015-04-09 Thread Kieren MacMillan
Hi David,

 you could just as easily write the following:
 
 \header {
   myTitle = #myOtherTitle
   title = \markup {
 from \italic #(string-upcase myTitle)
   }
 }

Yes, but at that point, why not just write

  \header {
title = “MY OTHER TITLE
  }

??  ;)

Here’s the concrete use-case:
1. I have musical theatre pieces with (naturally enough) title case titles, 
such as “My Lucky Day”.
2. When they’re included in the Piano/Conductor score (or other score from the 
regular performance materials), the title should remain in title case.
3. When they’re included in a songbook, I’m trying to show the title in the the 
expected format, which is all-caps (cf. modern Warner-Chappell imprints), e.g., 
“MY LUCKY DAY”.
4. I want to accomplish this entirely in the stylesheets, and not have to have 
two different ways of inputting the title in the code/content.

It seems odd to me that it’s so convoluted a process — and apparently so 
different, depending on whether it’s a string or a property.  =\

Thanks,
Kieren.

___

Kieren MacMillan, composer
www:  http://www.kierenmacmillan.info
email:  i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \uppercase function

2015-04-09 Thread David Nalesnik
On Thu, Apr 9, 2015 at 11:48 AM, David Nalesnik david.nales...@gmail.com
wrote:



HTH  Who knows what HTHm stands for.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \uppercase function

2015-04-09 Thread Kieren MacMillan
Hi David,

 You are only using part of the code which I find here: 
 http://www.autoindustry536.bllog.opensubscriber.com/message/lilypond-de...@gnu.org/12807136.html

Yes! That was it. Thanks for the link.

 Note that the following will work with your simple example, though \uppercase 
 has to be directly before the markup:
 #(define-markup-command (uppercase layout props markup-argument)
(markup?)
(interpret-markup layout props
  (string-upcase (markup-string markup-argument

My issue is the same as in that 2009 post:

\uppercase \fromproperty #’header:title

fails. Any thoughts on how to fix that?

Thanks,
Kieren.

___

Kieren MacMillan, composer
www:  http://www.kierenmacmillan.info
email:  i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \uppercase function

2015-04-09 Thread David Nalesnik
On Thu, Apr 9, 2015 at 3:02 PM, Kieren MacMillan 
kieren_macmil...@sympatico.ca wrote:

 Hi David,

  you could just as easily write the following:
 
  \header {
   myTitle = #myOtherTitle
   title = \markup {
 from \italic #(string-upcase myTitle)
   }
  }

 Yes, but at that point, why not just write

  \header {
title = “MY OTHER TITLE
  }

 ??  ;)


This might prove the least labor-intensive solution :)



 Here’s the concrete use-case:
 1. I have musical theatre pieces with (naturally enough) title case
 titles, such as “My Lucky Day”.
 2. When they’re included in the Piano/Conductor score (or other score from
 the regular performance materials), the title should remain in title case.
 3. When they’re included in a songbook, I’m trying to show the title in
 the the expected format, which is all-caps (cf. modern Warner-Chappell
 imprints), e.g., “MY LUCKY DAY”.
 4. I want to accomplish this entirely in the stylesheets, and not have to
 have two different ways of inputting the title in the code/content.

 It seems odd to me that it’s so convoluted a process — and apparently so
 different, depending on whether it’s a string or a property.  =\


To make the title uppercase we have to work with it as a string.  I can't
extract the string from the \markup \fromproperty #'header:title statement,
presumably because header:title hasn't even been defined yet:

\header {
  title = myTitle
  title = \markup \fromproperty #'header:title
  #(format #t ~%is header:title defined? ~a~%~% (defined? 'header:title))
}
\markup {
  \null
}

%%
David
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


\uppercase function

2015-04-09 Thread Kieren MacMillan
Hi all,

I’m looking for an \uppercase function to use in Lilypond — this one (which I 
found somewhere, but can’t remember where now) doesn’t seem to work:

\version 2.19

#(define-markup-command (uppercase paper props markup-argument) (markup?)
(interpret-markup paper (prepend-alist-chain 'case 'up props) markup-argument))

\markup \uppercase “Test

Any hints or solutions would be appreciated.

Thanks,
Kieren.
___

Kieren MacMillan, composer
www:  http://www.kierenmacmillan.info
email:  i...@kierenmacmillan.info


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user