#!/usr/bin/perl
#
# եȥꥹȥեץ for EWB3.3
# (c)1999-2001 ҥ
#

while (<>) {
if (/(.*)\\DeclareFontShape{(.*)}{(.*)}{(.*)}{(.*)}{[ ]*<->[ ]*(.*)}{}(.*)/) {
	$head = $1;
	$kind = "$2";
	$nfss = "$2/$3/$4/$5";
	$tfm = "$6";
	if ($7 eq "") {
		$comment = "% $6";
	} else {
		$comment = $7;
	}
	$head =~ s/%/#/ ;
	$comment =~ s! *% *!!;

	if (index($comment,"sub*") >= 0 ) { next; }

	if ($kind eq "JY1" || $kind eq "SY1" ){
		$kind = 1;
	} elsif ($kind eq "SY1" || $kind eq "ST1") {
		$kind = 2;
	} else {
		$kind = 0;
	}

	if (index($comment,"\"") >= 0 ) {
		($stedname = $comment) =~ s/(.*) +".* (.*)"/$1/;
		$variant = $2;
		if (index($stedname,"-") < 0 ) { $stedname = $stedname."-"; }
		if ($variant eq "SlantFont") { $variant = "Oblique"; }
		if ($variant eq "ExtendFont") { $variant = "Bold"; }
		$stedname = $stedname.$variant;
		$comment = " # ".$comment;
	} elsif (index($comment,"\'") == 0 ) {
		($stedname = $comment) =~ s/'(.*) +\+(.*)'/$1-$2/;
		$comment = " # ".$comment;
	} elsif (index($comment,"\'") > 0 ) {
		($stedname = $comment) =~ s/(.*) +'(.*)'/$1/;
		$variant = $2;
		$comment = " # '".$2."'";
	} else {
		$stedname = $comment;
		$variant = "";
		$comment = "";
	}
	printf("%s%-3s%-18s%s\t%s%s\n",$head,$kind,$nfss,$tfm,$stedname,$comment);
}
}
