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-default-paper-size songFormatAndSize)
#(set-global-staff-size globalSize) #(set-global-staff-size globalSize)
#(define (default-pango size)
(make-pango-font-tree
songChordFont
songLyricFont
"Luxi Mono"
(/ size 20)))
\paper { \paper {
#(define fonts (default-pango globalSize)) property-defaults.fonts.serif = \songChordFont
property-defaults.fonts.sans = \songLyricFont
%annotate-spacing = ##t %annotate-spacing = ##t
% spacing stuff % spacing stuff
lyric-size = #lyricSize lyric-size = #lyricSize

View File

@ -217,16 +217,16 @@ songs =
%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Include Images once and reference them: %% Include Images once and reference them:
#(define bbox-regexp #(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) #(define (get-postscript-bbox string)
"Extract the bbox from STRING, or return #f if not present." "Extract the bbox from STRING, or return #f if not present."
(let* (let*
((match (regexp-exec bbox-regexp string))) ((match (ly:regex-exec bbox-regexp string)))
(if match (if match
(map (lambda (x) (map (lambda (x)
(string->number (match:substring match x))) (string->number (ly:regex-match-substring match x)))
(cdr (iota 5))) (cdr (iota 5)))
#f))) #f)))

View File

@ -65,7 +65,7 @@ generalLayout = \layout {
\semiGermanChords \semiGermanChords
\override ChordName.font-size = \songScoreChordFontSize \override ChordName.font-size = \songScoreChordFontSize
\override ChordName.font-series = \songChordFontSeries \override ChordName.font-series = \songChordFontSeries
\override ChordName.font-family = #'roman \override ChordName.font-family = #'sans
chordNameLowercaseMinor = ##t chordNameLowercaseMinor = ##t
chordChanges = ##t chordChanges = ##t
% eigenen chordRootNamer damit F# = Fis und Gb = Ges (also alteration ausgeschrieben) % eigenen chordRootNamer damit F# = Fis und Gb = Ges (also alteration ausgeschrieben)

View File

@ -7,6 +7,7 @@
#(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f)) #(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f))
\include "basic_format_and_style_settings.ly" \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 "eps_file_from_song_dir.ly"
\include "title_with_category_images.ly" \include "title_with_category_images.ly"
\include "footer_with_songinfo.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 % parsing line by line
#(define-markup-command (wrap-newline layout props text) (string?) #(define-markup-command (wrap-newline layout props text) (string?)
"Text Zeile für Zeile parsen" "Text Zeile für Zeile parsen"
(interpret-markup layout props (interpret-markup layout props
#{ \markup { \column { #{ \markup { \column {
$(let ((verse-markup-string (string-append "\\line { " $(let ((verse-markup-string (
(regexp-substitute/global #f "\n" string-append "\\line { "
text (ly:regex-replace (ly:make-regex "\n") text " } \\line { ")
'pre " } \\line { " 'post )
" \\size-box-to-box ##f ##t \"\" \"Agj\" }" ))) " \\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)) (ly:parser-include-string 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)))
}}#} }}#}
) )
) )
@ -116,10 +111,10 @@
(interpret-markup layout props (interpret-markup layout props
(markup #:override `(baseline-skip . ,songTextLineHeigth) #:anchor-x-between #:stanza stanza (markup #:override `(baseline-skip . ,songTextLineHeigth) #:anchor-x-between #:stanza stanza
(make-wrap-newline-markup (make-wrap-newline-markup
(regexp-substitute/global #f "\\(( *)([^,()]*)( *),([^)]*)\\)" (ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)")
(regexp-substitute/global #f "(([^ \n]*\\([^()]*\\)[^ \n]*)+)" verse (ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") verse " \\concat { " 1 " } ")
'pre " \\concat { " 1 " } " 'post) "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }")
'pre "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }" 'post)) )
)))) ))))
% Kompletter Vers aus dem Akkorde entfernt werden % Kompletter Vers aus dem Akkorde entfernt werden
@ -127,7 +122,7 @@
"Vers ohne Akkorde" "Vers ohne Akkorde"
(interpret-markup layout props (interpret-markup layout props
(markup #:override '(baseline-skip . 3.0) #:anchor-x-between #:stanza stanza (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)
) )
) )
) )