|Welcome to the Monastery|
Re: Postscript with new TT fontby Anonyrnous Monk (Hermit)
|on Feb 09, 2011 at 21:32 UTC||Need Help??|
I need to create postscript content using a true-type font
The general idea would be to convert the true-type font to Type42 format, and then embed it into the Postscript file.
(The requirement to embed the font holds for any "non-standard" font, whether it be true-type/Type42 or standard PS Type1. There are a certain number of predefined standard fonts a printer must have to call itself PS compatible, but it may also come with additional fonts).
You can convert the TT font with PostScript::Font::TTtoType42, either as shown in the synopsis of the module, or by using the script ttfwrapper that comes with the module. For example:
Then - in its absolutely most simple case - write a Postscript file something like this
and insert the entire PS code for the .t42 font (as generated by ttfwrapper) where indicated. You then have a sample stand-alone PS file which would print a line of text in a non-standard font. Of course, use your correct font name instead of "Verdana"... (you can find the name as an entry /FontName (such as /FontName /Verdana def) near the beginning of the font file).
Essentially, a font file is a set of Postscript instructions that, when executed, define everything required, like drawing routines for the glyphs, the encoding vector, etc.
If you use a module (like PostScript::Simple) to generate the Postscript code, you'll also have to find some way to embed the font (I haven't used the module, so I'd have to check the docs just like you...). In case of doubt, when there's no dedicated procedure for doing so, you can always insert the font(s) after the PS output has been generated. In its most simple case, insert the fonts at the beginning — or see "Resource Management" in the Document Structuring Conventions (DSC) for more sophisticated techniques.