use new lilypond 2.25 regexes and font definitions

This commit is contained in:
tux 2023-08-08 19:21:51 +02:00
parent d900a95d79
commit 301681fffb
6 changed files with 38 additions and 26 deletions

View File

@ -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

View File

@ -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)))

View File

@ -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)

View File

@ -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"

View File

@ -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))
}

View File

@ -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)
)
)
)