#This perl script links the codec config file
#and the fonts dir to the user's home dir.
#Last touched: 2002-12-16 riggs

if (-e "$ENV{HOME}/.mplayer/font")
{
	print "Sorry, font link is already existing.\n";
	exit 1;
}

#Determining location of fonts:

@pkg=`pkg_info -Lx mplayer-fonts`;
print "$prefix[3]";
$prefix=$pkg[3];
$prefix=~ s/(.+mplayer).*/$1/;
chop $prefix;

if ($1 eq "")
{
	print "You have no mplayer-fonts installed.\n";
	exit 1;
}

print "You may choose any of the available language sets:\n\n";
print "ISO-8859-1 Font : 1\n";
print "ISO-8859-2 Font : 2\n";
print "(old) Cyrillic fonts : c\n";
print "Russian fonts : r\n";

print "Your decision? ";
chomp ($lang=<STDIN>);
print "\n";

if ($lang eq "1" || $lang eq "2")
{
	print "The available sizes for this font are 14,18,24,28.\n";
	print "Please enter the wanted size: \n";
	chomp ($size=<STDIN>);
	if ($size ne "14" && $size ne "18" && $size ne "24" && $size ne "28") {$size=14;}
}

unless (-e "$ENV{HOME}/.mplayer") {system "mkdir $ENV{HOME}/.mplayer";}

if ($lang eq "c")
{
	system "ln -sv $prefix/fonts/cyrillic/ $ENV{HOME}/.mplayer/font";
}
elsif ($lang eq "r")
{
	system "ln -sv $prefix/fonts/koi8r-font/ $ENV{HOME}/.mplayer/font";
}
elsif ($lang eq "2")
{
	system "ln -sv $prefix/fonts/iso-8859-2/arial-$size/ $ENV{HOME}/.mplayer/font";
}
else {system "ln -sv $prefix/fonts/iso-8859-1/arial-$size/ $ENV{HOME}/.mplayer/font"};
