Fontforge - File Open Warnings

TOM-MLL's picture

I am using Perl (readpipe) to grab the fontname value from a font via Fontforge. For example:

my $psfontname = readpipe("/usr/local/bin/fontforge -script /webfont/getfontname.pe font.ttf");

The problem is, Fontforge always outputs all the warnings when it loads a font, so I end up with a multiline output of values I do not want. Anyone know how to disable Fontforge doing that on file open? I am using is via command line only.

Example warnings:
Warning: Mac and Windows entries in the 'name' table differ for the
Family string in the language English (US)

Michel Boyer's picture

duplicate - delete

Michel Boyer's picture

I don't know perl but here are some relevant remarks. According to perldoc, readpipe collects the standard output (which is stdout) whereas FontForge warning messages are written to stderr. If you call psname.pl the following script

my $font = $ARGV[0] ;
my $psfontname = 
   readpipe("/opt/local/bin/fontforge -script psname.pe " 
               . $font) ;
print  $psfontname  ;

then the call

perl psname.pl ArnoPro-Regular.otf > savename

sends only the postscript name into the file savename. If you want to see only the standard output and no warning message, you can type

perl psname.pl ArnoPro-Regular.otf 2>/dev/null

You could also redirect stderr inside the perl script

my $font = $ARGV[0] ;
my $psfontname = 
   readpipe("/opt/local/bin/fontforge -script psname.pe " 
               . $font . 
               " 2>/dev/null") ;
print  $psfontname  ;

where 2>/dev/null redirects stderr to /dev/null.

Instead of sending the messages to the garbage can, you could append them to a log file with 2>>file.log.

abattis's picture

I just added a -quiet mode to not print non-essential information to stderr so now you can do this:

my $psfontname = readpipe("/usr/local/bin/fontforge -quiet -script /webfont/getfontname.pe font.ttf");

abattis's picture

I just added a -quiet mode to not print non-essential information to stderr so now you can do this:

my $psfontname = readpipe("/usr/local/bin/fontforge -quiet -script /webfont/getfontname.pe font.ttf");

Syndicate content Syndicate content