From: Jan Nieuwenhuizen Date: Thu, 17 Mar 2005 22:18:03 +0000 (+0000) Subject: * python/lilylib.py (make_ps_images): X-Git-Tag: release/2.5.16~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8ecf19521cf55ad4084a0a87ad6a26339431614f;p=lilypond.git * python/lilylib.py (make_ps_images): * scripts/ps2png.py (copyright): Grok --papersize option. * scm/backend-library.scm (postscript->png): Add parameter PAPERSIZE. Update callers. --- diff --git a/ChangeLog b/ChangeLog index e904505279..df5e7e8d9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2005-03-17 Jan Nieuwenhuizen + Fix truncated --png output (Peter Danenberg). + + * python/lilylib.py (make_ps_images): + * scripts/ps2png.py (copyright): Grok --papersize option. + + * scm/backend-library.scm (postscript->png): Add parameter + PAPERSIZE. Update callers. + * scm/output-gnome.scm (music-font?): Bugfix: use "Emmentaler". Fixes symbol placement. diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index 90442b062b..44577744cd 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -184,7 +184,6 @@ pianoLH = \relative c'' \repeat volta 2 { \PianoStaff \override VerticalAlignment #'forced-distance = #10 } - inputencoding = "latin1" } \midi { \tempo 4 = 70 diff --git a/po/lilypond.pot b/po/lilypond.pot index 8e774cd7c9..c25aad1e3a 100644 --- a/po/lilypond.pot +++ b/po/lilypond.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-03-10 16:21+0100\n" +"POT-Creation-Date: 2005-03-17 16:45+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -559,7 +559,7 @@ msgstr "" #: accidental.cc:223 key-signature-interface.cc:133 lily/accidental.cc:223 #: lily/key-signature-interface.cc:133 lily/accidental.cc:233 -#: lily/key-signature-interface.cc:128 +#: lily/key-signature-interface.cc:128 lily/key-signature-interface.cc:127 #, c-format msgid "accidental `%s' not found" msgstr "" @@ -573,6 +573,7 @@ msgstr "" #. FIXME: broken sentence #. FIXME: broken sentence #. FIXME: broken sentence +#. FIXME: broken sentence #: all-font-metrics.cc:158 lily/all-font-metrics.cc:176 #, c-format msgid "checksum mismatch for font file: `%s'" @@ -628,6 +629,7 @@ msgstr "" #: auto-change-iterator.cc:66 change-iterator.cc:61 #: lily/auto-change-iterator.cc:66 lily/change-iterator.cc:61 #: lily/auto-change-iterator.cc:63 lily/change-iterator.cc:60 +#: lily/auto-change-iterator.cc:62 msgid "Can't switch translators, I'm there already" msgstr "" @@ -648,20 +650,24 @@ msgid "already have a beam" msgstr "" #: beam-engraver.cc:209 lily/beam-engraver.cc:209 lily/beam-engraver.cc:206 +#: lily/beam-engraver.cc:205 msgid "unterminated beam" msgstr "" #: beam-engraver.cc:242 chord-tremolo-engraver.cc:168 #: lily/beam-engraver.cc:242 lily/chord-tremolo-engraver.cc:168 #: lily/beam-engraver.cc:239 lily/chord-tremolo-engraver.cc:165 +#: lily/beam-engraver.cc:238 msgid "stem must have Rhythmic structure" msgstr "" #: beam-engraver.cc:256 lily/beam-engraver.cc:256 lily/beam-engraver.cc:252 +#: lily/beam-engraver.cc:251 msgid "stem doesn't fit in beam" msgstr "" #: beam-engraver.cc:257 lily/beam-engraver.cc:257 lily/beam-engraver.cc:253 +#: lily/beam-engraver.cc:252 msgid "beam was started here" msgstr "" @@ -673,7 +679,7 @@ msgstr "" msgid "removing beam with less than two stems" msgstr "" -#: beam.cc:1011 lily/beam.cc:1011 lily/beam.cc:984 +#: beam.cc:1011 lily/beam.cc:1011 lily/beam.cc:984 lily/beam.cc:988 msgid "no viable initial configuration found: may not find good beam slope" msgstr "" @@ -712,6 +718,12 @@ msgstr "" #. #. last->translator_id_string () = get_change ()->change_to_id_string (); #. +#. +#. We could change the current translator's id, but that would make +#. errors hard to catch +#. +#. last->translator_id_string () = get_change ()->change_to_id_string (); +#. #: change-iterator.cc:93 lily/change-iterator.cc:93 lily/change-iterator.cc:92 msgid "I'm one myself" msgstr "" @@ -793,27 +805,27 @@ msgstr "" #: dynamic-engraver.cc:179 span-dynamic-performer.cc:84 #: lily/dynamic-engraver.cc:179 lily/span-dynamic-performer.cc:84 -#: lily/dynamic-engraver.cc:172 +#: lily/dynamic-engraver.cc:172 lily/dynamic-engraver.cc:171 msgid "can't find start of (de)crescendo" msgstr "" #: dynamic-engraver.cc:189 lily/dynamic-engraver.cc:189 -#: lily/dynamic-engraver.cc:182 +#: lily/dynamic-engraver.cc:182 lily/dynamic-engraver.cc:180 msgid "already have a decrescendo" msgstr "" #: dynamic-engraver.cc:191 lily/dynamic-engraver.cc:191 -#: lily/dynamic-engraver.cc:184 +#: lily/dynamic-engraver.cc:184 lily/dynamic-engraver.cc:182 msgid "already have a crescendo" msgstr "" #: dynamic-engraver.cc:194 lily/dynamic-engraver.cc:194 -#: lily/dynamic-engraver.cc:187 +#: lily/dynamic-engraver.cc:187 lily/dynamic-engraver.cc:185 msgid "Cresc started here" msgstr "" #: dynamic-engraver.cc:315 lily/dynamic-engraver.cc:315 -#: lily/dynamic-engraver.cc:307 +#: lily/dynamic-engraver.cc:307 lily/dynamic-engraver.cc:304 msgid "unterminated (de)crescendo" msgstr "" @@ -863,6 +875,7 @@ msgid "elapsed time: %.2f seconds" msgstr "" #: global-context.cc:162 lily/global-context.cc:162 lily/global-context.cc:161 +#: lily/global-context.cc:160 #, c-format msgid "can't find `%s' context" msgstr "" @@ -889,11 +902,13 @@ msgid "implied \\%s added" msgstr "" #: grob-interface.cc:48 lily/grob-interface.cc:48 lily/grob-interface.cc:46 +#: lily/grob-interface.cc:45 #, c-format msgid "Unknown interface `%s'" msgstr "" #: grob-interface.cc:59 lily/grob-interface.cc:59 lily/grob-interface.cc:57 +#: lily/grob-interface.cc:56 #, c-format msgid "Grob `%s' has no interface for property `%s'" msgstr "" @@ -917,11 +932,12 @@ msgid "Conflicting note group events." msgstr "" #: hyphen-engraver.cc:96 lily/hyphen-engraver.cc:96 lily/hyphen-engraver.cc:91 +#: lily/hyphen-engraver.cc:89 msgid "removing unterminated hyphen" msgstr "" #: hyphen-engraver.cc:109 lily/hyphen-engraver.cc:109 -#: lily/hyphen-engraver.cc:104 +#: lily/hyphen-engraver.cc:104 lily/hyphen-engraver.cc:102 msgid "unterminated hyphen; removing" msgstr "" @@ -1085,6 +1101,8 @@ msgstr "" #. for --output-format. #. Bug in option parser: --output =foe is taken as an abbreviation #. for --output-format. +#. Bug in option parser: --output =foe is taken as an abbreviation +#. for --output-format. #: main.cc:126 lily/main.cc:136 lily/main.cc:134 msgid "EXTs" msgstr "" @@ -1156,6 +1174,7 @@ msgstr "" #. No version number or newline here. It confuses help2man. #. No version number or newline here. It confuses help2man. #. No version number or newline here. It confuses help2man. +#. No version number or newline here. It confuses help2man. #: main.cc:188 lily/main.cc:198 lily/main.cc:196 #, c-format msgid "Usage: %s [OPTION]... FILE..." @@ -1271,13 +1290,16 @@ msgstr "" #. #. music for the softenon children? #. +#. +#. music for the softenon children? +#. #: new-fingering-engraver.cc:153 lily/new-fingering-engraver.cc:153 -#: lily/new-fingering-engraver.cc:150 +#: lily/new-fingering-engraver.cc:150 lily/new-fingering-engraver.cc:149 msgid "music for the martians." msgstr "" #: new-fingering-engraver.cc:233 lily/new-fingering-engraver.cc:233 -#: lily/new-fingering-engraver.cc:230 +#: lily/new-fingering-engraver.cc:230 lily/new-fingering-engraver.cc:229 msgid "Fingerings are also not down?! Putting them down anyway." msgstr "" @@ -1289,6 +1311,7 @@ msgid "cannot find Voice `%s'" msgstr "" #: note-collision.cc:413 lily/note-collision.cc:413 lily/note-collision.cc:405 +#: lily/note-collision.cc:404 msgid "Too many clashing notecolumns. Ignoring them." msgstr "" @@ -1355,7 +1378,7 @@ msgid "Don't know how to handle a percent repeat of this length." msgstr "" #: percent-repeat-engraver.cc:160 lily/percent-repeat-engraver.cc:160 -#: lily/percent-repeat-engraver.cc:159 +#: lily/percent-repeat-engraver.cc:159 lily/percent-repeat-engraver.cc:158 msgid "unterminated percent repeat" msgstr "" @@ -1387,7 +1410,7 @@ msgid "unterminated phrasing slur" msgstr "" #: piano-pedal-engraver.cc:232 lily/piano-pedal-engraver.cc:232 -#: lily/piano-pedal-engraver.cc:225 +#: lily/piano-pedal-engraver.cc:225 lily/piano-pedal-engraver.cc:224 msgid "Need 3 strings for piano pedals. No pedal made. " msgstr "" @@ -1395,12 +1418,13 @@ msgstr "" #: piano-pedal-performer.cc:80 lily/piano-pedal-engraver.cc:247 #: lily/piano-pedal-engraver.cc:262 lily/piano-pedal-performer.cc:80 #: lily/piano-pedal-engraver.cc:240 lily/piano-pedal-engraver.cc:255 +#: lily/piano-pedal-engraver.cc:239 lily/piano-pedal-engraver.cc:254 #, c-format msgid "can't find start of piano pedal: `%s'" msgstr "" #: piano-pedal-engraver.cc:313 lily/piano-pedal-engraver.cc:313 -#: lily/piano-pedal-engraver.cc:305 +#: lily/piano-pedal-engraver.cc:305 lily/piano-pedal-engraver.cc:304 #, c-format msgid "can't find start of piano pedal bracket: `%s'" msgstr "" @@ -1427,7 +1451,7 @@ msgstr "" #: rest-collision.cc:164 rest-collision.cc:207 lily/rest-collision.cc:164 #: lily/rest-collision.cc:207 lily/rest-collision.cc:162 -#: lily/rest-collision.cc:209 +#: lily/rest-collision.cc:209 lily/rest-collision.cc:208 msgid "too many colliding rests" msgstr "" @@ -1498,15 +1522,15 @@ msgstr "" msgid "Aborting." msgstr "" -#: score.cc:224 lily/score.cc:219 lily/score.cc:214 +#: score.cc:224 lily/score.cc:219 lily/score.cc:214 lily/score.cc:213 msgid "Already have music in score" msgstr "" -#: score.cc:225 lily/score.cc:220 lily/score.cc:215 +#: score.cc:225 lily/score.cc:220 lily/score.cc:215 lily/score.cc:214 msgid "This is the previous music" msgstr "" -#: score.cc:230 lily/score.cc:225 lily/score.cc:220 +#: score.cc:230 lily/score.cc:225 lily/score.cc:220 lily/score.cc:219 msgid "Error found in this music expression. Ignoring it" msgstr "" @@ -1514,6 +1538,7 @@ msgstr "" #. FIXME: #. FIXME: #. FIXME: +#. FIXME: #: script-engraver.cc:101 lily/script-engraver.cc:101 #: lily/script-engraver.cc:100 msgid "Do not know how to interpret articulation: " @@ -1528,6 +1553,7 @@ msgstr "" #. this shouldn't happen, but let's continue anyway. #. this shouldn't happen, but let's continue anyway. #. this shouldn't happen, but let's continue anyway. +#. this shouldn't happen, but let's continue anyway. #: separation-item.cc:54 separation-item.cc:98 lily/separation-item.cc:54 #: lily/separation-item.cc:98 lily/separation-item.cc:52 #: lily/separation-item.cc:96 @@ -1535,6 +1561,7 @@ msgid "Separation_item: I've been drinking too much" msgstr "" #: simple-spacer.cc:506 lily/simple-spacer.cc:424 lily/simple-spacer.cc:411 +#: lily/simple-spacer.cc:410 #, c-format msgid "No spring between column %d and next one" msgstr "" @@ -1553,7 +1580,7 @@ msgid "Huh? Got %d, expected %d characters" msgstr "" #: spacing-spanner.cc:386 lily/spacing-spanner.cc:386 -#: lily/spacing-spanner.cc:378 +#: lily/spacing-spanner.cc:378 lily/spacing-spanner.cc:377 #, c-format msgid "Global shortest duration is %s" msgstr "" @@ -1566,6 +1593,7 @@ msgstr "" #. FIXME: #. FIXME: #. FIXME: +#. FIXME: #: stem-engraver.cc:125 lily/stem-engraver.cc:125 #, c-format msgid "Adding note head to incompatible stem (type = %d)" @@ -1579,12 +1607,12 @@ msgstr "" msgid "Weird stem size; check for narrow beams" msgstr "" -#: stem.cc:579 lily/stem.cc:579 lily/stem.cc:578 +#: stem.cc:579 lily/stem.cc:579 lily/stem.cc:578 lily/stem.cc:577 #, c-format msgid "flag `%s' not found" msgstr "" -#: stem.cc:590 lily/stem.cc:590 lily/stem.cc:589 +#: stem.cc:590 lily/stem.cc:590 lily/stem.cc:589 lily/stem.cc:588 #, c-format msgid "flag stroke `%s' not found" msgstr "" @@ -1626,12 +1654,16 @@ msgstr "" #. more of a programming error. #. Not using ngettext's plural feature here, as this message is #. more of a programming error. +#. Not using ngettext's plural feature here, as this message is +#. more of a programming error. #: tfm-reader.cc:108 lily/tfm-reader.cc:108 lily/tfm-reader.cc:107 +#: lily/tfm-reader.cc:106 #, c-format msgid "TFM header of `%s' has only %u word (s)" msgstr "" #: tfm-reader.cc:142 lily/tfm-reader.cc:142 lily/tfm-reader.cc:141 +#: lily/tfm-reader.cc:139 #, c-format msgid "%s: TFM file has %u parameters, which is more than the %u I can handle" msgstr "" @@ -1642,6 +1674,7 @@ msgid "can't find ascii character: %d" msgstr "" #: tie-engraver.cc:199 lily/tie-engraver.cc:199 lily/tie-engraver.cc:195 +#: lily/tie-engraver.cc:194 msgid "lonely tie" msgstr "" @@ -1670,6 +1703,11 @@ msgstr "" #. #. OTOH, Tristan Keuris writes 8/20 in his Intermezzi. #. +#. +#. Todo: should make typecheck? +#. +#. OTOH, Tristan Keuris writes 8/20 in his Intermezzi. +#. #: time-signature-engraver.cc:55 lily/time-signature-engraver.cc:55 #: lily/time-signature-engraver.cc:54 #, c-format @@ -1684,6 +1722,8 @@ msgstr "" #. (Here really with a warning!) #. If there is no such symbol, we default to the numbered style. #. (Here really with a warning!) +#. If there is no such symbol, we default to the numbered style. +#. (Here really with a warning!) #: time-signature.cc:85 lily/time-signature.cc:85 lily/time-signature.cc:83 #, c-format msgid "time signature symbol `%s' not found; reverting to numbered style" @@ -1711,6 +1751,7 @@ msgid "unterminated trill spanner" msgstr "" #: tuplet-bracket.cc:451 lily/tuplet-bracket.cc:447 lily/tuplet-bracket.cc:439 +#: lily/tuplet-bracket.cc:438 msgid "Killing tuplet bracket across linebreak." msgstr "" @@ -1736,14 +1777,17 @@ msgid "Vaticana_ligature: zero join (delta_pitch == 0)" msgstr "" #: volta-engraver.cc:140 lily/volta-engraver.cc:140 lily/volta-engraver.cc:134 +#: lily/volta-engraver.cc:133 msgid "No volta spanner to end" msgstr "" #: volta-engraver.cc:151 lily/volta-engraver.cc:151 lily/volta-engraver.cc:145 +#: lily/volta-engraver.cc:144 msgid "Already have a volta spanner. Stopping that one prematurely." msgstr "" #: volta-engraver.cc:155 lily/volta-engraver.cc:155 lily/volta-engraver.cc:149 +#: lily/volta-engraver.cc:148 msgid "Also have a stopped spanner. Giving up." msgstr "" @@ -1979,3 +2023,8 @@ msgstr "" #, c-format msgid "Usage: lilypond -e \"(ly:set - option SYMBOL VAL)\"" msgstr "" + +#: lily/scm-option.cc:62 +#, c-format +msgid "Usage: lilypond -e \"(ly : set - option SYMBOL VAL)\"" +msgstr "" diff --git a/python/lilylib.py b/python/lilylib.py index 8e38dc23e1..67336b02da 100644 --- a/python/lilylib.py +++ b/python/lilylib.py @@ -462,7 +462,7 @@ def get_bbox (filename): return gr -def make_ps_images (ps_name, resolution = 90): +def make_ps_images (ps_name, resolution = 90, papersize = "a4"): ## todo: ## have better algorithm for deciding when to crop page, ## and when to show full page @@ -504,8 +504,21 @@ def make_ps_images (ps_name, resolution = 90): if y == 0: y = 1 - cmd = r'''gs -g%dx%d -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=%s -r%d -dNOPAUSE %s %s -c showpage -c quit ''' % \ - (x, y, output_file, resolution, trans_ps, ps_name) + ###cmd = r'''gs -g%dx%d -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=%s -r%d -dNOPAUSE %s %s -c showpage -c quit ''' % \ + ### (x, y, output_file, resolution, trans_ps, ps_name) + cmd = r'''gs\ + -g%(x)d%(y)d\ + -sDEVICE=png16m\ + -dTextAlphaBits=4\ + -dGraphicsAlphaBits=4\ + -q\ + -sOutputFile=%(output_file)s\ + -sPAPERSIZE=%(papersize)s\ + -r%(resolution)d -dNOPAUSE\ + %(trans_ps)s\ + %(ps_name)s\ + -c showpage\ + -c quit ''' % vars () rms = glob.glob (base + '-page*.png') map (os.unlink, rms) @@ -516,8 +529,19 @@ def make_ps_images (ps_name, resolution = 90): if os.path.isfile (rmfile): os.unlink (rmfile) - cmd = r'''gs -s -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=%s -dNOPAUSE -r%d %s -c quit''' % (output_file, - resolution, ps_name) + ###cmd = r'''gs -s -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -q -sOutputFile=%s -dNOPAUSE -r%d %s -c quit''' % (output_file, + ### resolution, ps_name) + cmd = r'''gs\ + -s\ + -sDEVICE=png16m\ + -dTextAlphaBits=4\ + -dGraphicsAlphaBits=4\ + -q\ + -sOutputFile=%(output_file)s\ + -sPAPERSIZE=%(papersize)s\ + -dNOPAUSE -r%(resolution)d\ + %(ps_name)s\ + -c quit''' % vars () status = system (cmd) signal = 0xf & status diff --git a/scm/backend-library.scm b/scm/backend-library.scm index d03b95870c..9c10bcc851 100644 --- a/scm/backend-library.scm +++ b/scm/backend-library.scm @@ -48,17 +48,19 @@ (format (current-error-port) (_ "Converting to `~a'...") pdf-name) (ly:system cmd))) -(define-public (postscript->png resolution name) +(define-public (postscript->png resolution papersize name) (let ((cmd (string-append "ps2png --resolution=" (if (number? resolution) (number->string resolution) "90 ") + " --papersize=" (if (string? papersize) papersize "a4") (if (ly:get-option 'verbose) " --verbose " " ") name))) - + ;; Do not try to guess the name of the png file + (format (current-error-port) (_ "Converting to `~a'...") "png") (ly:system cmd))) (define-public (postprocess-output paper-book module filename formats) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index e27cf4115a..1e0deba205 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -362,11 +362,12 @@ (define-public (convert-to-png book name) (let* ((defs (ly:paper-book-paper book)) - (resolution (ly:output-def-lookup defs 'pngresolution))) + (resolution (ly:output-def-lookup defs 'pngresolution)) + (papersizename (ly:output-def-lookup defs 'papersizename))) (postscript->png (if (number? resolution) resolution - (ly:get-option 'resolution)) + (if (string? papersizename) papersizename "a4") name))) (define-public (convert-to-dvi book name) diff --git a/scm/framework-tex.scm b/scm/framework-tex.scm index fa6ba28bb5..9661f3ec25 100644 --- a/scm/framework-tex.scm +++ b/scm/framework-tex.scm @@ -301,11 +301,11 @@ (define-public (convert-to-png book name) (let* ((defs (ly:paper-book-paper book)) - (resolution (ly:output-def-lookup defs 'pngresolution))) + (resolution (ly:output-def-lookup defs 'pngresolution)) + (papersizename (ly:output-def-lookup defs 'papersizename))) (postscript->png - (if (number? resolution) - resolution - (ly:get-option 'resolution)) + (if (number? resolution) resolution (ly:get-option 'resolution)) + (if (string? papersizename) papersizename "a4") (string-append (basename name ".tex") ".ps")))) (define-public (convert-to-ps book name) diff --git a/scripts/ps2png.py b/scripts/ps2png.py index 5d45eddad3..2cbbd09728 100644 --- a/scripts/ps2png.py +++ b/scripts/ps2png.py @@ -25,6 +25,8 @@ global _;_=ly._ global re;re = ly.re preview_resolution = 90 +# Use /etc/papersize? +preview_papersize = "a4" # lilylib globals program_name = sys.argv[0] @@ -39,8 +41,8 @@ copyright = ('Han-Wen Nienhuys