changeset 26:f492b70f5e49

Fix notename/line drawing. Remove superfluous state save call.
author Daniel O'Connor <darius@dons.net.au>
date Sat, 30 Apr 2016 16:57:02 +0930
parents ce367392806c
children 87cf66e04ef9
files musiccutter.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/musiccutter.py	Sat Apr 30 16:37:23 2016 +0930
+++ b/musiccutter.py	Sat Apr 30 16:57:02 2016 +0930
@@ -102,7 +102,6 @@
             # Add title and page number
             Midi2PDF.textHelper(pdf, 0 * mm, 1 * mm, ENGRAVE_COLOUR, True, self.fontname, self.fontsize, '%s (%d / %d)' % (title, pindx + 1, npages))
 
-            pdf.saveState() # Not really necessary since everything after this is done hairline
             pdf.setLineWidth(0)
 
             # Draw time marks
@@ -124,15 +123,15 @@
 
             # Draw lines per note
             for slot in sorted(self.slot2note.keys()):
-                ofs = (self.heel - self.slotsize / 2 + slot * self.pitch) * mm
+                ofs = self.pageheight - (self.heel + slot * self.pitch) - self.slotsize / 2
                 if self.notelines:
-                    pdf.line(0, ofs, self.pagewidth * mm, ofs)
+                    pdf.line(0, ofs * mm, self.pagewidth * mm, ofs * mm)
                 # Note name
                 if self.notenames:
-                    Midi2PDF.textHelper(pdf, (self.pagewidth - 10) * mm, ofs + 1 * mm, ENGRAVE_COLOUR, False, self.fontname, self.fontsize, self.slot2note[slot])
+                    Midi2PDF.textHelper(pdf, (self.pagewidth - 10) * mm, (ofs + 0.5) * mm, ENGRAVE_COLOUR, False, self.fontname, self.fontsize, self.slot2note[slot])
 
-                # Save PDF
-                pdf.save()
+            # Save PDF
+            pdf.save()
 
     # http://newt.phys.unsw.edu.au/jw/notes.html
     @staticmethod