From 4690c33ce0ae368ed7db3e565c97890b65951de2 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Mon, 15 Jul 2019 00:41:34 -0400 Subject: scripts/gen-mplus-patch.pl: Improve font sorting --- diff --git a/scripts/gen-mplus-patch.pl b/scripts/gen-mplus-patch.pl index 33e452a..43c59d3 100755 --- a/scripts/gen-mplus-patch.pl +++ b/scripts/gen-mplus-patch.pl @@ -11,12 +11,12 @@ use Text::Diff; my @FONTS = ( # face weight w h + [qw(1m regular 8 12)], [qw(1m regular 10 14)], [qw(1m regular 12 17)], [qw(1m regular 16 22)], [qw(1m regular 24 34)], [qw(1m regular 32 44)], - [qw(1m regular 8 12)], ); my $PATCH = 'patches/01_add-mplus-fonts.patch'; @@ -211,7 +211,7 @@ sub patch_fonts_c sub conv_fonts { my ($mplus_dir, $bdf2fbcon) = @_; - my $patch; + my %patch; my $face; my $weight; my $width; @@ -219,16 +219,17 @@ sub conv_fonts my $font_name; my $new; - $patch = ''; + %patch = (); foreach my $font (@FONTS) { ($face, $weight, $width, $height) = @$font; $font_name = "mplus-$face-$weight"; $new = `otf2bdf -p $width -r 72 $mplus_dir/$font_name.ttf | \\ $bdf2fbcon -o - -n $font_name -p 2 -`; - $patch .= make_patch("lib/fonts/font_mplus_${face}_${weight}_" . - "${width}x${height}.c", '', $new); + $font_name .= "-${width}x${height}"; + $patch{$font_name} = make_patch("lib/fonts/font_mplus_${face}" . + "_${weight}_${width}x${height}.c", '', $new); } - return $patch; + return join('', @patch{sort(keys(%patch))}); } sub main -- cgit v0.9.1