[Top][All Lists]

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

PDF Named Destinations at each bar number

From: Amiel Heyde
Subject: PDF Named Destinations at each bar number
Date: Mon, 22 Mar 2010 00:54:24 +1100

Hi Everyone,

I am trying add a feature to Lilypond but I have looked through the code a fair amount and really have no idea what is going on. I'm hoping someone may be able to give me some pointers (no pun intended).

I am hoping to modify Lilypond so that a 'named destiation' pdfmark may be included in the postscript ouptut for each bar number. The aim is to be able to jump to any place in the music according to bar number. ie. going to the named destination 'bar.12' would move the music to the twelth bar.

From my very limited understanding of Lilypond and postscript I think I would need to write out a pdfmark line to the postscript on the correct page, and in that line I would need to include the bar number and it's x and y coordinates.

Could someone maybe suggest which areas of the code I would need to understand to achieve this, and how I might go about it?

I have been unable to find a good description of how lilypond works internally (at least in terms of laying out the music in postscript).

Any help would be appreciated, thanks.


Below is a few notes about what I have seen and have been trying so far.

I have been reading about pdfmarks and have added a new postscript function to create the required pdfmark in  (based on the mark_URI entry).
{   /name exch def
    /left exch def
    /top exch def
    [ /Dest name
      /View [ /XYZ x y NULL ]
    /DEST pdfmark
} bind def

I see that a mark_URI line is created in ouput-ps.scm like:
          (ly:format "~4f ~4f ~4f ~4f (textedit://~a:~a:~a:~a) mark_URI\n"
                 (+ (car offset) (car x-ext))
                 (+ (cdr offset) (car y-ext))
                 (+ (car offset) (cdr x-ext))
                 (+ (cdr offset) (cdr y-ext))

                 ;; Backslashes are not valid
                 ;; file URI path separators.
                   (ly:string-substitute "\\" "/" file))

                 (cadr location)
                 (caddr location)
                 (cadddr location))
So from that I figure I will probably need to have some code in output-ps.scm
to create the pdfmark in the ps file such as:

   (ly:format "~4f ~4f bar.~l mark_DEST_xy\n"
                 (<current bar number>))

where the <vars> are replaced by scheme which returns the relevent values.

I have no idea how to get these required values, or where to put this code snippet.

reply via email to

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