Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: not enough image data #4

Open
polyrhythmatic opened this issue Apr 13, 2017 · 1 comment
Open

ValueError: not enough image data #4

polyrhythmatic opened this issue Apr 13, 2017 · 1 comment

Comments

@polyrhythmatic
Copy link

Just wanted to start by thanking you for making this. Very cool utility.

I've successfully used this to convert a .pcf font from gohufont into a ttf.

However I am now trying to convert from a fontforge file New York.sfd into a non bitmapped ttf.

My workflow is to save out a .bdf from the .sfd. I then use bdftopcf to convert the bdf file into pcf.

Unfortunately, there is something wrong with the resulting pcf. I can open it with fontforge and view all the glyphs - everything looks fine. But I get this error when running your script.

Traceback (most recent call last):
  File "pcftottf.py", line 88, in <module>
    p = PcfFontFileUnicode(file(filename))
  File "pcftottf.py", line 38, in __init__
    bitmaps = self._load_bitmaps(metrics)
  File "/usr/local/lib/python2.7/site-packages/PIL/PcfFontFile.py", line 225, in _load_bitmaps
    Image.frombytes("1", (x, y), data[b:e], "raw", mode, pad(x))
  File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 2100, in frombytes
    im.frombytes(data, decoder_name, args)
  File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 742, in frombytes
    raise ValueError("not enough image data")
ValueError: not enough image data

Any idea what is going on here? I have no clue where to start writing my own loader, so any tips on converting the type would be greatly appreciated.

thanks!

@polyrhythmatic
Copy link
Author

This ended up being due to empty glyphs in the bdf font I was using. I got this to run by manually editing the BDF file but then the script wouldn't respect spacing, kerning etc. so I had to give up.

If you're looking to convert fonts from any bitmap format to true type, this package works great

https://github.com/kreativekorp/bitsnpicas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant