Re: -dgui option dropped in 2.24 - how to stop the black box on Windows now?

2023-04-02 Thread Aaron Hill

On 2023-04-02 8:38 am, Richard Shann wrote:

there used to be an executable lilypond-windows.exe in addition to the
lilypond.exe which has also vanished. I suspect it was compiled using
the option

-mconsole

passed to gcc as this is how Denemo is compiled to avoid leaving a
terminal around that would tempt the user to kill everything by
dismissing it (Windows users are generally not familiar with
terminals).


Yup.  On Windows, the executable takes two forms based on whether it is 
CLI-based or GUI-based.  lilypond-windows.exe was in all practical ways 
identical to lilypond.exe except that it had WinMain as its entrypoint 
instead of main.  This meant Windows did not automatically allocate a 
console window.  Do note that even GUI-based applications are afforded a 
text console but they must explicitly call the AllocConsole API.




If I understand this correctly, it looks like I will have to spawn a
process that runs a windows batch file that processes the command line
parameters and synthesizes the names of the log file that LilyPond used
to create and then calls LilyPond with re-direction of the output. I'm
not sure that this can be done without a terminal popping up to annoy
the user.


I have never looked at Denemo or its source code, so what I am going to 
say might not be so trivially applicable.  But in the Win32 API, you can 
call CreateProcess [1] and use the process flag CREATE_NO_WINDOW [2].  
This should prevent the console window appearing if the child process is 
CLI-based.


[1]: 
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa
[2]: 
https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags




Is there anyway of spawning a LilyPond 2.24 process on Windows now
without plaguing the user with terminals?


You might be able to shim with a VBS wrapper.  I do this a lot for 
custom scheduled tasks that would normally run in the terminal but that 
I do not want to interrupt what I am doing by spawning a window at odd 
times.  Something like this should work, passing arguments to the script 
along to LilyPond:



' Turn WScript.Arguments into a proper array.
Dim args()
ReDim args(WScript.Arguments.Count - 1)
For i = 0 To WScript.Arguments.Count - 1
  args(i) = Chr(34) & WScript.Arguments(i) & Chr(34)
Next

Dim shell
Set shell = WScript.CreateObject("WScript.Shell")
shell.Run "lilypond.exe " & Join(args), 0, True


NOTE: The important parameter here is the zero (0) to shell.Run.  This 
hides the spawned process.  The True waits for the child process to 
finish, which probably is what you need for this use case.  But if you 
just want to fire off a child process and not have the scripting host 
stick around, change that to False.



-- Aaron Hill



Re: Question for Windows users

2023-04-02 Thread Jean Abou Samra
Many thanks to Gilles, Mark, and also Arne Peters who replied
off-list, that gives me the needed info.



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


Re: -dgui option dropped in 2.24 - how to stop the black box on Windows now?

2023-04-02 Thread Richard Shann
On Sun, 2023-04-02 at 13:57 +0200, Robin Bannister wrote:
> Richard Shann wrote:
> > There was an option -dgui which allowed Denemo to run LilyPond in
> > the
> > background on Windows, but this has vanished without, as far as I
> > can
> > see, any entry in the Changes to account for it
> > 
> 
> See 
> https://gitlab.com/lilypond/lilypond/-/commit/0a7d54646be5566de53e2f7dd0c19a2c1df92156?merge_request_iid=1373
> 
Thank you for your quick reply. 
If I understand this correctly, it looks like I will have to spawn a
process that runs a windows batch file that processes the command line
parameters and synthesizes the names of the log file that LilyPond used
to create and then calls LilyPond with re-direction of the output. I'm
not sure that this can be done without a terminal popping up to annoy
the user.

However I think what this says is that the current problem of a
terminal popping up and blocking progress is due something else that
has changed:
there used to be an executable lilypond-windows.exe in addition to the
lilypond.exe which has also vanished. I suspect it was compiled using
the option

-mconsole

passed to gcc as this is how Denemo is compiled to avoid leaving a
terminal around that would tempt the user to kill everything by
dismissing it (Windows users are generally not familiar with
terminals).

Is there anyway of spawning a LilyPond 2.24 process on Windows now
without plaguing the user with terminals?

Richard




> 
> Cheers,
> Robin





Re: Question for Windows users

2023-04-02 Thread Mark Mathias
On Sun, Apr 2, 2023 at 4:08 AM Ya Gloops  wrote:

> Hello Jean !
> For me a,b,c,d work perfectly...
> Gilles
>
>
>
>
>
>
> Le dimanche 2 avril 2023 à 01:45:35 UTC+2, Jean Abou Samra <
> j...@abou-samra.fr> a écrit :
>
>
>
>
>
> Hi,
>
> A little question for Windows users: could one of you please
> do the following test and report back?
>
> 1. Choose any font that is NOT installed on your system.
>   Random choice: https://www.fontsquirrel.com/fonts/alex-brush
>   It's very recognizable, so it'll be easy to tell if the
>   font is being properly used. I will assume you use this
>   font (“AlexBrush”) in the following.
>
> 2. Create a .ly file in some directory on your computer. Put
>   the font .otf/.ttf file(s) in that directory.
>
> 3. Add this code to the .ly file and compile it:
>
>
>   \version "2.24.1"
>   #(ly:font-config-add-directory "C:/path/to/directory")
>   \markup \override #'(font-name . "AlexBrush") "ABCD"
>
>
>   where "C:/path/to/directory" is the path to the directory
>   you put the .ly file and the font in, with 4 different
>   variants. Please test all 4 and let me know which work
>   and which don't.
>
>   a) Slashes in the path and a slash at the end:
>   C:/path/to/directory/
>   b) Slashes in the path and no slash at the end:
>   C:/path/to/directory
>   c) Double backslashes in the path and a double backslash at the end:
>   C:\\path\\to\\directory\\
>   d) Double backslashes in the path and no double backslash at the end:
>   C:\\path\\to\\directory
>
>
>
> Thanks in advance.
>
>
> Jean
>
>
>
Jean,

I know you only asked for one test, but it works for me also. One caveat: I
accidentally put the font in a different directory than the .ly file, but
of course, typed the correct path to the font.

Mark


Re: -dgui option dropped in 2.24 - how to stop the black box on Windows now?

2023-04-02 Thread Robin Bannister

Richard Shann wrote:

There was an option -dgui which allowed Denemo to run LilyPond in the
background on Windows, but this has vanished without, as far as I can
see, any entry in the Changes to account for it



See 
https://gitlab.com/lilypond/lilypond/-/commit/0a7d54646be5566de53e2f7dd0c19a2c1df92156?merge_request_iid=1373



Cheers,
Robin



-dgui option dropped in 2.24 - how to stop the black box on Windows now?

2023-04-02 Thread Richard Shann
There was an option -dgui which allowed Denemo to run LilyPond in the
background on Windows, but this has vanished without, as far as I can
see, any entry in the Changes to account for it

https://lilypond.org/doc/v2.24/Documentation/changes-big-page

Is it possible for LilyPond 2.24 to be run in the background? 
As it is an ugly console pops up blotting out the user's view of his
work and preventing him continuing to enter text/music until it is
done.

Richard





Re: Question for Windows users

2023-04-02 Thread Ya Gloops
Hello Jean !
For me a,b,c,d work perfectly...
Gilles






Le dimanche 2 avril 2023 à 01:45:35 UTC+2, Jean Abou Samra  
a écrit : 





Hi,

A little question for Windows users: could one of you please
do the following test and report back?

1. Choose any font that is NOT installed on your system.
  Random choice: https://www.fontsquirrel.com/fonts/alex-brush
  It's very recognizable, so it'll be easy to tell if the
  font is being properly used. I will assume you use this
  font (“AlexBrush”) in the following.

2. Create a .ly file in some directory on your computer. Put
  the font .otf/.ttf file(s) in that directory.

3. Add this code to the .ly file and compile it:


  \version "2.24.1"
  #(ly:font-config-add-directory "C:/path/to/directory")
  \markup \override #'(font-name . "AlexBrush") "ABCD"


  where "C:/path/to/directory" is the path to the directory
  you put the .ly file and the font in, with 4 different
  variants. Please test all 4 and let me know which work
  and which don't.

  a) Slashes in the path and a slash at the end:
      C:/path/to/directory/
  b) Slashes in the path and no slash at the end:
      C:/path/to/directory
  c) Double backslashes in the path and a double backslash at the end:
      C:\\path\\to\\directory\\
  d) Double backslashes in the path and no double backslash at the end:
      C:\\path\\to\\directory



Thanks in advance.


Jean