Sunday, May 17, 2009

Convert the OTF fonts to Postscript Type one (.pfb)

The conversion is lossless as the hinting remain, however you can't do this reliably for large fonts (with more than 256 characters or glyphs). Here is a sample script allowing to convert OpenType fonts to postscript Type One fonts, you will end up with a .afm and a .pfb file :

# Quick and dirty hack: converts a font to Postscript Type one (.pfb)

while ( i<$argc )
Print("Opening : " +$argv[i]);
if($argv[i]:e != "otf")
Print( "Skipping ... Expecting an OpenType font [.otf]" )
Print("Saving : " +$argv[i]:r+".pfb");
# If the font is a cid keyed font, you may want to flatten the cid map
# To do this, uncomment the command below :
# CIDFlatten()
Generate($argv[i]:r + ".pfb")
i = i+1

Save this script as and set the executable bit ( chmod +x ). To launch this script, just do : ./ *.otf
or make otf2pfb
for i in $@; do
fontforge -script /usr/bin/ $i

and make this executable
and go in terminal to font folder and type:
otf2pfb fontname.otf

For all fiels in a folder do:

otf2pfb *.otf otf

Now the only thing remaining to do is installing the Type1 fonts in the system. For this Mandriva users can use drakfont, others can use type1inst after having copyed the files in /usr/share/fonts/Type1/.

No comments:

Blog Archive

About Me

Exclusion of liability Regarding StillStupid: The use you make of the guides, tips and downloads that you listed on this web site or on another website to which I refer is entirely at your own risk. In no way can I be held liable for damage or consequential damages of any kind, which occurs as a result of that use.