source file of the GNU LilyPond music typesetter
(c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
+
+ Mats Bengtsson <matsb@s3.kth.se> (the ugly TeX parsing in text_dimension)
*/
#include <math.h>
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 ())
}
-
Box
Font_metric::get_char (int, bool)const
{
pageheight = Props.get('pageheight')
pagewidth = Props.get('pagewidth')
- horizontalMarginArg = ( (pagewidth - linewidth)/2 )
- verticalMarginArg = ( (pageheight - textheight)/2 )
top= r"""
%% Creator: %s
%%\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
\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