-%!PS-Adobe-1.0: lilyponddefs
+%!PS-Adobe-1.0: lilyponddefs.ps
%
% Functions for direct PostScript output
% hmm
% /setgray { 1 add } bind def
-/staff-line-thickness lilypondpaperstafflinethickness def
+% To let gs load fonts from builddir, do:
+% export GS_LIB=$(pwd)/mf/out:/usr/share/texmf/fonts/type1/bluesky/cm
+
+/staff-line-thickness lilypondpaperlinethickness def
/staff-height lilypondpaperstaffheight def
/line-width lilypondpaperlinewidth def
% FIXME: why isn't this set (by default) by lily?
% /text-height lilypondpapertextheight def
-/output-scale lilypondpaperoutputscale def
-/paper-size { lilypondpaperpapersize } bind def
+/lily-output-units 2.83464 def %% milimeter
+% /lily-output-units 0.996264 def %% true points.
-% FIXME
-% urg, read from paper block
-% fixed base line skip value, for single line staffs
-/base-line-skip lilypondpaperlineheight def
+/output-scale
+lilypondpaperoutputscale lily-output-units mul
+def
+/set-ps-scale-to-lily-scale
+{
+output-scale output-scale scale
+} bind def
+
+/paper-size { lilypondpaperpapersize } bind def
+
+%% FIXME: base-line-skip is too big, is this RIGHT?
+%% /base-line-skip lilypondpaperlineheight def
+/base-line-skip lilypondpaperlineheight lilypondpaperoutputscale div def
/init-paper {
gsave
%FIXME:
%vsize text-height sub 2 div /top-margin exch def
- 144 2 div /top-margin exch def
+ % 144 2 div /top-margin exch def
+ /top-margin 100 def
hsize line-width sub 2 div /left-margin exch def
grestore
} bind def
grestore
} bind def
-%
-% FIXME. translate to middle of box.
-%
+%% http://bibliofile.mc.duke.edu/gww/fonts/postscript-utilities/encoding-vectors.html
-/draw-box % breapth width depth height
-{
- /h exch def
- /d exch def
- /w exch def
- /b exch def
- gsave
-
- 0 setlinewidth
- b neg d neg rmoveto
- b w add 0 rlineto
- 0 d h add rlineto
- b w add neg 0 rlineto
- closepath % 0 d h add neg rlineto
- fill
-
- grestore
-} bind def
+%/FONTLENGTH 256 bind def
-/start-line % height
+%<font> <encoding> <name> reencode-font
+/reencode-dict 5 dict def
+/reencode-font
+{
+ reencode-dict
+ begin
+ /name exch def
+ /encoding exch def
+ /base-font exch def
+ % note: Needs ps level 2
+ /font base-font maxlength dict def
+ base-font {
+ exch dup dup /FID ne exch /Encoding ne and
+ { exch font 3 1 roll put }
+ { pop pop } ifelse
+ } forall
+ font /FontName name put
+ font /Encoding encoding put
+ name font definefont pop
+ end
+} bind def
+
+/start-system % height
{
dup base-line-skip gt {
/line-height exch def
line-x line-y translate
} bind def
-/stop-line
+/stop-system
{
/the-line exch def
the-line
% FIXME: font definitions should come from LilyPond
% built-in ps fonts are ugly
/huge-bold-font {
- /Times-Bold findfont 20.7 scalefont setfont
+ /Palatino-Bold findfont 20.7 scalefont setfont
} bind def
/Large-bold-font {
- /Times-Bold findfont 17.3 scalefont setfont
+ /Palatino-Bold findfont 17.3 scalefont setfont
} bind def
/large-bold-font {
- /Times-Bold findfont 14.4 scalefont setfont
+ /Palatino-Bold findfont 14.4 scalefont setfont
} bind def
/large-font {
- /Times-Roman findfont 14.4 scalefont setfont
+ /Palatino-Roman findfont 14.4 scalefont setfont
} bind def
/large-smallcaps-font {
% urg
- /Helvetica findfont 14.4 scalefont setfont
+ /Bookman-Light findfont 14.4 scalefont setfont
} bind def
/normal-font {
- /Times-Roman findfont 12 scalefont setfont
+ /Palatino-Roman findfont 12 scalefont setfont
} bind def
/footnote-font {
- /Times-Roman findfont 10 scalefont setfont
+ /Palatino-Roman findfont 10 scalefont setfont
} bind def
/get-text-dimensions % path .. width height
% initialise paper dimensions
staff-height init-paper
-/line-x left-margin def
+/line-x left-margin output-scale div def
/line-y vsize top-margin sub def
-make-lilypond-title
+% FIXME: testing \markup titles
+% make-lilypond-title
% see if we're there...
% 10 setlinewidth 0 0 moveto 400 800 lineto stroke
+
+% end lilyponddefs.ps