#!/usr/bin/perl my $RCS_Id = '$Id: font2pfa.pl,v 1.7 2000-02-04 10:32:30+01 jv Exp $ '; # Author : Johan Vromans # Created On : Fri Dec 20 16:21:21 2002 # Last Modified By: Johan Vromans # Last Modified On: Fri Dec 20 17:04:07 2002 # Update Count : 17 # Status : Released ################ Common stuff ################ use strict; my $my_package = 'Sciurix'; my ($my_name, $my_version) = $RCS_Id =~ /: (.+).pl,v ([\d.]+)/; $my_version .= '*' if length('$Locker: $ ') > 12; ################ Program parameters ################ use Getopt::Long 2.00; my $output; my $verbose = 0; my $afm = 0; my ($debug, $trace) = (0, 0); options (); ################ Presets ################ use PostScript::Font::TTtoType42; ################ The Process ################ my $font = new PostScript::Font::TTtoType42:: ($ARGV[0], debug => $debug, trace => $trace, verbose => $verbose); die("$font: Error opening\n") unless $font; if ( defined $output ) { open (STDOUT, ">$output") || die ("$output: $!\n"); } print STDOUT ($afm ? ${$font->afm_as_string} : ${$font->as_string}); ################ Subroutines ################ sub options { my $help = 0; # handled locally my $ident = 0; # handled locally # Process options. if ( @ARGV > 0 && $ARGV[0] =~ /^[-+]/ ) { usage () unless GetOptions ("ident" => \$ident, "verbose" => \$verbose, "output=s" => \$output, "afm" => \$afm, "trace" => \$trace, "help" => \$help, "debug" => \$debug) && !$help; } print STDERR ("This is $my_package [$my_name $my_version]\n") if $ident; usage () unless @ARGV <= 1; @ARGV = ("-") unless @ARGV; } sub usage { print STDERR < converts a True Type font to PostScript font. The program takes, as command line argument, the name of a True Type font file. The font data will be wrapped in Type42 format and written to the output. B depends on the capabilities of the modules C and C. =head1 OPTIONS =over 4 =item B<-output> filename Writes the output to the named file. If this option is omitted, output is sent to standard output. =item B<-afm> Output the font metrics in AFM format. =item B<-help> Print a brief help message and exits. =item B<-ident> Prints program identification. =item B<-verbose> More verbose information. =back =head1 AUTHOR Johan Vromans, Squirrel Consultancy =head1 COPYRIGHT and DISCLAIMER This program is Copyright 2002,1999 by Squirrel Consultancy. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" which comes with Perl. 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 either the GNU General Public License or the Artistic License for more details. =cut