From b79aca28b7edea9da6afdfa0dc238c8b3341a473 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Wed, 16 Mar 2022 23:44:51 -0400 Subject: [PATCH] Ajustement taille des accords selon taille des paroles --- gtx2tex.pl | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/gtx2tex.pl b/gtx2tex.pl index 4717d85..01bf47e 100644 --- a/gtx2tex.pl +++ b/gtx2tex.pl @@ -54,6 +54,9 @@ $verbose && print "$output\n"; $libpath="/usr/local/lib/guitartex"; +$song_size = "normalsize"; +$new_song_init = "1"; + # load configuration file $home=$ENV{"HOME"}; $verbose && print "home=$home\n"; @@ -150,6 +153,22 @@ while ( ) { $verbose && print " chordpro data\n"; + if ($new_song_init) { + # Augmente la taille des accords par rapport à la taille des paroles: + $inc_song_size = $song_size; + if ($song_size eq "footnotesize") { $inc_song_size = "small" } + if ($song_size eq "small") { $inc_song_size = "normalsize" } + if ($song_size eq "normalsize") { $inc_song_size = "large" } + if ($song_size eq "large") { $inc_song_size = "Large" } + if ($song_size eq "Large") { $inc_song_size = "LARGE" } + if ($song_size eq "LARGE") { $inc_song_size = "huge" } + if ($song_size eq "huge") { $inc_song_size = "Huge" } + + print TEX "\\renewcommand{\\gtxchordsize}{\\$inc_song_size}\n"; + + $new_song_init = ""; + } + crdpro(); } @@ -315,6 +334,8 @@ sub directive{ # Réinitialisation à la fonte normale print TEX "\\normalsize\n"; + $song_size = "normalsize"; + $new_song_init = "1"; if ( $output eq "pdf" ) { print TEX "\\pdfdest name {$_} fith \\pdfoutline goto name {$_} {$_}" } @@ -396,6 +417,8 @@ sub directive{ }elsif ( /{size:/ ) { s/(\{.*:)(.+)(\})/\2/; print TEX "\\$_\n"; + $song_size = $_; + $verbose && print "Song size: $song_size\n"; } } @@ -612,7 +635,7 @@ sub latex_header { %\\makebox[0.5cm][r]{\\scriptsize\\theverscnt\\normalsize}% %\\makebox[0.5cm]{}} % - \\newcommand{\\gtxchordsize}{\\footnotesize} + \\newcommand{\\gtxchordsize}{\\$song_size} \\setlength{\\parindent}{0pt} % Modification pour augmenter la taille des accords. @@ -630,10 +653,10 @@ sub latex_header { \\ifthenelse{\\lengthtest{\\wd\\textbox>\\wd\\gtxchordbox}}% {% % Boîte pour les accords (plus gros) - \\raisebox{2.5ex}[2ex][2.5ex]{\\makebox[0pt][l]{\\small\\bf#1}}#2% + \\raisebox{2.5ex}[2ex][2.5ex]{\\makebox[0pt][l]{\\gtxchordsize\\bf#1}}#2% }{% % Boîte pour les accords (plus gros) - \\raisebox{2.5ex}[2ex][2.5ex]{\\makebox[0pt][l]{\\small\\bf#1}}\\makebox[\\wd\\gtxchordbox+0.5em][l]{#2}% + \\raisebox{2.5ex}[2ex][2.5ex]{\\makebox[0pt][l]{\\gtxchordsize\\bf#1}}\\makebox[\\wd\\gtxchordbox+0.5em][l]{#2}% }% }% -- 2.20.1