Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Postscript with new TT font

by Anonyrnous Monk (Hermit)
on Feb 09, 2011 at 21:32 UTC ( #887299=note: print w/replies, xml ) Need Help??

in reply to Postscript with new TT font

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:

$ ttfwrapper verdana.ttf > verdana.t42

Then - in its absolutely most simple case - write a Postscript file something like this

%!PS ... embedded font goes here ... /Verdana findfont 30 scalefont setfont 100 100 moveto (Some text in Verdana font) show showpage

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.

Replies are listed 'Best First'.
Re^2: Postscript with new TT font
by ksublondie (Friar) on Feb 10, 2011 at 16:03 UTC
    Thanks for filling in the gaps. You've gotten me down the right direction. Thanks!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://887299]
[Discipulus]: a bit shaggy.. every atttempt is ~4hours to virtualize and 1-2hours to kick the big file to boot..
[Lady_Aleena]: Ouch...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-05-22 18:52 GMT
Find Nodes?
    Voting Booth?