Module to retrieve general TTF font info

Module to retrieve general TTF font info

am 31.05.2005 13:16:21 von hoyoul

I'm attempting to find a module that will allow me to retrieve general
information regarding a TrueType font.

Typeface Name
File Size
Version
Author, Copyright info and/or Comments
(Basically what you would see as a header when you double click a ttf
file in windows)

I'm particularly interested in the Author info, but I am not sure which
modules will do this. Anyone have a clue? I tried looking into
Font::TTF::Font and Font::FreeType but was unable to find a solution.
Any help would greatly be appreciated.

Thank,
Hoyoul

Re: Module to retrieve general TTF font info

am 02.06.2005 13:44:25 von Michael Piotrowski

hoyoul@gmail.com writes:

> I'm attempting to find a module that will allow me to retrieve general
> information regarding a TrueType font.
>
> Typeface Name
> File Size
> Version
> Author, Copyright info and/or Comments
> (Basically what you would see as a header when you double click a ttf
> file in windows)
>
> I'm particularly interested in the Author info, but I am not sure which
> modules will do this. Anyone have a clue? I tried looking into
> Font::TTF::Font and Font::FreeType but was unable to find a solution.

You can do that using Font::TTF::Font. Here's an example:

use Font::TTF::Font;

my $f = Font::TTF::Font->open($ARGV[0]);
my $t = $f->{name}->read;

print $t->{strings}[6][1][0]{0}, "\n";
print $t->{strings}[0][1][0]{0}, "\n";

This will print the PostScript name and the copyright information of
a font specified on the command line.

Have a look at the Font::TTF::Name(3) man page and

http://developer.apple.com/fonts/TTRefMan/RM06/Chap6name.htm l
http://www.microsoft.com/typography/otspec/name.htm

for details about the numbers.

HTH

--
Michael Piotrowski, M.A.
Public key at