#!/usr/bin/perl use Font::TTF::Font; use Getopt::Std; use Pod::Usage; use Font::TTF::Scripts::Name; our $CHAIN_CALL; our ($if, $of, %opts); unless ($CHAIN_CALL) { getopts('f:hl:n:pqr:s:t:w:', \%opts); unless (defined $ARGV[1] || defined $opts{h}) { pod2usage(1); exit; } if ($opts{h}) { pod2usage( -verbose => 2, -noperldoc => 1); exit; } $if = Font::TTF::Font->open($ARGV[0]) || die "Can't read font $ARGV[0]"; } $of = ttfname($if, %opts); unless ($CHAIN_CALL) { $of->out($ARGV[1]) || die "Can't write to font file $ARGV[1]. Do you have it installed?"; } __END__ =head1 TITLE ttfname - renames font files =head1 SYNOPSIS ttfname [-f "full_name"] -n "name" [-t num] [-q] infile.ttf outfile.ttf Renames the TTF with the given name and outputs the newly named font to out.ttf. =head1 OPTIONS -f "name" specifies new full name (optional) as opposed to the default calculated form. -l lang language number to use (default all langs) if specified name entries will be added for all platforms and encodings covered by the cmap if not already there -n "name" specifies new font family name (not optional) -p Don't update postscript font name -q disable signon message -r num Removes all strings of the given ids. Space- or comma-separated ids or id ranges (denoted by "..") may be specified. -s filename overrides -n and gets string from file. Useful for -t -t num overrides the normal naming areas to change another string -f becomes inactive. Use -l as well to create entry. -w "name" overrides subfamily in the font (think weight). So a full name may be made from -n and -w together.