+1.3.144.jcn2
+============
+
+* Fixed ascii art output. Started some doco on different output formats.
+
+* Fixed scheme font lookup to handle new font lists with wildcards.
+
+* Bugfix: all-font-metrics.cc: don't assume that from each afm there's a tfm;
+only try to find/make tfm when producing tex output.
+
1.3.144.jcn1
============
* Tuning per grob ::
* What to tune?::
* Font selection::
-* Text markup::
+* Text markup::
* Embedded @TeX{}::
@end menu
should be printed is erased, with the effect of rendering it invisible.
The above assignment is available as a standard identifier, lest you
find this useful:
+
+@c FIXME: doesn't work well for eg StaffSymbol
@example
\property Voice.Stem = \turnOff
@end example
It is possible to use @TeX{} commands in the strings, but this should be
avoided because this makes it impossible for LilyPond to compute the
exact length of the string, which may lead to collisions. Also, @TeX{}
-commands won't work with direct postscript output.
+commands won't work with direct PostScript output (see @ref{PostScript
+output}).
@cindex metronome mark
}
@end lilypond
+@node Invisible grobs
+@subsection Invisible grobs
+@cindex invisible grobs
+
+A grob can be made invisible in a number of ways:
+
+@ignore
+FIXME
+
+Move \turnOff feature here and explain why it doesn't work for eg
+StaffSymbol
+
+Show molecule-callback override
+ StaffSymbol \override #'molecule-callback = #(lambda (x) '())
+
+Show visibility-lambda and explain why it doesn't work for eg
+StaffSymbol
+
+@end ignore
+
+
+Some grobs require a special treatment.
+
+Make staff invisible:
+@lilypond[singleline,verbatim}
+\score {
+ \notes { c4 c4 c8 c8 }
+ \paper {
+ \translator {
+ \StaffContext
+ \remove Staff_symbol_engraver;
+ \consists Pitch_squash_engraver;
+ \remove Clef_engraver;
+ }
+ }
+}
+@end lilypond
+
+Make bar lines invisible:
+@lilypond[singleline,verbatim}
+\score {
+ \notes \relative c'' {
+ a b c d
+ d c b a
+ }
+ \paper {
+ \translator {
+ \StaffContext
+ whichBar = #""
+ \remove "Time_signature_engraver";
+ }
+ }
+}
+
+
+@end lilypond
+
@node Embedded @TeX{}
@subsection Embeded @TeX{}
@cindex embedded tex
You can use @TeX{} commands in text scripts, but this should be avoided
because this makes it impossible for LilyPond to compute the exact
length of the string, which may lead to collisions. Also, @TeX{}
-commands won't work with direct PostScript output.
+commands won't work with direct PostScript output (see @ref{PostScript
+output}).
@lilypond[fragment,relative,verbatim]
a''^"3 $\\times$ \\`a deux"
details, see the example file @file{input/test/between-systems.ly}
+@c . {Output formats}
+@node Output formats
+@section Output formats
+
+LilyPond can output processed music in different output formats.
+
+@node @TeX{} output
+@section @TeX{} output
+@cindex @TeX{} output
+
+LilyPond will use @TeX{} by default. Even if you want to produce
+PostScript output for viewing or printing, you should normally have
+LilyPond produce @TeX{} first. The .tex output must be processed by
+@TeX{} (@strong{not} La@TeX{}) to generate a .dvi. Then, @file{Dvips}
+is used to generate PostScript. Alternatively, @file{ly2dvi} can be
+used to generate the .dvi for you.
+
+
+@node PostScript output
+@section PostScript output
+@cindex PostScript output
+@cindex direct PostScript output
+
+LilyPond can produce PostScript directly, without going through @TeX{}.
+Direct PostScript output has some problems, though.
+
+@example
+$ lilypond -fps foo.ly
+GNU LilyPond 1.3.144
+Now processing: `foo.ly'
+Parsing...
+Interpreting music...[3]
+Preprocessing elements...
+Calculating column positions...
+paper output to foo.ps...
+$ cat /usr/share/lilypond/pfa/feta20.pfa foo.ps | lpr
+@end example
+
+
+@refbugs
+
+Text font selection is broken.
+
+The .ps file does not contain the .pfa font files. To print a .ps
+created through direct postscript output, you should prepend the
+necessary .pfa files to LilyPond's .ps output, or upload them to the
+printer before printing.
+
+Titling is not generated. FIXME: adding titling should not be too
+difficult.
+
+
+@node Scheme output
+@section Scheme output
+@cindex Scheme output
+
+[TODO]
+
+@example
+$ lilypond -fscm foo.ly
+GNU LilyPond 1.3.144
+Now processing: `foo.ly'
+Parsing...
+Interpreting music...[3]
+Preprocessing elements...
+Calculating column positions...
+paper output to foo.scm...
+
+$ head -4 foo.scm
+;;; Usage: guile -s x.scm > x.tex
+ (primitive-load-path 'standalone.scm)
+; (scm-tex-output)
+ (scm-ps-output)
+
+$ guile -s foo.scm > foo.tex
+@end example
+
+
+@node AsciiScript output
+@section AsciiScript output
+@cindex AsciiScript output
+@cindex ascii script
+@cindex ascii art
+
+LilyPond can output Ascii Art. This is a two step process, LilyPond
+produces an ascii description file, dubbed AsciiScript (extension
+@file{.as}). AsciiScript has a small and simple command set that
+includes font selection, character and string printing and line drawing
+commands. The program @file{as2text} is used to translate an .as file
+to text.
+
+To produce ascii art, you must include an ascii art paper definition
+file in your .ly, one of:
+@example
+\include "paper-as5.ly"
+\include "paper-as9.ly"
+@end example
+
+Here's an example use for Ascii Art output (the example file
+@file{as-email.ly} is included in the LilyPond distribution), the staff
+symbol has been made invisible:
+
+@example
+To: bug-gnu-music@@gnu.org
+Subject: LilyPond-1.3.144 beaming broken in 5/8 time
+Gcc: nnml:sent
+--------
+Hi List,
+
+Subject says it all.
+
+$ lilypond -fas as-email.ly
+GNU LilyPond 1.3.144
+Now processing: `as-email.ly'
+Parsing...
+Interpreting music...[3]
+Preprocessing elements...
+Calculating column positions... [2]
+paper output to as-email.as...
+
+$ as2text as-email.as 2>/dev/null
+ |\
+ |/ |##|##| | | | | |
+ /| | | | | |\ |\ |\ |\ |\ |
+ / |_ 3 | | | | 5 | )| )| )| )| )|
+ | /| \ 8 * * * | 8 * * * * * |
+ \_|_/ | |
+ *_|
+
+ lily
+@end example
+
+
+@refbugs
+The ascii art fonts are far from complete and not very well designed.
+Lots of resizable symbols such as slurs, ties, tuplets are missing.
@c . {Sound}
MAJOR_VERSION=1
MINOR_VERSION=3
PATCH_LEVEL=144
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=jcn2
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+
+% ascii art
+
+\include "paper-as5.ly"
+
+\score {
+ \notes\relative c'' {
+ \time 3/8;
+ a8 a a
+ \time 5/8;
+ a a a a a
+ %a16 a a a a a a a a a
+ }
+ \paper {
+ linewidth = -1.;
+ \translator {
+ \StaffContext
+ StaffSymbol \override #'molecule-callback = #(lambda (x) '())
+ }
+ }
+}
+
--- /dev/null
+% ascii art output
+%
+% Process as:
+%
+% lilypond -fas foo.ly
+% as2text foo.as
+
+\include "paper-as5.ly"
+
+\score {
+ \notes\relative c'' {
+ \time 4/4;
+ g1 a b c
+ g2 a b c
+ g4 a b c
+ }
+ \paper {
+ \translator {
+ \StaffContext
+ BarLine \override #'bar-size = #5
+ }
+ }
+}
+
--- /dev/null
+% ascii art output
+%
+% Process as:
+%
+% lilypond -fas foo.ly
+% as2text foo.as
+
+\include "paper-as9.ly"
+
+\score {
+ \notes\relative c'' {
+ \time 4/4;
+ g1 a b c
+ g2 a b c
+ g4 a b c
+ }
+}
+
-
-% ascii art
-
-\include "paper-as5.ly"
-
-\score {
- \notes\relative c''{
- \time 4/4;
- g1 a b c
- g2 a b c
- g4 a b c
- }
- \paper {
- \paperAs_five
- \translator { \StaffContext barSize = #5 }
- }
-
-}
-
+% ascii art output
+%
+% Process as:
+%
+% lilypond -fas foo.ly
+% as2text foo.as
+
+\include "paper-as5.ly"
\score{
- <
- \context Staff \notes\relative c'{
- c d e f
- \repeat "volta" 2 { g a b c }
- \alternative { { c b a g } { f e d c } }
- }
- \context Lyrics \lyrics {
- De eer- ste < { maat } { moet } >
- \repeat fold 2 { }
- \alternative {
- { en dan twee keer }
- { een koe- plet _ }
- }
- en dan nog dit er ach- ter aan
- }
- >
+ <
+ \context Staff \notes\relative c'{
+ c d e f
+ \repeat "volta" 2 { g a b c }
+ \alternative { { c b a g } { f e d c } }
+ }
+ \context Lyrics \lyrics {
+ De eer- ste < { maat } { moet } >
+ \repeat fold 2 { }
+ \alternative {
+ { en dan twee keer }
+ { een koe- plet _ }
+ }
+ en dan nog dit er ach- ter aan
+ }
+ >
}
-
-% asci art output
-
+% ascii art output
+%
+% Process as:
+%
+% lilypond -fas foo.ly
+% as2text foo.as
\include "paper-as5.ly"
\score {
- \context StaffGroup <
- \context Staff=upper \notes\relative c{
- \key f \major;
- \time 3/4;
- r8^"Moderato" %\pp
- <g'-. c-.> <c-. es-.> <g-. c-.> <c-. es-.> <g-. c-.> |
- r8 <as-. c-.> <c-. es-.>
- }
- \context Staff=lower \notes\relative c{
- \key f \major;
- \time 3/4;
- \clef "bass";
- <c,2 c'> r4
- <as2 as'> r4
- }
- >
- \paper {
-% \paperAs_nine
- indent=4.0\char;
- linewidth=78.0\char;
- \translator { \StaffContext barSize = #4.5 }
- %\translator { \VoiceContext beamHeight = #0 }
- \translator {
- \VoiceContext
- beamHeight = ##f
- autoBeamSettings \override (begin * * * *) = #(make-moment 0 1)
- textNonEmpty = ##f
- }
- }
-
+ \context StaffGroup <
+ \context Staff=upper \notes\relative c{
+ \key f \major;
+ \time 3/4;
+ r8^"Moderato" %\pp
+ <g'-. c-.> <c-. es-.> <g-. c-.> <c-. es-.> <g-. c-.> |
+ r8 <as-. c-.> <c-. es-.>
+ }
+ \context Staff=lower \notes\relative c{
+ \key f \major;
+ \time 3/4;
+ \clef "bass";
+ <c,2 c'> r4
+ <as2 as'> r4
+ }
+ >
+ \paper {
+ indent=4.0\char;
+ linewidth=78.0\char;
+ \translator { \StaffContext Bar \override #'bar-size = #5 }
+ \translator {
+ \VoiceContext
+ % horizontal beams
+ Beam \override #'height = #0
+ autoBeamSettings \override #'(begin * * * *) = #(make-moment 0 1)
+ textNonEmpty = ##f
+ }
+ }
}
+% ascii art output
+%
+% Process as:
+%
+% lilypond -fas foo.ly
+% as2text foo.as
-% asci-art output, TODO: include how-to-use-this
+% FIXME: broken system-start-delimiter.cc:staff_brace lookup
\include "paper-as9.ly"
\score {
- \context GrandStaff <
- \context Staff=upper \notes\relative c{
- \key f \major;
- \time 3/4;
- r8^"Moderato" %\pp
- <g'-. c-.> <c-. es-.> <g-. c-.> <c-. es-.> <g-. c-.> |
- r8 <as-. c-.> <c-. es-.>
- }
- \context Staff=lower \notes\relative c{
- \key f \major;
- \time 3/4;
- \clef "bass";
- <c,2 c'> r4
- <as2 as'> r4
- }
- >
- \paper {
-% \paperAs_nine
- indent=4.0\char;
- linewidth=78.0\char;
- %\translator { \StaffContext barSize = #9 }
- %\translator { \VoiceContext beamHeight = #0 }
- \translator {
- \VoiceContext
- beamHeight = ##f
- autoBeamSettings \override #(begin * * * *) = #(make-moment 0 1)
- textNonEmpty = ##f
- }
- }
-
+ \context GrandStaff <
+ \context Staff=upper \notes\relative c{
+ \key f \major;
+ \time 3/4;
+ r8^"Moderato" %\pp
+ <g'-. c-.> <c-. es-.> <g-. c-.> <c-. es-.> <g-. c-.> |
+ r8 <as-. c-.> <c-. es-.>
+ }
+ \context Staff=lower \notes\relative c{
+ \key f \major;
+ \time 3/4;
+ \clef "bass";
+ <c,2 c'> r4
+ <as2 as'> r4
+ }
+ >
+ \paper {
+ indent=4.0\char;
+ linewidth=78.0\char;
+ \translator {
+ \VoiceContext
+ % horizontal beams
+ Beam \override #'height = #0
+ autoBeamSettings \override #'(begin * * * *) = #(make-moment 0 1)
+ textNonEmpty = ##f
+ }
+ }
}
% ascii art output
-
+%
+% Process as:
+%
+% lilypond -fas foo.ly
+% as2text foo.as
+
+
\header{
filename = "twinkle.ly";
title = "Twinkle Twinkle Little Star";
NoteHead \override #'font-relative-size = #-2
NoteHead \override #'font-relative-size = #-2
- Stem \override #'flag-style = ##f
+ Stem \override #'flag-style = #""
% The following determines the length of stems without beams
% default is between 2.8 and 4.0 depending on the number of flags
Stem \override #'length = #6
}
\translator { \StaffContext
- TimeSignature \override #'style = #"C4/4"
- TimeSignature \override #'visibility-function = #begin-of-line-visible
+ TimeSignature \override #'style = #'C4/4
+% TimeSignature \override #'visibility-function = #begin-of-line-visible
+ TimeSignature \override #'visibility-lambda = #begin-of-line-visible
}
}
Adobe_font_metric *afm
= dynamic_cast<Adobe_font_metric*> (unsmob_metrics (val));
- Tex_font_metric * tfm = find_tfm (name);
- if (tfm->info_.checksum != afm->checksum_)
+ if (output_format_global == "tex")
{
- String s = _f ("checksum mismatch for font file: `%s'",
- path.ch_C ());
- s += " " + _f ("does not match: `%s'", tfm->path_.ch_C ()); // FIXME
- s += "\n";
- s += " TFM: " + to_str ((int) tfm->info_.checksum);
- s += " AFM: " + to_str ((int) afm->checksum_);
- s += "\n";
- s += _ (" Rebuild all .afm files, and remove all .pk and .tfm files. Rerun with -V to show font paths.");
-
- error (s);
+ Tex_font_metric * tfm = find_tfm (name);
+
+ /* FIXME: better warning message
+ (maybe check upon startup for feta16.afm, feta16.tfm?)
+ */
+ if (tfm && tfm->info_.checksum != afm->checksum_)
+ {
+ String s = _f ("checksum mismatch for font file: `%s'",
+ path.ch_C ());
+ s += " " + _f ("does not match: `%s'", tfm->path_.ch_C ()); // FIXME
+ s += "\n";
+ s += " TFM: " + to_str ((int) tfm->info_.checksum);
+ s += " AFM: " + to_str ((int) afm->checksum_);
+ s += "\n";
+ s += _ (" Rebuild all .afm files, and remove all .pk and .tfm files. Rerun with -V to show font paths.");
+
+ error (s);
+ }
}
}
Molecule
System_start_delimiter::staff_brace (Grob*me,Real y)
{
+
+ /*
+ FIXME: should look at afm/tfm file for dimensions.
+
+ (This breaks ascii-art output: it hasn't got 255 symbols)
+ */
+
+ // ugrhn
int lo = 0;
int hi = 255;
+
Font_metric *fm = Font_interface::get_default_font (me);
Box b;
-breve = \duration #(make-duration -1 0)
-longa = \duration #(make-duration -2 0 )
-maxima = \duration #(make-duration -3 0)
-
-\include "nederlands.ly" % dutch
-\include "chord-modifiers.ly"
-\include "script.ly"
-
-% declarations for standard directions
-left = -1
-right = 1
-up = 1
-down = -1
-start = -1
-stop = 1
-smaller = -1
-bigger = 1
-center=0
-
-break = \penalty -1000000;
-noBreak = \penalty 1000000;
-\include "scale-definitions.ly"
-
-melisma = \property Staff.melismaBusy = ##t
-melismaEnd = \property Staff.melismaBusy = ##f
-papersize = "a4"
-
-\include "engraver.ly"
-\include "generic-paper.ly"
-\include "paper-as9.ly"
-
-% ugh
-\include "midi.ly"
-
-\include "dynamic-scripts.ly"
-\include "spanners.ly"
-
-\include "property.ly"
-
-
-unusedEntry = \notes { c4 } % reset default duration
-
-% music = "\melodic\relative c"
-
-% Toplevel AsciiScript initialisation file.
-
-\version "1.3.120";
-
-\include "declarations-as.ly"
-
-% burp. need to override lily.scm
-#(define cmr-alist
- '(("bold" . "as-dummy")
- ("brace" . "as-braces")
- ("dynamic" . "as-dummy")
- ("default" . "as-dummy")
- ("feta" . "feta")
- ("feta-1" . "feta")
- ("feta-2" . "feta")
- ("finger" . "as-number")
- ("typewriter" . "as-dummy")
- ("italic" . "as-dummy")
- ("roman" . "as-dummy")
- ("script" . "as-dummy")
- ("large" . "as-dummy")
- ("Large" . "as-dummy")
- ("mark" . "as-number")
- ("number" . "as-number")
- ("timesig" . "as-number")
- ("volta" . "as-number"))
-)
-
-\paper {
- \paperAsNine
- \translator { \StaffContext barSize = \staffheight; }
-
- % no beam-slope
- %\translator { \VoiceContext beamHeight = #0; }
-}
-
-\maininput
-
paperAsFive = \paper {
staffheight = 5.\char;
- %% aiai only have these:
-%{
- mf/as5.af
- mf/as9.af
- mf/as-braces5.af
- mf/as-braces9.af
- mf/as-dummy1.af
- mf/as-dummy.af
- mf/as-number1.af
- mf/as-number4.af
-%}
+
+ \stylesheet #(as-make-style-sheet 'as5)
- \stylesheet #(make-style-sheet 'paper16)
+ \translator { \StaffContext barSize = \staffheight; }
+ % no beam-slope
+ %\translator { \VoiceContext beamHeight = #0; }
\include "params-as.ly";
}
paperAsNine = \paper {
staffheight = 9.\char;
- %% aiai only have these:
-%{
- mf/as5.af
- mf/as9.af
- mf/as-braces5.af
- mf/as-braces9.af
- mf/as-dummy1.af
- mf/as-dummy.af
- mf/as-number1.af
- mf/as-number4.af
-%}
- \stylesheet #(make-style-sheet 'paper16)
-
+
+ %\translator { \StaffContext barSize = \staffheight; }
+
+ \stylesheet #(as-make-style-sheet 'as9)
\include "params-as.ly";
+
}
\paper { \paperAsNine }
% params-as.ly
% generic paper parameters
-%%paperfile = \papersize + ".ly";
-%%% paperfile = "a4.ly";
-%%\include \paperfile;
-%hsize = 60.0\char;
-%vsize = 60.0\char; %?
+outputscale = \staffheight / 4.0;
-%%\include "paper.ly";
-linewidth = 60.0\char;
-textheight = 60.0\char;
+linewidth = 60.0 \char;
+textheight = 60.0 \char;
indent = 8.0\char;
staffspace = (\staffheight - 1.0 ) / 4.0;
stafflinethickness = \staffspace / 2.0;
-% paperfile = "a4.ly";
-%\include \paperfile;
-%\include "paper.ly";
-
-%staffspace = \staffheight / 4.0;
-%stafflinethickness = \staffspace / 10.0;
-
-outputscale = \staffheight / 4.0;
-
\translator { \NoteNamesContext }
\translator { \ScoreContext }
\translator { \ChoirStaffContext }
# even if documentation fails to build
make -C Documentation || true
-make htmldoc || true
+make web || true
%install
#%install documentation
#line 63: second %install
# again, make sure that main package installs even if doco fails
-mkdir -p htmldocs/out
-tar -C htmldocs -xzf out/htmldoc.tar.gz || true
-mkdir -p out/examples/
-tar -cf - input/ | tar -C out/examples/ -xf- || true
+mkdir -p web/out
+tar -C web -xzf out/web.tar.gz || true
%ifos cygwin
# urg, this symlink doesn't come through on cygwin
# this gets too messy...
# %doc input/*.ly
# verbatim include of input: list the directory without issuing a %dir
-%doc htmldocs/
-%doc out/examples/
-%doc mutopia/
+%doc web/
4
\f C 53; WX 1; N Numeral-5; B 0 0 1000 1000;
5
-\f C 53; WX 1; N Numeral-6; B 0 0 1000 1000;
+\f C 54; WX 1; N Numeral-6; B 0 0 1000 1000;
6
-\f C 53; WX 1; N Numeral-7; B 0 0 1000 1000;
+\f C 55; WX 1; N Numeral-7; B 0 0 1000 1000;
7
-\f C 53; WX 1; N Numeral-8; B 0 0 1000 1000;
+\f C 56; WX 1; N Numeral-8; B 0 0 1000 1000;
8
-\f C 53; WX 1; N Numeral-9; B 0 0 1000 1000;
+\f C 57; WX 1; N Numeral-9; B 0 0 1000 1000;
9
EndCharMetrics
EndFontMetrics %d
(___
\
.___/
-\f C 53; WX 1; N Numeral-6; B 0 1000 5000 5000;
+\f C 54; WX 1; N Numeral-6; B 0 1000 5000 5000;
___
/__
/ \
\___/
-\f C 53; WX 1; N Numeral-7; B 0 1000 5000 5000;
+\f C 55; WX 1; N Numeral-7; B 0 1000 5000 5000;
____
/
-/-
/
-\f C 53; WX 1; N Numeral-8; B 0 1000 5000 5000;
+\f C 56; WX 1; N Numeral-8; B 0 1000 5000 5000;
__
(__)
/ \
\____/
-\f C 53; WX 1; N Numeral-9; B 0 1000 5000 5000;
+\f C 57; WX 1; N Numeral-9; B 0 1000 5000 5000;
___
/ \
\___/
(debug-enable 'backtrace)
-;;;; AsciiScript as
+; (define cmr-alist
+; '(("bold" . "as-dummy")
+; ("brace" . "as-braces")
+; ("dynamic" . "as-dummy")
+; ("default" . "as-dummy")
+; ("feta" . "feta")
+; ("feta-1" . "feta")
+; ("feta-2" . "feta")
+; ("finger" . "as-number")
+; ("typewriter" . "as-dummy")
+; ("italic" . "as-dummy")
+; ("roman" . "as-dummy")
+; ("script" . "as-dummy")
+; ("large" . "as-dummy")
+; ("Large" . "as-dummy")
+; ("mark" . "as-number")
+; ("number" . "as-number")
+; ("timesig" . "as-number")
+; ("volta" . "as-number"))
+; )
+
+
+(define as-font-alist-alist
+ '(
+ (as5 .
+ (
+ (feta16 . as5)
+ (feta20 . as5)
+ (feta-nummer6 . as-number1)
+ (feta-nummer8 . as-number1)
+ (feta-braces16 . as-braces9)
+ (cmr7 . as-dummy)
+ (cmr8 . as-dummy)
+ (cmr10 . as-dummy)
+ ))
+ (as9 .
+ (
+ (feta16 . as9)
+ (feta20 . as9)
+ (feta-nummer4 . as-number1)
+ (feta-nummer8 . as-number4)
+ (feta-braces16 . as-braces9)
+ (cmr7 . as-dummy)
+ (cmr8 . as-dummy)
+ (cmr10 . as-dummy)
+ (cmr12 . as-dummy)
+ ))
+ ))
+
+(define (as-properties-to-font-name size fonts properties-alist-list)
+ (let* ((feta-name (properties-to-font-name fonts properties-alist-list))
+ (as-font-alist (cdr (assoc size as-font-alist-alist)))
+ (font (assoc (string->symbol feta-name) as-font-alist)))
+ (if font (symbol->string (cdr font))
+ (let ((e (current-error-port)))
+ (newline e)
+ (display "can't find font: " e)
+ (write feta-name e)
+ ;;(symbol->string size)
+ "as-dummy"
+ ))))
+
+;; FIXME: making a full style-sheet is a pain, so we parasite on
+;; paper16 and translate the result.
+;;
+(define (as-make-style-sheet size)
+ (let ((sheet (make-style-sheet 'paper16)))
+ (assoc-set! sheet 'properties-to-font
+ (lambda (x y) (as-properties-to-font-name size x y)))
+ sheet))
+
+;;;; AsciiScript as -- ascii art output
(define (as-scm action-name)
(define (beam width slope thick)
(func "rmove-to" (- dx 1) (if (< 0 dir) -1 0))
(func "put" (if (< 0 dir) "\\\\" "/"))))))
- (define (bracket arch_angle arch_width arch_height width height arch_thick thick)
+
+ (define (bracket arch_angle arch_width arch_height height arch_thick thick)
+ ;; width now fixed?
+ (let ((width 1))
(string-append
(func "rmove-to" (+ width 1) (- (/ height -2) 1))
(func "put" "\\\\")
(func "v-line" (+ height 1))
(func "rmove-to" 0 (+ height 1))
(func "put" "/")
- ))
+ )))
(define (char i)
(func "char" i))
(func "h-line" dx))))))
(define (font-load-command name-mag command)
+ ;; (display "name-mag: ")
+ ;; (write name-mag)
+ ;; (display "command: ")
+ ;; (write command)
(func "load-font" (car name-mag) (cdr name-mag)))
(define (header creator generate)
(string-append "(define " key " " (arg->string val) ")\n"))
(define (lily-def key val)
- (if
- (or (equal? key "lilypondpaperlinewidth")
- (equal? key "lilypondpaperstaffheight"))
- (string-append "(define " key " " (arg->string val) ")\n")
- ""))
+ (if
+ ;; let's not have all bloody definitions
+ (or (equal? key "lilypondpaperlinewidth")
+ (equal? key "lilypondpaperstaffheight")
+ (equal? key "lilypondpaperoutputscale"))
+ (string-append "(define " key " " (arg->string val) ")\n")
+ ""))
(define (no-origin) "")
;; (also tried to vary the order of this list, with little effect)
(define paper20-style-sheet-alist
'(
+ ;; why are font-names strings, not symbols?
((3 medium upright number feta-nummer 13) . "feta-nummer13")
((2 medium upright number feta-nummer 13) . "feta-nummer13")
((1 medium upright number feta-nummer 11) . "feta-nummer11")
)
))
+(define (wild-eq? x y)
+ (or (eq? x y)
+ (eq? x '*)
+ (eq? y '*)))
+
(define (font-qualifies? qualifiers font-desc)
"does FONT-DESC satisfy QUALIFIERS?"
(if (null? qualifiers) #t
- (if (eq? (font-field (caar qualifiers) font-desc) (cdar qualifiers))
+ (if (wild-eq? (font-field (caar qualifiers) font-desc) (cdar qualifiers))
(font-qualifies? (cdr qualifiers) font-desc)
- #f
- )
- )
- )
+ #f)))
(define (find-first-font qualifiers fonts)
(if (null? fonts)
(define (chain-assoc x alist-list)
(if (null? alist-list)
#f
- (let* (
- (handle (assoc x (car alist-list)))
- )
+ (let* ((handle (assoc x (car alist-list))))
(if (pair? handle)
handle
- (chain-assoc x (cdr alist-list))
- )
- )
- )
- )
+ (chain-assoc x (cdr alist-list))))))
;; TODO
;; the C++ version in font-interface.cc is usually used.
+;;
+;; FIXME: this has silently been broken by the introduction
+;; of wildcards in the font list.
(define (properties-to-font-name fonts properties-alist-list)
(let* (
;; change order to change priorities of qualifiers.
- (q-order '(font-name font-family font-series font-shape font-design-size font-relative-size))
- (rawqualifiers (map (lambda (x) (chain-assoc x properties-alist-list))
+ (q-order '(font-name font-family font-series font-shape
+ font-design-size font-relative-size))
+ (rawqualifiers (map (lambda (x)
+ (chain-assoc x properties-alist-list))
q-order))
(qualifiers (filter-list pair? rawqualifiers))
- (selected (find-first-font qualifiers fonts))
- (err (current-error-port))
- )
+ (selected (find-first-font qualifiers fonts))
+ (err (current-error-port)))
(if (equal? selected "")
(begin
;;; Un-assorted stuff
-;; URG guile-1.3/1.4 compatibility
+;; URG guile-1.4/1.4.x compatibility
(define (ly-eval x) (eval2 x #f))
(define (sign x)
(if (< x 0) -1 1)))
-;;(define major-scale
-;; '(
-;; (0 . 0)
-;; (1 . 0)
-;; (2 . 0)
-;; (3 . 0)
-;; (4 . 0)
-;; (5 . 0)
-;; (6 . 0)
-;; ))
-
-
(map (lambda (x) (eval-string (ly-gulp-file x)))
'("output-lib.scm"
"tex.scm"
(define first-line #t)
+(define scaling 1)
+
;; cursor
(define cur-x 0)
(define cur-y 0)
(cond ((equal? new " ") old)
(else new)))
-(define (plot x y c)
- (let ((ny (- (* -1 y) 1)))
- (if (array-in-bounds? canvas ny x)
- (array-set! canvas (merge-chars (array-ref canvas ny x) c) ny x)
- (display (string-append "ouch: " (number->string x) ","
- (number->string ny) "\n")))))
+(define (plot-raw x y c)
+ (if (array-in-bounds? canvas y x)
+ (array-set! canvas (merge-chars (array-ref canvas y x) c) y x)
+ (display (string-append "ouch: " (number->string x) ","
+ (number->string y) "\n")
+ (current-error-port))))
+
+(define (plot x neg-y c)
+ (let ((y (- (* -1 neg-y) 1)))
+ (plot-raw (inexact->exact x) (inexact->exact y) c)))
(define (plot-char c)
(let ((bbox (car c))
- (glyph (cadr c)))
- ;; BBox: (llx lly urx ury) * 1000
- (let ((dx (inexact->exact (* .001 (car bbox))))
- ;(dy (inexact->exact (* .001 (cadr bbox))))
- (dy (inexact->exact (- (* .001 (cadddr bbox)) 1)))
- (len (length glyph)))
- ;;(display "Bbox: ") (display bbox) (newline)
- ;;(display "dy: ") (display dy) (newline)
- (do ((line glyph (cdr line))
- (i 0 (+ i 1)))
- ((= i len))
- (plot-string (+ cur-x dx) (+ (- cur-y i) dy) (car line))))))
-
+ (glyph (cadr c))
+ (scur-x (* scaling cur-x))
+ (scur-y (* scaling cur-y)))
+ ;; BBox: (llx lly urx ury) * 1000
+ (let ((dx (inexact->exact (* .001 (car bbox))))
+ ;;(dy (inexact->exact (* .001 (cadr bbox))))
+ (dy (inexact->exact (- (* .001 (cadddr bbox)) 1)))
+ (len (length glyph)))
+ ;;(display "Bbox: ") (display bbox) (newline)
+ ;;(display "dy: ") (display dy) (newline)
+ (do ((line glyph (cdr line))
+ (i 0 (+ i 1)))
+ ((= i len))
+ (plot-string (+ scur-x dx) (+ (- scur-y i) dy) (car line))))))
+
(define (plot-string x y s)
(do ((i 0 (+ i 1)))
((= i (string-length s)))
- (plot (+ x i) y (substring s i (+ i 1)))))
+ (plot (+ x i) y (substring s i (+ i 1)))))
(define (show-char char)
(display char))
(assoc (+ n 0.5) font))
(get-char font (+ n 0.5))
(get-char font n))))
- (if c
+ (if (pair? c)
(plot-char c))))
(define (end-output)
(close cur-output-file)
(set! cur-output-file '()))
+;; use plot-string
(define (h-line len)
- (let ((step (sign len)))
- (do ((i 0 (+ i step)))
- ((= i len))
- (plot (+ cur-x i) cur-y line-char))))
+ (let ((scur-x (* scaling cur-x))
+ (scur-y (* scaling cur-y))
+ (slen (* scaling len)))
+ (let ((step (sign len)))
+ (do ((i 0 (+ i step)))
+ ((= i slen))
+ (plot (+ scur-x i) scur-y line-char)))))
(define (v-line len)
- (let ((step (sign len)))
- (do ((i 0 (+ i step)))
- ((= i len)) (plot cur-x (+ cur-y i) line-char))))
+ (let ((scur-x (* scaling cur-x))
+ (scur-y (* scaling cur-y))
+ (slen (* scaling len)))
+ (let ((step (sign len)))
+ (do ((i 0 (+ i step)))
+ ((= i len))
+ (plot scur-x (+ scur-y i) line-char)))))
(define (header x y)
;(display (string-append x y "\n") (current-error-port))
(define (header-end) "")
+;; FIXME: scale
(define (rline-to dx dy)
(plot (inexact->exact cur-x) (inexact->exact cur-y) line-char)
(plot (inexact->exact (+ cur-x dx)) (inexact->exact (+ cur-y dy)) line-char)
(begin
(set! fonts (cons (cons "default" (generate-default-font)) fonts))
(display "\n" (current-error-port))
- (if (and (defined? 'lilypondpaperlinewidth)
- (> (string->number lilypondpaperlinewidth) 0))
- (set! canvas-width
- (inexact->exact (string->number lilypondpaperlinewidth))))))
- (set! canvas-height height)
+ (if (defined? 'lilypondpaperoutputscale)
+ (set! scaling (inexact->exact (string->number lilypondpaperoutputscale))))
+ (if (defined? 'lilypondpaperlinewidth)
+ (let ((width (inexact->exact
+ (string->number lilypondpaperlinewidth))))
+ (if (> width 0)
+ (set! canvas-width width)
+ ;; need long line...
+ ;;(set! canvas-width 200)
+ (set! canvas-width 80)
+ )))
+ ))
+ (set! canvas-height (inexact->exact (* scaling height)))
(set! canvas (make-array " " canvas-height canvas-width)))
(define (stop-line)
((= i n))
(let* ((n (char->integer (string-ref s i)))
(c (get-char font n)))
- (plot-char c)
+ (if (pair? c) (plot-char c))
(rmove-to (char-width c) 0)))))