diff options
Diffstat (limited to 'perl-install')
-rwxr-xr-x | perl-install/standalone/drakfont | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index 914ac8856..0a50f8948 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -207,9 +207,16 @@ sub list_fontpath { sub chk_empty_xfs_path { - foreach (@installed_fonts_path) { - if (3 > all($_)) { - system("chkfontpath -r $_") or + my @temp3; + foreach my $tmp_path (@installed_fonts_path) { + @temp3 = (); + foreach my $temp2 (all($tmp_path)) { + if (!(($temp2 =~ /^fonts/ ) || ($temp2 =~ /^type/ ))) { + push @temp3, $temp2; + } + } + if(!(@temp3)) { + system("chkfontpath -r $tmp_path ") or print "PERL::system command failed during chkfontpath\n"; } } @@ -221,9 +228,9 @@ sub chk_empty_xfs_path { sub search_installed_fonts { list_fontpath(); - $interactive and progress($pbar, 0, _("search installed fonts")); + $interactive and progress($pbar, 0.01, _("Search installed fonts")); push @installed_fonts, all($_) foreach @installed_fonts_path; - $interactive and progress($pbar, 1/3, _("Search fonts in install list")); + $interactive and progress($pbar, 1/4, _("Unselect fonts installed")); } sub search_installed_fonts_full_path { @@ -249,7 +256,7 @@ sub search_windows_font { foreach $_ ([\@list_fonts_win, "windows"], [\@list_fonts_winnt, "winnt"]) { foreach my $i (@{$_->[0]}) { if($interactive) { - if($nb_dir) { progress($pbar, 0.34/$nb_dir, _("parse all fonts")) } else { + if($nb_dir) { progress($pbar, 0.25/$nb_dir, _("parse all fonts")) } else { display_error(_("no fonts found")); return 0; } @@ -258,7 +265,7 @@ sub search_windows_font { grep ( /$i$/, @font_list) or push @font_list, "$win_dir/$_->[1]/fonts/$i"; } } - $interactive && $nb_dir and progress($pbar, 1/3, _("done")); + $interactive && $nb_dir and progress($pbar, 1/4, _("done")); } 1; } @@ -268,32 +275,36 @@ sub is_a_font { /.ttf$/i || /.pfa$/i || /.pfb$/i || /.pcf$/i || /.pcf.gz$/i || /.pfm$/i || /.gsf$/; } +# Optimisation de cette etape indispensable + sub search_dir_font { - my ($fn) = @_; - my @font_list_tmp = (); - my @font_list_tmpp = (); - my $dir ; - if (!(-e $fn )) { print "$_ :: no such file or directory \n" } else { - if ( -d $fn ) { - $dir = $fn; - foreach my $i (all($fn)) { - if (is_a_font($i)) { - push @font_list_tmp, "$i"; - foreach my $i (@font_list_tmp) { - !$replace && grep(/$i/, @installed_fonts) and next; - grep /$i/, @font_list or push @font_list, "$fn/$i"; + foreach my $fn (@install) { + my @font_list_tmp = (); + my @font_list_tmpp = (); + my $dir ; + if (!(-e $fn )) { print "$_ :: no such file or directory \n" } else { + if ( -d $fn ) { + $dir = $fn; + foreach my $i (all($fn)) { + if (is_a_font($i)) { + push @font_list_tmp, "$i"; + foreach my $i (@font_list_tmp) { + !$replace && grep(/$i/, @installed_fonts) and next; + grep /$i/, @font_list or push @font_list, "$fn/$i"; + } } } - } - } else { - if (is_a_font($fn)) { - !$replace && grep(/$fn/, @installed_fonts) and next; - !grep /$fn/, (@installed_fonts) and push @font_list, "$fn"; + } else { + if (is_a_font($fn)) { + !$replace && grep(/$fn/, @installed_fonts) and next; + !grep /$fn/, (@installed_fonts) and push @font_list, "$fn"; + } } } + $interactive and progress($pbar, 0.50/@install, _("Reselect correct fonts")); } + $interactive and progress($pbar, 1/3, _("done")); !@font_list && $interactive and display_error(_("could not find any font.\n")); - $interactive and progress($pbar, 2/3, _("done")); } sub search_dir_font_uninstall { @@ -343,10 +354,12 @@ sub put_font_dir { $interactive and progress($pbar1, 1/@font_list, _("Fonts copy")); } $interactive and progress($pbar1, 0.01, _("done")); - $interactive and progress($pbar2, 0.40, _("True Type fonts installation")); + $interactive and progress($pbar2, 0.10, _("True Type fonts installation")); system ("cd $drakfont_dir/tmp/tmp && cp *.ttf ../../ttf"); + $interactive and progress($pbar2, 0.20, _("please wait during ttmkfdir...")); system ("cd $drakfont_dir/ttf && $ttmkfdir > fonts.dir" ); + $interactive and progress($pbar2, 0.10, _("True Type install done")); my $restart_xfs = "$chkfontpath -a $drakfont_dir/ttf"; if ($so && $gs) { @@ -358,6 +371,7 @@ sub put_font_dir { system ("cd $drakfont_dir/tmp/tmp && mv *.gsf *.pfb *.pfm *.afm ../Type1"); system ("cd $drakfont_dir/tmp/Type1 && $type1inst" ); $interactive and progress($pbar2, 0.10, _("type1inst building")); + -e "$drakfont_dir/tmp/Type1/Fontmap" and system ("cd $drakfont_dir/tmp/Type1 && cat Fontmap >> `rpm -ql ghostscript | grep Fontmap.GS` " ); system ("cd $drakfont_dir/tmp/Type1 && mv *.pfm *.gsf *.afm *.pfb ../../Type1 "); system ("cd $drakfont_dir/Type1 && $type1inst"); @@ -432,7 +446,7 @@ sub remove_gs_fonts { sub remove_fonts { my @list_dir; -e $drakfont_dir . "/remove" || mkdir_p($drakfont_dir . "/remove"); - $interactive and progress($pbar, 0.75, _("done")); + $interactive and progress($pbar, 1, _("done")); foreach my $i (@font_list) { $_ = $i; if ( /.pfb$/ || /.gsf$/ || /.pfm$/ || /.pfa$/ ) { @@ -488,7 +502,7 @@ sub backend_mod { license_msg(); print "\nInstall Specifics Fonts...........\n"; search_installed_fonts(); - search_dir_font $_ foreach (@install); + search_dir_font; print "Font to install : " . $_ . "\n" foreach (@font_list); put_font_dir(); print "\nThe End...........................\n"; @@ -848,7 +862,7 @@ sub import_status { $table = create_packtable({ col_spacings => 10, row_spacings => 50}, ["",""], [_("Initials tests"), $pbar, $pbar->{label} = new Gtk::Label(' ' )], - [_("Copy all fonts on your system"), $pbar1,$pbar1->{label} = new Gtk::Label(' ' ) ], + [_("Copy fonts on your system"), $pbar1,$pbar1->{label} = new Gtk::Label(' ' ) ], [_("Install & convert Fonts"), $pbar2, $pbar2->{label} = new Gtk::Label(' ' ) ], [_("Post Install"), $pbar3,$pbar3->{label} = new Gtk::Label(' ' ) ], ), |