Font data from BDF


I wrote a converter to make .fnt data from .bdf data. (2.8 KB)

The image above shows the converted X11 font and loaded into the font editor.

How to use it.

$ bundle install
$ bundle exec bdf2fnt.rb -o output courR12.bdf

Then, .fnt and .png will be output.

One thing to note is that it's not completely convertible, so you'll need to rework it. Especially the width of the space and the setting of the kerning pair.

Just be careful with the font license and have fun.
If there are bugs, I will fix them as much as possible. :slight_smile:

1 Like

It’s nice to see some more font tools! I added a reference to your tool in my thread

Because I am not a regular ruby user, I also needed:

$ gem install bundler

Then I could do:

$ bundle install

Which installed chunky_png OK.

But at this point I get an error I do not know how to fix:

$ bundle exec bdf2fnt.rb -o output courR12.bdf
bundler: command not found: bdf2fnt.rb
Install missing gem executables with `bundle install`
1 Like

Oh, it’s a mistake. It came up a little short.
Correctly, it would be the following.

$ bundle exec ruby bdf2fnt.rb -o output courR12.bdf

Of course, it’s okay to add execution attributes to bdf2fnt.rb.


1 Like

I have progress!

for execution bits to work, I had to change shebang to

#!/usr/bin/env ruby

If output directory does not exist:

$ ./bdf2fnt.rb -o output courR12.bdf
/Library/Ruby/Gems/2.3.0/gems/chunky_png-1.3.11/lib/chunky_png/canvas/png_encoding.rb:43:in `initialize': No such file or directory @ rb_sysopen - output/courR12-table-11-19.png (Errno::ENOENT)
	from /Library/Ruby/Gems/2.3.0/gems/chunky_png-1.3.11/lib/chunky_png/canvas/png_encoding.rb:43:in `open'
	from /Library/Ruby/Gems/2.3.0/gems/chunky_png-1.3.11/lib/chunky_png/canvas/png_encoding.rb:43:in `save'
	from ./bdf2fnt.rb:224:in `exportPNG'
	from ./bdf2fnt.rb:187:in `export'
	from ./bdf2fnt.rb:264:in `block in <main>'
	from ./bdf2fnt.rb:261:in `each'
	from ./bdf2fnt.rb:261:in `<main>'

But then I do mkdir output to create directory.

And success:

$ ./bdf2fnt.rb -o output courR12.bdf
png: output/courR12-table-11-19.png
fnt: output/courR12.fnt

note: maybe include
at start of .fnt file? I do this for each of my BDF conversions.

Thank you for reporting the bug. That’s very helpful.

This is a fixed version. (3.0 KB)

  1. Automatically create a folder for output.
  2. Fixed shabang
  3. Add execution attribute to bdf2fnt.rb
  4. Add tracking size option


1 Like