Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

embedding ttf fots inside raw postscript file.

Status
Not open for further replies.

stigic

Programmer
Oct 3, 2005
11
PL
hello,
i'm working on an exporter for postscript files on a project which allready has pdf export. so i'm addapting a lot of code. everything works quite fine.
now the pdf export supports embedding of ttf fonts. is this possible in postscript too?
and if so, could someone give me a short hint, on how to do it?

thanks!
 
PostScript doesn't support TrueType fonts. They must be converted first, usually to Type 42 fonts. That's the job of a driver or application, not PostScript.

Thomas D. Greer
 
so i took another look at the pdf export. it uses type0 fonts with cmap which contains only glyphs which are in use. then it includes a font inside this type0 font, which has a "/FontFile2" entry in its dictionary.
the value for this entry is a bytestream which is some kind of extract from the ttf-file.

am i right, that i cant do it a simmilar way, because there's no such thing like the /FontFile2 key inside postscript font dictionarys?


extract from the pdf spect:
______________________________
- FontFile: stream (Optional) A stream containing a Type 1 font program (see Section 5.8, “Embedded Font Programs”).

- FontFile2: stream (Optional; PDF 1.1) A stream containing a TrueType font program (see Section 5.8, “Embedded Font Programs”).

- FontFile3: stream (Optional; PDF 1.2) A stream containing a font program whose format is specified by the Subtype entry in the stream dictionary (see Table 5.23 and implementation note 67 in Appendix H).

At most, only one of the FontFile, FontFile2, and FontFile3 entries may be
present.
_______________________________
 
okay, everything has become much clearer now!
i managed to include the ttf file as type42 font.
i even managed to only include needed glyphs.

the next problem i stumbled:
unicode

so i decided to create a CIDType 2 font, which has simmilar features to the type42 one.

but now i dont get the damn thing working. postscript allways complains about ./invalidfont

i also didnt manage to create a valid CIDMap. what's the format of this damn thing? i choose to use /CIDMap 0 (according to the type42 specs where was mentioned that you can define CIDMap as an integer which just stands as offsed CID = int+GI)
but the font still isnt accepted.

somebody able to help me on that?
 
maybe it's good to post the source of the font:

<<
/CIDFontType 2
/CIDFontName /F1
/CIDSystemInfo <</Supplement 0
/Ordering (Identity)
/Registry (Adobe)
>>
/CIDBytes 2
/CIDCount 15
/FontName /F1
/FontType 42
/FontMatrix [ 1.0 0.0 0.0 1.0 0.0 0.0 ]
/PaintType 0
/Encoding StandardEncoding
/FontBBox [-138 -306 1062 986]
/CIDMap 0
/CharStrings << /.notdef 0 >>
/sfnts [
%....
%some strings representing the ttf data including 15 glyphs
%....
]
>> begin FontName currentdict end definefont pop
 
omg typo...
shouldnt be GIDBytes but GDBytes.......
 
Are you using the right tools for the job ?
Ghostscript already has PDF to high level PostScript
conversion. (ps2write driver). Your problem can
be solved in 1 line of a shell script.


Your PostScript expert is just a click away.
 
i'm shure about my task ;)

actually ir works quite fine. but when zooming the page characters are disapearing... i will open a new thread for that...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top