From f15b2ffdd283bacb74ba6db27f68dd26843a193f Mon Sep 17 00:00:00 2001 From: Mats Bengtsson Date: Sun, 30 Apr 2000 18:06:58 +0200 Subject: [PATCH] patch::: 1.3.47.mb1 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. --- CHANGES | 9 +++++++++ VERSION | 2 +- lily/font-metric.cc | 22 ++++++++++++++-------- scripts/ly2dvi.py | 18 +++--------------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/CHANGES b/CHANGES index ba1a1e5bdb..7bdea74a21 100644 --- a/CHANGES +++ b/CHANGES @@ -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 --git a/VERSION b/VERSION index 0a0477f199..9c4c574e39 100644 --- a/VERSION +++ b/VERSION @@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond 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 --git a/lily/font-metric.cc b/lily/font-metric.cc index 1f54aa5ead..f11483f8f0 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -4,7 +4,8 @@ source file of the GNU LilyPond music typesetter (c) 1999--2000 Han-Wen Nienhuys - + + Mats Bengtsson (the ugly TeX parsing in text_dimension) */ #include @@ -22,23 +23,29 @@ Font_metric::text_dimension (String text) const 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 ()) @@ -74,7 +81,6 @@ Font_metric::Font_metric (Font_metric const &) } - Box Font_metric::get_char (int, bool)const { diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 730273ea3c..e17b41b1f1 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -245,8 +245,6 @@ class TeXOutput: pageheight = Props.get('pageheight') pagewidth = Props.get('pagewidth') - horizontalMarginArg = ( (pagewidth - linewidth)/2 ) - verticalMarginArg = ( (pageheight - textheight)/2 ) top= r""" %% Creator: %s @@ -265,16 +263,7 @@ class TeXOutput: %%\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 @@ class TeXOutput: \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 -- 2.39.5