From 301681fffbb3fc1597af270c04a6ddbacabad1f6 Mon Sep 17 00:00:00 2001 From: tux Date: Tue, 8 Aug 2023 19:21:51 +0200 Subject: [PATCH] use new lilypond 2.25 regexes and font definitions --- basic_format_and_style_settings.ly | 10 ++-------- book_include.ly | 6 +++--- chord_settings.ly | 2 +- general_include.ly | 1 + legacy-lilypond-compatibility-pre-2.25.ly | 22 ++++++++++++++++++++++ verses_with_chords.ly | 23 +++++++++-------------- 6 files changed, 38 insertions(+), 26 deletions(-) create mode 100644 legacy-lilypond-compatibility-pre-2.25.ly diff --git a/basic_format_and_style_settings.ly b/basic_format_and_style_settings.ly index 4cd80ef..5545af6 100644 --- a/basic_format_and_style_settings.ly +++ b/basic_format_and_style_settings.ly @@ -8,15 +8,9 @@ #(set-default-paper-size songFormatAndSize) #(set-global-staff-size globalSize) -#(define (default-pango size) - (make-pango-font-tree - songChordFont - songLyricFont - "Luxi Mono" - (/ size 20))) - \paper { - #(define fonts (default-pango globalSize)) + property-defaults.fonts.serif = \songChordFont + property-defaults.fonts.sans = \songLyricFont %annotate-spacing = ##t % spacing stuff lyric-size = #lyricSize diff --git a/book_include.ly b/book_include.ly index 1c5a1ce..9fc7733 100644 --- a/book_include.ly +++ b/book_include.ly @@ -217,16 +217,16 @@ songs = %%%%%%%%%%%%%%%%%%%%%%%%%%% %% Include Images once and reference them: #(define bbox-regexp - (make-regexp "%%BoundingBox:[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)")) + (ly:make-regex "%%BoundingBox:[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)")) #(define (get-postscript-bbox string) "Extract the bbox from STRING, or return #f if not present." (let* - ((match (regexp-exec bbox-regexp string))) + ((match (ly:regex-exec bbox-regexp string))) (if match (map (lambda (x) - (string->number (match:substring match x))) + (string->number (ly:regex-match-substring match x))) (cdr (iota 5))) #f))) diff --git a/chord_settings.ly b/chord_settings.ly index c6d606b..befee4f 100644 --- a/chord_settings.ly +++ b/chord_settings.ly @@ -65,7 +65,7 @@ generalLayout = \layout { \semiGermanChords \override ChordName.font-size = \songScoreChordFontSize \override ChordName.font-series = \songChordFontSeries - \override ChordName.font-family = #'roman + \override ChordName.font-family = #'sans chordNameLowercaseMinor = ##t chordChanges = ##t % eigenen chordRootNamer damit F# = Fis und Gb = Ges (also alteration ausgeschrieben) diff --git a/general_include.ly b/general_include.ly index d0606b9..c9c03ea 100644 --- a/general_include.ly +++ b/general_include.ly @@ -7,6 +7,7 @@ #(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f)) \include "basic_format_and_style_settings.ly" +\include #(if (< (list-ref (ly:version) 1) 25) "legacy-lilypond-compatibility-pre-2.25.ly" "void.ly") \include "eps_file_from_song_dir.ly" \include "title_with_category_images.ly" \include "footer_with_songinfo.ly" diff --git a/legacy-lilypond-compatibility-pre-2.25.ly b/legacy-lilypond-compatibility-pre-2.25.ly new file mode 100644 index 0000000..e733572 --- /dev/null +++ b/legacy-lilypond-compatibility-pre-2.25.ly @@ -0,0 +1,22 @@ +% guile regular expressions aktivieren: +#(use-modules (ice-9 regex)) + +#(define ly:make-regex make-regexp) +#(define ly:regex-exec regexp-exec) +#(define ly:regex-match-substring match:substring) +#(define (ly:regex-replace pattern text . replacements) + (apply regexp-substitute/global #f pattern text 'pre (append replacements (list 'post)))) + + +% old font handling + +#(define (default-pango size) + (make-pango-font-tree + songChordFont + songLyricFont + "Luxi Mono" + (/ size 20))) + +\paper { + #(define fonts (default-pango globalSize)) +} diff --git a/verses_with_chords.ly b/verses_with_chords.ly index 957ecee..eba7511 100644 --- a/verses_with_chords.ly +++ b/verses_with_chords.ly @@ -1,18 +1,13 @@ -% guile regular expressions aktivieren: -#(use-modules (ice-9 regex)) - % parsing line by line #(define-markup-command (wrap-newline layout props text) (string?) "Text Zeile für Zeile parsen" (interpret-markup layout props #{ \markup { \column { - $(let ((verse-markup-string (string-append "\\line { " - (regexp-substitute/global #f "\n" - text - 'pre " } \\line { " 'post ) + $(let ((verse-markup-string ( + string-append "\\line { " + (ly:regex-replace (ly:make-regex "\n") text " } \\line { ") " \\size-box-to-box ##f ##t \"\" \"Agj\" }" ))) - ;(ly:parse-string-expression (if (< (list-ref (ly:version) 1) 19) (ly:parser-clone parser) (ly:parser-clone)) verse-markup-string)) - (if (< (list-ref (ly:version) 1) 19) (ly:parser-include-string parser verse-markup-string) (ly:parser-include-string verse-markup-string))) + (ly:parser-include-string verse-markup-string)) }}#} ) ) @@ -116,10 +111,10 @@ (interpret-markup layout props (markup #:override `(baseline-skip . ,songTextLineHeigth) #:anchor-x-between #:stanza stanza (make-wrap-newline-markup - (regexp-substitute/global #f "\\(( *)([^,()]*)( *),([^)]*)\\)" - (regexp-substitute/global #f "(([^ \n]*\\([^()]*\\)[^ \n]*)+)" verse - 'pre " \\concat { " 1 " } " 'post) - 'pre "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }" 'post)) + (ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)") + (ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") verse " \\concat { " 1 " } ") + "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }") + ) )))) % Kompletter Vers aus dem Akkorde entfernt werden @@ -127,7 +122,7 @@ "Vers ohne Akkorde" (interpret-markup layout props (markup #:override '(baseline-skip . 3.0) #:anchor-x-between #:stanza stanza - #:wrap-newline (regexp-substitute/global #f "\\(([^,]*),([^)]*)\\)" verse 'pre 1 'post ) + #:wrap-newline (ly:regex-replace (ly:make-regex "\\(([^,]*),([^)]*)\\)") verse 1) ) ) )