#!/usr/bin/perl
# 
# Copyright (C) Koji Nakamaru
#
# Author: Koji Nakamaru (nakamaru at gmail.com)
# Modified: Apr 30 2005
#   * changed the contact information.
# Modified: May 13 2002
# Created/Modified: Apr 19 2002
# Keywords: xdvi, ghostscript, metapost
#
# This file is part of xdvigs.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Emacs; see the file COPYING.  If not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#

system '/bin/rm -rf xdvigs';
system '/bin/mkdir xdvigs';
chdir 'xdvigs';
open FO, ">Fontmap";
printf FO "%%!\n";
for ($i = 0; $i <= $#ARGV; $i++) {
    open FI, "find $ARGV[$i] -name '*.pfb'|";
    while (<FI>) {
	chop;
	$name = $_;
	if (/.*\/([^\/]+)\.pfb/) {
	    printf FO "/%-20s\t%-30s;\n", $1, "($1.pfb)";
	    symlink($name, "$1.pfb");
	}
    }
    close FI;
}
printf FO "/%-20s\t%-30s;\n", 'rml', '/Ryumin-Light-H';
printf FO "/%-20s\t%-30s;\n", 'rmlv', '/Ryumin-Light-V';
printf FO "/%-20s\t%-30s;\n", 'gbm', '/GothicBBB-Medium-H';
printf FO "/%-20s\t%-30s;\n", 'gbmv', '/GothicBBB-Medium-V';
