2006-12-11 22:31:12 UTC
Hi,
I've been trying to realize how to use some font files I have here. In short I'm creating a simple PDF, but I need to use a specific font. I have some files which are fonts of type "Postscript Type 1". Having read the feature list of TCPDF I understand that this is/should be supported :)
But I'm at loss on how to use these files.. The Documentation for TCPDF->AddFont() says "Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility". Reading this it seems this is the place to import my font, but it says that I need to generate some definitions using the utility I believe is makefontuni.php.
I have looked at makefontuni.php and read some of its code, part of which is:
function MakeFont($fontfile,$ufmfile)
{
//Generate a font definition file
set_magic_quotes_runtime(0);
if(!file_exists($ufmfile))
die('<B>Error:</B> UFM file not found: '.$ufmfile);
$cidtogidmap = '';
$fm=ReadUFM($ufmfile, $cidtogidmap);
$fd=MakeFontDescriptor($fm);
//Find font type
if($fontfile)
{
$ext=strtolower(substr($fontfile,-3));
if($ext=='ttf')
$type='TrueTypeUnicode';
else
die('<B>Error:</B> not a truetype font: '.$ext);
}
else
{
if($type!='TrueTypeUnicode')
die('<B>Error:</B> incorrect font type: '.$type);
}
Looking at this i don't see how it can ever continue execution beyond this unless it is given a TTF file (this because in the else-statement, $type is checked and, as far as I can see in the rest of the code, it will not be "TrueTypeUnicode", and the die() will execute. And if we give it ($fontfile) a file which is not .ttf then it will die() also..).
So, could someone please give me some hints on how i should/can use my Type 1 font files in TCPDF?
A couple of starting questions (have Googled, but without much luck):
1) What is this UFM that is mentioned quite a lot? TTF seems to be a font file format, which I would also guess Type 1 to be, but is Type 1 and UFM the same?
2) What's this Font Suitcase thing? Do I need it to use my font file with TCPDF? If so, in what way/how?
I truly appreciate any pointers/help! Thank you :)
// Leo