...Done some homework again...   ;-)

Here is another take on updating OOoLilyPond.
It contains some more additions:
* font name and font size for editor windows can be specified
* user now can choose between two different ways to import graphic into document (methods from 0.4.0 and 0.4.1rc1).

and, of course, the additions already contained in rc1:
* fixed: Runtime error - Variable not defined: line 40 CurserPosition=1
* additional include paths can be specified
* added button to save the current code into temporary file and open it in external editor
* added button to re-import code from temporary file back to editor window
* added support for the use of SVG graphics format (with the known restrictions)

In the attachment, there is also a readme file with more detailed information.

I'v done some testing with the attached version, but certainly not in an exhaustive way... ;-) If there is (or will be) a collaboration to further develop OOoLilyPond, I'm gladly willing to join in. However, I have no idea of the python language, so I could never do a re-write from scratch on my own. In addition, my knowledge about collaboration with git repositories is absolutely zero, but I'm always open to learn. Can anyone recommend a good introduction for Windows users?

Cheers,
Klaus

Attachment: OOoLilyPond-0.4.2rc4.oxt
Description: application/vnd.openofficeorg.extension

  OooLilyPond 0.4.2rc4 ReadMe  (January 2017)
===============================================


This release is based on the two most recent versions that have been published 
by the original developer Samuel Hartmann.

Version 0.4.0:
---------------
http://ooolilypond.sourceforge.net/
https://sourceforge.net/projects/ooolilypond/
http://extensions.openoffice.org/de/project/ooolilypond
(direct download:)
https://downloads.sourceforge.net/project/ooolilypond/ooolilypond/OOoLilyPond-0.4.0/OOoLilyPond-0.4.0.oxt?r=&ts=1484832348&use_mirror=netix

Version 0.4.1rc1:
------------------
https://sourceforge.net/p/ooolilypond/discussion/614285/thread/d200563d/#52fd/5aef
(direct download:)
http://www.hartmann-weine.ch/OOoLilyPond-0.4.1rc1.oxt



On the LilyPond mailing list, there are some considerations to continue the 
OOoLilyPond project. 
You can follow the discussion here: 
http://lilypond.1069038.n5.nabble.com/OOoLilyPond-td185560.html


Changes to OOoLilyPond 0.4.2rc4 since 0.4.0/0.4.1:
===================================================

* fixed: Runtime error - Variable not defined: line 40 CurserPosition=1
* additional include paths can be specified 
* added button to save the current code into temporary file and open it in 
external editor 
* added button to re-import code from temporary file back to editor window 
* added support for the use of SVG graphics format
* user now can choose between two different ways to import graphic into 
document 
* font name and font size for editor windows can be specified


1.) fixed: Runtime error - Variable not defined: line 40 CurserPosition=1
--------------------------------------------------------------------------

Apparently, a small bug in OOoLilyPond prevented the correct error handling, if 
the expected graphics file (produced by LilyPond) could not be found. Instead, 
the macro stopped with the mentioned runtime error. This has now been fixed. 

Up to LilyPond 2.18, both an EPS file and a PNG file were present if LilyPond 
had been executed in PNG format. In LilyPond 2.19, this seems to have changed, 
only a PNG file is produced. 
Unfortunatly, OOoLilyPond always checked for the presence of an EPS file and 
stopped if there was none. 
This now has been changed as well: Whatever format is chosen (EPS, PNG or SVG), 
OOoLilyPond checks if the corresponding graphics file is present.


2.) Additional include paths can be specified 
----------------------------------------------

In the configuration dialog, there is a text field where you can specify 
statements for additional include paths. Its entire contents is literally 
passed to LilyPond as a parameter. 
It can simply be left empty, or it can contain one or multiple include path 
definitions (i.e. the -I parameter) as described here:
http://lilypond.org/doc/v2.18/Documentation/usage/command_002dline-usage#basic-command-line-options-for-lilypond

for example:
  -I"C:/Users/Klaus/" -I"C:/Program Files (x86)/"
(Even in Windows, LilyPond expects the paths given with forward slashes instead 
of backward slashes. OOoLilyPond will adapt the path statements, if necessary.)


3.) Save the current code into temporary file / re-import code from temporary 
file
---------------------------------------------------------------------------------

Working in the small editor window can be somewhat cumbersome. 
However, it only contains the portion of the code between the 
%{OOoLilyPondCode%} and %{OOoLilyPondEnd%} tags. 
Copying its contents into an external editor like Frescobaldi is possible, but 
compiling will not always lead to sensible results, because everything else 
from the template (including other fields, e.g. staff size) is missing. 

The "Open as temp. file in Ext. Editor" will therefore merge the contents of 
the editor fields into the template code and save the result to a temporary 
file "OOoLilyPondTemp.ly", which is now fully compilable. 
This file will be opened in the editor specified in the config dialog.
Your changes must be saved to that file.

The "Import from temp. file" button will read "OOoLilyPondTemp.ly" and update 
the contents of the code field and the "LineWidth", "Staff Size", "Custom1" and 
"Custom2" fields in the editor window.
Important: Only those five fields are updated. Changes to other parts of the 
template will be ignored! 
(If necessary, you can create your own templates or modify existing ones.) 


4.) Support for EPS/PNG/SVG graphics format
--------------------------------------------

In the config dialog, OOoLilyPond lets you choose whether to use EPS, PNG or 
SVG graphics format. 
However, there are some restrictions:


PNG should work fine with both office versions (OpenOffice, LibreOffice) on 
both platforms (Linux, Windows). But as PNG is a bitmap format, it does not 
look as good as EPS or SVG when printed on paper. 


EPS does *not* work with LibreOffice. (Maybe this can be fixed in LibreOffice 
versions later than 5.2.4.2 - who knows...) 
It works fine with OpenOffice 4.1.3, even if the graphics are not visible in 
the OpenOffice window. If you "print" your document with a suitable pdf 
printer, e.g. FreePDF ( http://freepdfxp.de/index_en.html ), the resulting pdf 
output file will be correct. 


SVG will only work with LibreOffice and *not* with OpenOffice. 
For SVG use, some more things have to be considered: 

* Most OOoLilyTemplates use "lilypond-book-preamble.ly" which *only* works with 
EPS or PNG format, and *not* with SVG (in that case, no graphics output file is 
produced). 

* You can use the templates "SVG Default" and "SVG Direct to LilyPond" with SVG 
format. 
However, without lilypond-book-preamble.ly, there is no automatic cropping of 
the resulting image. 
Therefore, you must specify the "paper" size for your LilyPond snippet in 
advance. As line-width must be given anyway, only the paper height would have 
to be found by trial-and-error. So maybe this isn't as bad as is sounds... 
By the way: in LibreOffice, you can manually crop the image after inserting.

* If LilyPond uses fonts that are not installed on your system, they won't show 
up correctly in the resulting SVG image. Therefore, the two SVG templates have 
some preparation to replace LilyPond's default fonts. 


By the way: Using a macro to import vector graphics (EPS, SVG) into OpenOffice 
Draw or LibreOffice Draw, the image has only about 40% of its original size. 
Importing the same graphics file via the menu preserves the original image 
size. No idea what's going on here...


5.) Two different ways to import graphic into document 
-------------------------------------------------------

Up to Version 0.4.0, graphics were imported to the clipboard and then pasted 
into the document. In LibreOffice, this can cause problems, e.g. when inserting 
as SVG into Draw. 
For 0.4.1, the developer provided a new method for direct inserting without 
clipboard use. In OpenOffice it can happen that temporary graphic files are not 
released after use and therefore cannot be deleted. In LibreOffice it works 
fine. 
In 0.4.2 both methods are offered. The option dialog lets you define which 
method to use in Writer and which one for Draw/Impress.




What if I get an error "There is no EPS/PNG/SVG output"?
---------------------------------------------------------

You can read LilyPond's compiler messages by clicking the "Ly Output" button. 

* Do you have severe errors in your LilyPond code?
You can also jump to the reported errors with the "arrow" buttons at the bottom 
left of the editor window.

* Did you try to produce SVG output, and your template uses 
"lilypond-book-preamble.ly" (see above)? The preamble prevents the creation of 
a SVG file.

* In SVG mode, if your "paper" size for the music snippet is too small, 
LilyPond will split up its output into multiple images named 
"OOoLilyPond-page-1.svg", "OOoLilyPond-page-2.svg" etc. Those are not 
recognized, hence the error message. 

You can also specify "page-count = 1" to prevent the creation of multiple 
images. But if your paper size is to small, there's no image at all. 
Check Ly output for messages like "tried to space systems on a bad number of 
pages" or "number of pages is out of bounds".


Credits
========

Finally: A big big THANK YOU to Samuel Hartmann, the original developer of 
OOoLilyPond, and to everyone else who has contributed to the project. This is a 
phantastic tool that has simplified the daily workflow of so many people. 
I am one of them. 


Klaus Blum, January 2017
#(set-global-staff-size #!OOoLilyPondStaffSize!# 20 #!OOoLilyPondEnd!#)
#(define version-seen #t)  % don't remove, because
% the version warning has a slightly different format than normal error messages.
% This (still) would crash OLy's message handling...

\paper {
  paper-width  = %{OOoLilyPondLineWidth%}8\cm%{OOoLilyPondEnd%}
  paper-height = %{OOoLilyPondCustom2%}4\cm%{OOoLilyPondEnd%}
  
  % If LilyPond's default fonts are not installed and therefore "invisible" to other applications, 
  % you can define a replacement font here:
  #(define fonts
    (set-global-fonts
      ; #:music "emmentaler"
      ; #:brace "emmentaler"
      ; #:roman "Century Schoolbook L"
      ; #:sans "sans-serif"
      ; #:typewriter "monospace"
      #:factor (/ staff-height pt 20)
  ))
  % taken from http://lilypondblog.org/2015/03/managing-alternative-fonts-with-lilypond/
}

\layout {
  indent = %{OOoLilyPondCustom1%}2.5\mm%{OOoLilyPondEnd%}
}


% --------------------------------------------------------
%{OOoLilyPondCode%}
% Use "Custom 1" for indent
% Use "Custom 2" for paper height

\paper {
  ragged-right = ##t
  
  left-margin   = 0
  right-margin  = 0
  top-margin    = 0
  bottom-margin = 0
  print-page-number = ##f
  
  page-count = 1
  
}

\header {
  tagline = ##f
}

\layout {
  \context {
    \Score
    \remove "Bar_number_engraver"
  }
}

% -------------------------------------------------------

{
  \new PianoStaff {
    <<
      \new Staff {c'4 d' e' f'    g'2 g'}
      \new Staff {\clef bass c2 c4 d    e2 e}
    >>
  }
}

%{OOoLilyPondEnd%}
%{OOoLilyPondCode%} #(set-global-staff-size 20)
#(define version-seen #t)  % don't remove, because
% the version warning has a slightly different format than normal error messages.
% This (still) would crash OLy's message handling...

\paper {
  paper-width  = 8\cm
  paper-height = 4\cm
  
  % If LilyPond's default fonts are not installed and therefore "invisible" to other applications, 
  % you can define a replacement font here:
  #(define fonts
    (set-global-fonts
      ; #:music "emmentaler"
      ; #:brace "emmentaler"
      ; #:roman "Century Schoolbook L"
      ; #:sans "sans-serif"
      ; #:typewriter "monospace"
      #:factor (/ staff-height pt 20)
  ))
  % taken from http://lilypondblog.org/2015/03/managing-alternative-fonts-with-lilypond/
}

\layout {
  indent = 2.5\mm
}

\paper {
  ragged-right = ##t
  
  left-margin   = 0
  right-margin  = 0
  top-margin    = 0
  bottom-margin = 0
  print-page-number = ##f
  
  page-count = 1
  
}

\header {
  tagline = ##f
}

\layout {
  \context {
    \Score
    \remove "Bar_number_engraver"
  }
}

% -------------------------------------------------------

{
  \new PianoStaff {
    <<
      \new Staff {c'4 d' e' f'    g'2 g'}
      \new Staff {\clef bass c2 c4 d    e2 e}
    >>
  }
}

%{OOoLilyPondEnd%} 
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to