Here's a patch that solves Andrei's problems and also 
includes a cleaner reimplementation of Jan's page layout
patch for ly2dvi.

Unfortunately, the national characters have to be coded 
with some care. TeX can understand many different syntaxes
but Lilypond is somewhat restrictive if you want to get the
correct size calculations for the syllables.
The basic syntax is "\texmacro{character}", e.g.
b\u{a} instead of "b\u a" and m\^{a} instead of m\^a.
Also, Lilypond beleives the "\i" has length zero, since
it's a TeX macro, therefore you have to write v\^{\i}n_
instead of v\^{\i}n (the '_' gives a space at the end
of the syllable which will compensate the missing lenght
of the \i). The text in Andrei's example should thus be
coded:

text = \lyrics {
     Ca m\u{a} -- ta -- sea prun -- du -- ie ier -- bi -- le se un --
du -- ie
%5
        \^{\i}n_ b\u{a} -- ta -- ia v\^{\i}n_ -- tu -- lui 
        s\^{a}n -- ge -- le p\u{a} -- m\^{a}n -- tu -- lui, 
        s\^{a}n -- ge -- le p\u{a} -- m\^{a}n -- tu -- lui
%8      
        \^{\i}n_ b\u{a} -- ta -- ia v\^{\i}n_ -- tu -- lui, 
        \^{\i}n_ b\u{a} -- ta -- ia v\^{\i}n_ -- tu -- lui2
}



     /Mats

Generated by (address unknown),
>From = lilypond-1.3.47, To = lilypond-1.3.47.mb1

usage 

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.3.47.mb1.diff

Patches do not contain automatically generated files 
or (urg) empty directories, 
i.e., you should rerun autoconf, configure

diff -urN ../lilypond-1.3.47/CHANGES ./CHANGES
--- ../lilypond-1.3.47/CHANGES  Thu Apr 27 00:12:25 2000
+++ ./CHANGES   Sun Apr 30 18:06:58 2000
@@ -1,3 +1,12 @@
+1.3.47.mb1
+===========
+
+* Simplified ly2dvi using the power of the geometry package.
+
+* Improved heuristic size calculation of TeX macros. Handles e.g.
+  "\\u{a}", "\\"{o}" and "\\^{u}" correctly.
+
+
 1.3.46.jcn2
 ===========
 
diff -urN ../lilypond-1.3.47/VERSION ./VERSION
--- ../lilypond-1.3.47/VERSION  Thu Apr 27 14:11:00 2000
+++ ./VERSION   Sun Apr 30 18:07:16 2000
@@ -2,7 +2,7 @@
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=47
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=mb1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff -urN ../lilypond-1.3.47/lily/font-metric.cc ./lily/font-metric.cc
--- ../lilypond-1.3.47/lily/font-metric.cc      Wed Mar 15 13:36:28 2000
+++ ./lily/font-metric.cc       Sun Apr 30 18:04:15 2000
@@ -4,7 +4,8 @@
   source file of the GNU LilyPond music typesetter
   
   (c) 1999--2000 Han-Wen Nienhuys <[EMAIL PROTECTED]>
-  
+
+    Mats Bengtsson <[EMAIL PROTECTED]>  (the ugly TeX parsing in text_dimension)
  */
 
 #include <math.h>
@@ -22,23 +23,29 @@
   for (int i = 0; i < text.length_i (); i++) 
     {
       
-      if (text[i]=='\\') 
+      switch (text[i]) 
        {
-         for (i++; (i < text.length_i ()) && isalpha(text[i]); i++)
+       case '\\':
+         for (i++; (i < text.length_i ()) && !isspace(text[i]) 
+                && text[i]!='{' && text[i]!='}'; i++)
            ;
          // ugh.
          i--; // Compensate for the increment in the outer loop!
-       }
-      else
-       {
+         break;
+       case '{':  // Skip '{' and '}'
+       case '}':
+         break;
+       
+       default: 
          Box b = get_char ((unsigned char)text[i],false);
-
+         
          // Ugh, use the width of 'x' for unknown characters
          if (b[X_AXIS].length () == 0) 
            b = get_char ((unsigned char)'x',false);
          
          w += b[X_AXIS].length ();
          ydims.unite (b[Y_AXIS]);
+         break;
        }
     }
   if (ydims.empty_b ())
@@ -72,7 +79,6 @@
 Font_metric::Font_metric (Font_metric const &)
 {
 }
-
 
 
 Box 
diff -urN ../lilypond-1.3.47/scripts/ly2dvi.py ./scripts/ly2dvi.py
--- ../lilypond-1.3.47/scripts/ly2dvi.py        Wed Apr 26 10:58:56 2000
+++ ./scripts/ly2dvi.py Thu Apr 27 22:40:50 2000
@@ -245,8 +245,6 @@
             pageheight = Props.get('pageheight')
             pagewidth = Props.get('pagewidth')
                                 
-        horizontalMarginArg =  ( (pagewidth - linewidth)/2 )   
-        verticalMarginArg =  ( (pageheight - textheight)/2  )
 
         top= r"""
 %% Creator: %s
@@ -265,16 +263,7 @@
 %%\headheight9pt
 %%\headsep0pt
 %% Maybe this is too drastic, but let us give it a try.
-\headheight0pt
-\headsep2mm
-\footskip2mm
-%%
-%%\addtolength{\oddsidemargin}{-1cm} 
-%%\addtolength{\topmargin}{-1cm} 
-%%\setlength{\textwidth}{%s} 
-%%\setlength{\textheight}{%s} 
-%%
-\geometry{width=%spt, left=%spt, height=%spt, top=%spt} 
+\geometry{width=%spt, height=%spt,headheight=2mm,headsep=0pt,footskip=2mm} 
 \input lilyponddefs 
 \input titledefs 
 %s
@@ -286,9 +275,8 @@
 \renewcommand{\@oddfoot}{\parbox{\textwidth}{\mbox{}\thefooter}}%%
 \begin{document}
 """ % ( program_id(), Props.get('filename'), now, Props.get('papersize'),
-        Props.get('language'), Props.get('pagenumber'), linewidth, textheight,
-        linewidth, horizontalMarginArg, textheight, verticalMarginArg,
-        Props.get('header') )
+        Props.get('language'), Props.get('pagenumber'), linewidth,
+        textheight, Props.get('header') )
         
         base, ext = os.path.splitext(file)
         this.__base = base

Reply via email to