blob: bec9b4b760f1b5eba44763fbe5cb92a5b95b5c0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/perl
# Extract: Version 0.00 Font Name Bold
use warnings;
#http://www.perlmonks.org/bare/?node_id=224506
use strict;
use Font::TTF::Font;
#use CGI qw(:all);
#print header();
my $rv=1;
if ( $#ARGV >= 0 ) {
my $f = $ARGV[0];
my $fontname = Font::TTF::Font->open($f);
if (ref $fontname) {
my $fnar;
if ($fnar = $fontname->{name}) {
my $fr=$fnar->read;
# http://www.microsoft.com/typography/otspec/name.htm Name IDs
print $fr->find_name(5)." ".$fr->find_name(4);
$rv=0;
}
$fontname->release();
}
} else {
print "Usage: $0 foo.ttf\n";
print "Result: Version 1.05 Foo Narrow Bold Italic\n";
}
exit($rv);
|