pfb2otf

Michel Boyer
30.Sep.2007 1.14pm
Michel Boyer's picture

The question of how to convert pfb font files to a format that can be used on the Mac was raised in two recent threads, one with FortForge, another one with FontLab.

With FontLab, that looks quite easy. With FontForge, for those that are not Unix Shell or Python literate, that may be tricky. I thus wrote a small Mac application pfb2otf that you can download by clicking here and that makes it easy too: you double click the icon of pfb2otf, select the folder containing the afm and pfb files of the fonts to convert, and that is it. If the afm file is not there, you lose kerning.

Now for Mac programmers: if you have a look at the script pfb2otf.app/Contents/MacOS/pfbtootf that does everything (in 70 lines or so), could you tell me what would have been the proper way to pass information from Applescript to the Unix shell? I fudged something using temporary files. Is there a good reference on this? Moreover, to show what is being done during processing, I display in a Finder window the otf files that are being generated; sometimes the displayed size is Zero KB, whilst the file is definitely not empty as we see when we check with File Info. Where is the bug?

Michel

May 13 2009: link to pfb2otf modified following this post.
May 13 2009: pfb2otf now returns an error if X11 is not installed.
May 14 2009: And here is pfb2otfpy, that does not require X11, and can also read data from pfm files.



Reetsde
30.Sep.2007 1.40pm
Reetsde's picture

looks nice. I will check the resulting otfs later but this seems to be a nice solution.

The zero KB display in Finder is a known “misbehavior” of the Finder it is a bit lazy updating the info. Easiest way to get correct values is to change view mode of the finder window to icon view and back to details.

I’m not familiar with Fontforge. How you script it? With Python? Then you could better build a small PyObj app with xCode.

Georg


Michel Boyer
30.Sep.2007 2.12pm
Michel Boyer's picture

> How you script it? With Python?

No I used the fontForge script language, old fashioned Bourne shell and called osascript when needed, trying to depend on as few resources as possible. That means a 70 line script file, plus the file Info.plist (40 lines of text), plus an icon which is the big part, 40312 bytes.


Michel Boyer
1.Oct.2007 1.55pm
Michel Boyer's picture

> Easiest way to get correct values is to change view mode of the finder window to icon view and back to details.

I changed the script to do that. The window flickers but at least the sizes are fixed when the files are first generated. Thanks.


Corsara
28.Jul.2008 7.16am
Corsara's picture

Worked perfectly for me. Thanks for posting this, it’s a life saver.


Yehan
19.Nov.2008 8.47pm
Yehan's picture

I’m having trouble with this. I’ve got X11 installed, downloaded Font Forge, and your PFB-OTF converter. However, when I select the folder nothing happens. Does the OTF font go somewhere else? I get a “Done” window but I don’t see the OTF font anywhere.

At first I thought it was because I had .pfm & .pfb files instead of .afm & .pfb files. But when I tried it on another font which had the “correct” .afm files nothing happened either.

Am I doing something wrong?


Michel Boyer
21.Nov.2008 5.01pm
Michel Boyer's picture

You do not need X11.

You put the afm and pfb files in a folder where you are allowed to write. For instance, I put some computer modern fonts in some folder called cmr on my mac. After clicking the application pfb2otf, I select that folder and I see this:

I then click “Choose” and get the following:

The otf files that are created can be seen appearing in the window behind as they are written. They are in the same folder as the .afm and .pfb files. I never added the feature to read kerning from .pfm files. This works on my ppc mac wich OS X 10.4 but I see no reason for it not to work on 10.5 or an intel mac.

Michel


anomalous4
12.May.2009 5.13pm
anomalous4's picture

Hi Michel!

I just tried DLing pfb2otf 3 times. Each time I got a [gibberish].zip(2).part that stopped DLing at ~22kb. (Not the same gibberish every time.) I’ve only ever seen something like that happen a half dozen times in a bunch of years, and it generally means something’s corrupted somewhere.

I could go ahead and do the conversions via Unix, but any time there’s an easier way, my basically lazy self will definitely go for that.

I’m using a Mac G4-400, OSX 10.4.11. If you can help me out, I’ll greatly appreciate it. Thanks!


Michel Boyer
13.May.2009 3.38am
Michel Boyer's picture

Hi,

The zip file is 22433 bytes that’s all. pfb2otf.app is just a unix script wrapped in a clickable application. I guess the server configuration was changed because the file no longer unzips automatically. You need only unzip it. I added a .zip extension to the filename and adjusted the link in the post; the application now unzips automatically on my mac G4 with OSX 10.4.11 when I click on the link.

Michel


anomalous4
13.May.2009 8.13am
anomalous4's picture

Hi again, Michel: Sorry to be a pin in the drain, but....

The file unzips just fine and the app gets as far as choosing the folder, but then......

Nothing happens. The app closes without converting anything. All I get is the source folder with its original contents.

Now what?

Thanks for your help!


anomalous4
13.May.2009 10.06am
anomalous4's picture

Hmmmmmmmmm........ tried to run FontForge & got this message:

Link (dyld) error:

Library not loaded: /usr/X11R6/lib/libSM.6.dylib
Referenced from: /Applications/FontForge.app/Contents/MacOS/FontForge
Reason: image not found

Off to pester the FontForge folks.......... cul8r......


Michel Boyer
13.May.2009 11.39am
Michel Boyer's picture

That means you’ll need to find your OS X installation disks and install X-Windows.


cuttlefish
13.May.2009 12.19pm
cuttlefish's picture

FontForge is a tricky beast to get running on a Mac, and even more so on Windows that I’ve heard. Follow the installation instructions at http://fontforge.sourceforge.net/mac-install.html very carefully and you should be all right.


DanGayle
13.May.2009 2.02pm
DanGayle's picture

Easiest way is to install is via MacPorts.
sudo port install fontforge

Macports requires the XCode Dev Kit 2.5 installation for OS X 10.4.*

With a good Macports install, you get all sorts of easy to install Unix goodness.


anomalous4
13.May.2009 5.24pm
anomalous4's picture

AHA! My X11 is borked! I tried launching GIMP just to make sure, and it won’t run either. I didn’t even realize it was messed up - it’s been a while since I used GIMP.

Wow, I asked for help with one problem and you’ve helped me track down an even bigger problem! I can fix that one pretty easily. Thanks! :-)


Michel Boyer
14.May.2009 6.08am
Michel Boyer's picture

I appended to the original post a link to a version of pfb2otf that uses the fontforge python module and does not require X11. You might also try that.

Michel