#!/usr/bin/perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
    if $running_under_some_shell;
##
##  gfont_mkgdf_all -- Pregenerate all GdF Files from Fontmap
##  Copyright (c) 1997 Ralf S. Engelschall, <rse@engelschall.com>
##

require 5.003;
use strict;

use vars qw($gfontpath $mkgdf $fontmap);
use vars qw(@FONT $font);

$gfontpath = $ENV{'GFONT_BASE'} || "/usr/lib/gfont";
$mkgdf     = "$gfontpath/exec/gfont_mkgdf";
$fontmap   = "$gfontpath/etc/Fontmap";

sub system {
    my ($cmd) = @_;

    printf("$cmd\n");
    system($cmd);
}

@main::FONT = ();
open(FP, "<$fontmap");
while (<FP>) {
    next if (m|^\s*#|);
    next if (m|^\s*$|);
    if (m|^(\S+)\s|) {
        push(@main::FONT, $1);
    }
}
close(FP);

foreach $font (@main::FONT) {
    &system("$mkgdf $font");
}

##EOF##
