[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Improvements to Postscript backend (patches included)

From: Han-Wen Nienhuys
Subject: Re: Improvements to Postscript backend (patches included)
Date: Tue, 28 Mar 2006 12:37:15 +0200
User-agent: Thunderbird 1.5 (X11/20060313)

David Feuer wrote:
I sent this some hours ago, but haven't seen it yet.  Is the mailing list
broken, or just really slow?

The list is a bit slow, and I have been away.

Original message:

I made some changes to the Postscript backend, making the output more readable
(especially for text), around 10% shorter, and, at least in theory, also faster
to interpret.  These changes are just a start, but I hope they help.  I'd like
to know if it might be possible to make the backend work at a slightly higher
level, which should allow much smaller files (e.g., Postscript could easily
understand the concept of "filled dotted quarter note in current note font with
upward stem 3 staff spaces long").

That's very unlikely. The internal representation is not strictly hierarchical, so it's difficult to group different objects (eg. note and stem) so they will be output together, and still be sure that all of them are processed.

I'm not a master of diff, so let me know if the following aren't done right.
Diffs (made with -u) against the 2.8.0 source:

I'm missing a Changelog entry.

--- ../Installation
Programs/lilypond-2.8.0-src/lilypond-2.8.0/scm/framework-ps.scm     2006-03-20
19:45:18.000000000 -0500
+++ framework-ps.scm    2006-03-25 18:25:43.875475200 -0500
@@ -42,8 +42,10 @@
   (define font-list (ly:paper-fonts paper))
   (define (define-font command fontname scaling)
-     "/" command " { /" fontname " findfont "
-     (ly:number->string scaling) " output-scale div scalefont } bind def\n"))
+      "/" command " { /" fontname " " (ly:number->string scaling) "
output-scale div selectfont } bind def\n"))
+;    (string-append
+;     "/" command " { /" fontname " findfont "
+;     (ly:number->string scaling) " output-scale div scalefont } bind def\n"))


thanks for you patch. CAn you have a second look; there are some style issues,

+/printletter {
+       currentpoint
+       3 2 roll
+       glyphshow
+       moveto
+} bind def
+/printglyphs {
+       -1 1
+       {
+               3 mul -3 roll
+               printletter
+               rmoveto
+       }for
+}bind def

can you add some comment explaining in more detail that this is for kerning? Also, can you follow the naming convention, which is word_word iso. wordword for PS files.

(I'd like to change this to word-word, some time)

+(define (round2 num)
+  (/ (round (* 100 num)) 100))
+(define (round4 num)
+  (/ (round (* 10000 num)) 10000))
+(define (str4 num)
+  (format #f "~f" (round4 num)))

can you rename this to something more comprehensible?

+;;  s/\.\([0-9]\{-}\)0* /\1 /g


(format #f "gsave - /~a ~a ~a output-scale div scalefont setfont\n~a grestore"
+  /~a ~a output-scale div selectfont\n~a grestore"
-         (if cid?
-             " /CIDFont findresource "
-             " findfont")

I don't understand this? How are CID resources supposed to be loaded now?

 (define (named-glyph font glyph)
(string-append - (ps-font-command font) " setfont " + (ps-font-command font) " " "/" glyph " glyphshow "))

While you're at it, I think it would improve readability of the SCM file when you try to replace string-append in cases like these.


Han-Wen Nienhuys - address@hidden -

LilyPond Software Design
 -- Code for Music Notation

reply via email to

[Prev in Thread] Current Thread [Next in Thread]