diff --git a/development/tools/GetOptions.pm b/development/tools/GetOptions.pm index 81be0e55a4..0da0992f17 100644 --- a/development/tools/GetOptions.pm +++ b/development/tools/GetOptions.pm @@ -51,11 +51,22 @@ my $helpFormat = " %-8s|%-9s|%-7s|%-17s|%s\n"; sub handleOptions($) { - %optionsDef = %{$_[0]}; + if (ref($_[0]) eq "ARRAY") { + for (my $i = 0; defined($_[0]->[$i]); $i++) { + my $rO = $_[0]->[$i]; + $optionsDef{$rO->[0]} = $rO->[1]; + $optionsDef{$rO->[0]}->{Sort} = $i+1; + } + } + else { + %optionsDef = %{$_[0]}; + } $optionsDef{h}->{fieldname} = "help"; $optionsDef{h}->{alias} = ["help"]; + $optionsDef{h}->{Sort} = 0; $optionsDef{v}->{fieldname} = "verbose"; $optionsDef{v}->{alias} = ["verbose"]; + $optionsDef{v}->{Sort} = 0; my %options = ("help" => 0); my $opts = &makeOpts(); @@ -142,7 +153,7 @@ sub makeHelp() "i" => "integer", "f" => "float", ); - for my $ex (sort keys %optionsDef) { + for my $ex (sort {$optionsDef{$a}->{Sort} <=> $optionsDef{$b}->{Sort};} keys %optionsDef) { my $e = $optionsDef{$ex}; my $type = ""; my $needed = ""; diff --git a/development/tools/listFontWithLang.pl b/development/tools/listFontWithLang.pl index 3589ba0e16..4f8ddaa7d4 100644 --- a/development/tools/listFontWithLang.pl +++ b/development/tools/listFontWithLang.pl @@ -48,43 +48,56 @@ sub correctstyle($); # alias: reference to a list of aliases e.g. ["alias1", "alias2", ... ] # listsep: Separator for multiple data # comment: Parameter description -my %optionsDef = ( +my @optionsDef = ( # help + verbose already handled in 'GetOptions' - "l" => {fieldname => "Lang", - type => "=s", alias=>["lang"], - comment => "Comma separated list of desired languages"}, - "math" => {fieldname => "Math", - comment => "Select fonts probably containing math glyphs"}, - "n" => {fieldname => "FontName", listsep => ',', - type => "=s", alias => ["name"], - comment => "Select font-names matching these (comma separated) regexes"}, - "nn" => {fieldname => "NFontName", - type => "=s", listsep => ',', - comment => "Select font-names NOT matching these (comma separated) regexes"}, - "pl" => {fieldname => "PrintLangs", alias => ["printlangs"], - comment => "Print supported languages"}, - "pf" => {fieldname => "PrintFiles", alias => ["printfiles"], - comment => "Print font file names"}, - "p" => {fieldname => "Property", - type => "=s", listsep => ',', - comment => "Select fonts with properties matching these (comma separated) regexes"}, - "np" => {fieldname => "NProperty", - type => "=s", listsep => ',', - comment => "Select fonts with properties NOT matching these (comma separated) regexes"}, - "pp" => {fieldname => "PrintProperties", alias => ["printproperties"], - comment => "Print properties from weight, slant and width"}, - "s" => {fieldname => "Scripts", - type => "=s", listsep => ',', - comment => "Select fonts with scripts matching these (comma separated) regexes"}, - "ns" => {fieldname => "NScripts", - type => "=s", listsep => ',', - comment => "Select fonts with scripts NOT matching these (comma separated) regexes"}, - "ps" => {fieldname => "PrintScripts", alias => ["printscripts"], - comment => "Print supported scripts"}, - "pw" => {fieldname => "PrintWarnings", - comment => "Print warnings about discarded/overwritten fonts, conflicting styles"}, + ["n", + {fieldname => "FontName", listsep => ',', + type => "=s", alias => ["name"], + comment => "Select font-names matching these (comma separated) regexes"},], + ["nn", + {fieldname => "NFontName", + type => "=s", listsep => ',', + comment => "Select font-names NOT matching these (comma separated) regexes"},], + ["p", + {fieldname => "Property", + type => "=s", listsep => ',', + comment => "Select fonts with properties matching these (comma separated) regexes"},], + ["np", + {fieldname => "NProperty", + type => "=s", listsep => ',', + comment => "Select fonts with properties NOT matching these (comma separated) regexes"},], + ["s", + {fieldname => "Scripts", + type => "=s", listsep => ',', + comment => "Select fonts with scripts matching these (comma separated) regexes"},], + ["ns", + {fieldname => "NScripts", + type => "=s", listsep => ',', + comment => "Select fonts with scripts NOT matching these (comma separated) regexes"},], + ["math", + {fieldname => "Math", + comment => "Select fonts probably containing math glyphs"},], + ["l", + {fieldname => "Lang", + type => "=s", alias=>["lang"], + comment => "Comma separated list of desired languages"},], + ["pl", + {fieldname => "PrintLangs", alias => ["printlangs"], + comment => "Print supported languages"},], + ["pp", + {fieldname => "PrintProperties", alias => ["printproperties"], + comment => "Print properties from weight, slant and width"},], + ["ps", + {fieldname => "PrintScripts", alias => ["printscripts"], + comment => "Print supported scripts"},], + ["pf", + {fieldname => "PrintFiles", alias => ["printfiles"], + comment => "Print font file names"},], + ["pw", + {fieldname => "PrintWarnings", + comment => "Print warnings about discarded/overwritten fonts, conflicting styles"},], ); -my %options = %{&handleOptions(\%optionsDef)}; +my %options = %{&handleOptions(\@optionsDef)}; $options{Lang} = "" if (! defined($options{Lang}));