Just in case ANYONE cares....I ended up writing my own solution:
pass a .ttf file and it will return the name of the font.
function getFontName($filename)
{
//turn off magic quotes for a clean binary read
set_magic_quotes_runtime(0);
if(!$fp = fopen($filename, 'rb'))
return;
// forward to the first table
fseek($fp, 12);
// find the naming table entry
while(!strstr($contents = fread ($fp, 4), "name"))
;
//throw away the checksum
fread($fp, 4);
//read the offset
$str = fread($fp, 4);
$offset = unpack("Ndata", $str);
$begOfTable = $offset["data"];
fseek($fp, $begOfTable);
//skip 4 bytes
fread($fp, 4);
//read the offset to the string storage
$str = fread($fp, 2);
$offset = unpack("ndata", $str);
$begOfStorage = $begOfTable + $offset["data"];
//keep reading until we find the Font Family Name entry
//font name == 1, full font name == 4)
do
{
$str = fread($fp, 12);
$result = unpack("n6data", $str);
}
while($result["data4"] != 1);
// go get our string "data6" is the offset "data5" is the length
fseek($fp, $begOfStorage + $result["data6"]);
$str = fread($fp, $result["data5"]);
set_magic_quotes_runtime(get_magic_quotes_gpc());
fclose($fp);
return $str;
}
microsofts documentation of the font file is here:
http://www.microsoft.com/typography/tt/ttf_spec/ttch02.doc?fname=%20&fsize=
see ya....