Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to embed a true type font within a postscript file

I have a cross platform app and for my Linux and Mac versions it generates a postscript file for printing reports and then prints them with CUPS. It works for simple characters and images but I would like to have the ability to embed a true type font directly into the postscript file. Does anyone know how to do this?? Also I can encode simple ascii characters but I'm not sure how to encode any characters beyond the usual a-z 0-9, things like foreign characters with accents.

like image 354
KPexEA Avatar asked Sep 17 '08 01:09

KPexEA


1 Answers

In order to embed a TrueType font in a Postscript document, you will first need to convert it to a Type 42 font. This conversion turns the font into postscript code. There are several small utilities for doing this conversion, or you can read the Type 42 specification and write your own code for it.

Embedding Type 1 fonts is a lot easier. Linux ships with a large set of Type 1 fonts, and so does OS X if you have X11 installed. Generating PDF instead is also an option you may want to look into, since PDF can embed TrueType fonts directly.

like image 144
ccxvii Avatar answered Sep 27 '22 16:09

ccxvii