How to convert a bitmap font (.FON) into a truetyp

2020-01-27 12:00发布

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.

11条回答
叛逆
2楼-- · 2020-01-27 12:42

I know this question is old, but for what it is worth I was able to easily convert an old .fon to .ttf using PixFont. I ran it as an administrator (no installs - an old school executable in place) and it generated a good TTF even though the original .fon was missing some correct glyphs.

And, while it isn't free, at $29 it almost is, especially compared to the very expensive commercial products out there.

查看更多
看我几分像从前
3楼-- · 2020-01-27 12:45

I found that the easiest route to getting a good TTF version of a FON is to use one of the free online bitmap font editors. You have to manually enter each glyph, but the process is much simpler than coming to grips with FontForge. There are two editors that I know of, and they both produce TTFs that work fine on Windows and Linux.

BitFontMaker is the simpler of the two. I like its clean interface, but I ended up not using it because monospaced fonts can only have cell widths of 10 to 14 pixels.

FontStruct requires registration and uses a Flash interface. I was able to make new fonts quite fast once I got used to the interface. (It might be coincidence, but I noticed an uptick in spam on the email account I used to register.)

Both editors set the line spacing automatically. A trick to get the spacing you want is to add a high pixel on one character, then use a vector font editor to remove it from the TTF. (Type light works well and is much easier to use than FontForge.)

查看更多
萌系小妹纸
4楼-- · 2020-01-27 12:45

It is unlikely that you can accomplish it with a simple free tool. http://www.fontlab.com have tools to do it, but they are very expensive.

查看更多
别忘想泡老子
5楼-- · 2020-01-27 12:51

A possibility might be to use the command line tool SBIT32 fom Microsoft. It's easy to convert the .FON file into a .BDF file using FontForge. But then you need to write a metrics file (.MET). I didn't try it, because I suppose that I would get a truetype-font with embedded bitmaps font, and it is possible to generate such fonts directly with FontForge (type "(faked) MS bitmap only sfnt (ttf)" under File->Generate Fonts).

查看更多
你好瞎i
6楼-- · 2020-01-27 12:51

Autotrace seems to produce a pixel perfect output, if the input is scaled, I made some tests and scaling at least 8× works perfectly.

After opening the bitmap font in FontForge, Open - > Element - > Bitmap Strikes, and create a bitmap strike of 8× the resolution (for example: if 16, then 128). Then save this bitmap strike as a bitmap font (e. g. bdf).

Perform the "Autotrace" on this scaled output.

There are more points than needed, this can be resolved by using Element\Simplify\Simplify, this will simplify the outlines. In this specific case of the outlines being made of only horizontal and vertical lines, this operation should be lossless.

It's automated, making it much easier for fonts with tons of characters than redrawing all the characters manually. This should definitely be useful for anyone who drew bitmap glyphs and has a valid bitmap font file but cannot use it yet (Microsoft's .fon format does not support Unicode, and many applications fail to properly utilize true bitmap fonts).

查看更多
登录 后发表回答