Naereen / fontify

« Make your own typeface from your handwriting! ». ⚠ Work in progress. My fork adds multi-page scanned template, french/spanish accents, greek letters, and soon support for maths and ligatures characters.

Home Page:https://naereen.github.io/fontify/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in final generated font.

useraccessdenied opened this issue · comments

So first of all, you did an amazing job on this project by adding features to it.
I tried this project on my ElementaryOS 0.4.1 VM and it is running until the end but the font generated is like this.

kapil-regular

I scanned it with 400 dpi and tried increasing it.
Help would be appreciated in debugging the application.
Thanks.

Here is my attached scanned template you may try!
kapil.zip

Hi,
thanks for trying it, and for reporting this! I will try and let you know asap.

Hi,
I got the same awful results...

I think one reason is that the scan is too dark, another possibility is that there is a large white gap at the bottom (you printed on a US/letter sized and not A4 maybe?).
I'll try to force to whiten the scanned copy and see if it helps.

Reducing the white space in the bottom gave me this:
first try
which seems almost good, only problems seems to be letter s and a few punctuations symbols (that are on the second page of the simplest template you used).

Well, that's really weird… It shows me again how experimental and unstable this whole software is :sad:

Sorry, I don't know what to fix from the software side to improve your result. I will try again asap, see what can be improved.

Thanks for testing. This result is amusing though!
I trimmed the white space from the bottom, cleaned the image but still the same output.
Can you send me the 'white space removed' file to test?
I think another approach for segmenting would be better.

img042
Sure, here it is (after some compression steps but they don't reduce the "quality" of the produced font).

And yes, most surely the segmenting algorithm can be improved.
I won't have time to work again on the "math" part until a few weeks, unfortunately. But you're welcome to try!

(you can do right click, "save image as")

s

seg

Sorry, but the image you provided has the same issues. Above are the segmented images in the temp folder. The test dir has images before 'postprocess_char_complex_and_save' method and the bmp dir has all the darkened images after the said method. It may be some issues of OpenCV or numpy (i don't know). I will continue testing.

I am using:
numpy=1.14.2
scipy=1.0.1
opencv=3.4.0
(If this may help)

OH, so the problem comes from another part. I need to be clearer in the minimal versions that are required to run fontify.
I was suspecting a problem in opencv, but scipy=1.0.1 is very recent, so I have no idea what the problem can be.

Maybe my opencv version I used to test & develop Fontify is too old?
I will see tomorrow and let you know.

Hi,
I still have no idea about how to fix this.
I specified here the versions of each packages, and I also have opencv=3.4 and all the same versions as you.
So… no idea!

Have you installed all the require cli tools?

sudo apt-get install potrace imagemagick fontforge fontforge-extras wkhtmltopdf python-opencv python-fontforge  # try to use 'brew' on Mac OS X ?
npm install -g ttf2woff
sudo pip2 install --upgrade virtualenv

If one is missing, the conversion bmp to pbm fails.

Sorry for the late reply. I was busy in finals but now I have few days off.
I have performed all the steps in the readme.
I think the conversion from bmp to svg is ok but the generated bmps are not ok.

Ok, so I finally made it to workout!
Below was the change I made:
change

The problem seems to occur during Opening and Erosion of image
Below are the debug images before and after the change:
Before:
test
After:
test1

I think it is totally a scipy compatibility issue.

Hi,
OK, the new output seems better but it's not perfect yet, the erosion should be larger to remove more artifacts and tiny dots.
Could you test again in this direction?

And anytime you want, submit a PR so I can really see the changes you made (and then we can merge it, test it again, and improve the software).
Thanks!