My program (win32, Delphi) needs to display special chars in some columns of a table. To do that I use a special font for those columns. I got the font from my client. It is a .FON font. It works good on the screen but I often get problems as soon as I want to use it to print something.
I would like to convert this .FON font into to truetype font (.TTF) to avoid the problems. I don't care if the font does not scale good. I should just looks exactly the same when used on the screen with the same size as the default size of the original font. Do someone know a way to do that?
(It don't necessary need a source code solution. The font won't change. It's enough if I find a tool to do it)
Edit: Ideal would be to get a truetype font where each pixel of the original font is converted into a vectorial black square (I tested by redrawing a few chars manually, it would works as I want).
Edit 2, solution used: Using FontForge + Autotrace and then making corrections manually I was able to get a vector font that follow the outline of the pixels of the bitmap font. This vector font scales somewhat better than the original font and solve my printing problems. See accepted post for details.
But I'm still interested if someone knows a fully automated solution.
I couldn't get autotrace to work, so I wrote A python script to trace black and white images into vector polygons, one for each pixel.
So with a folder of glyph images, you can convert it into a folder of
svg
files.Then in Inkscape union + simplify path to clean up each glyph. ( might be doable on command line with Inkscape)
Finally import the corresponding
svg
into FontForge for each glyph.-> script hosted at gist.gisthub.com
For those that do not want to compile fontforge (for windows) grab a download here: http://www.mpetroff.net/software/fontforge-windows/
That build uses potrace instead of autotrace. The best parameters I got for the font that I was converting (vgasys.fon) were:
--turdsize 0 --opttolerance 0 --unit 1 --longcurve --gamma 0 --blacklevel 0 --cleartext
It was still hours of manual work to get the font looking good (by adding and removing points).
According to the product description BitFonter 3.0 seems to be able to do that:
But US $999 is a little bit expensive to convert just one font.
Use FontForge + Autotrace then make some corrections manually.
First integrate Autotrace in Fontforge, see Autotracing bitmaps in FontForge. Here is how I have done it, as I wasn't able to use the win32 version of FontForge:
In Portable Ubuntu choose Applications->Accessories->Terminal to compile and install autotrace:
Then convert your font:
Select all characters and start an autotrace while holding the shift key so that you can enter parameters for autotrace. I used following parameters, which improved the recognition of the outline of the pixels but I didn't found the perfect parameters:
Using FontForge I was able to generate a corresponding truetype font, which gives exactly the same chars as the original font when used at the good size. May be I still need to tweak some options, because I used my original font at size=11. The new font works good only at size=10.5, which is impossible to use in delphi. The font looks really horrible at every other size.
Apparently it uses a possibility to store bitmap fonts in a truetype-font. The resulting font doesn't have the problems I had with the bitmap fonts, but it is completly blank on the printer so that it doesn't solve my problem.
A note about FontForge: I didn't manage to install the Windows Version of FontForge (based on cygwin). Instead of that I Installed Portable Ubuntu Tres, which is a linux version that works on Windows. It's easy to install: unzip the file and start the exe. Then choose System->Administration->Add/Remove Applications and search for FontForge and install it (administrator password is 123456). I got FontForge version 20090622 installated.
I found myself searching for these fonts to use with a project I am working on. Cringing at the thought of manually editing all of the glyphs as mentioned in the other answers, I continued to search. Eventually I stumbled across a site which has the original font as well as some newer
.ttf
variants. If you don't care that some of the glyphs have been remapped (they are all still present) this is a nice alternative: Oldschool PC Fonts. As an added bonus for me these support extended Latin, Greek, Cyrillic and Hebrew scripts plus a bunch of additional glyphs and Unicode symbols.