go-pdf / fpdf

A PDF document generator with high level support for text, drawing and images
MIT License
464 stars 42 forks source link

Makefont fails! #64

Open lordofscripts opened 3 months ago

lordofscripts commented 3 months ago

However, when running it as indicated in the utility help instructions:

makefont --dst embed/fonts --embed --enc embed/fonts/cp1252.map ~/.fonts/Amaranth-Regular.ttf

And I get this error:

Unexpected EOF

The same error occurs when I omit the --embed option.

lordofscripts commented 3 months ago

Really need to use as nicer-looki g font other than the defaults, unfortunately make font seems to be hopelessly broken. It always says "Unexpected EOF" when fed a TTF font file.

At least the original FPDF project had an online version. Unfortunately the GO version uses a JSON file so I am stuck on trying to use a non-default font.

If not can anybody point me to a similarly capable GO PDF creation package that is actually supported? I noticed there is also a jung-kurt/gofpdf but it was archived in 2021.

sbinet commented 3 months ago

hum... are you sure you're running the expected binary ? makefont doesn't take a --dest flag (but -dst).

compiling makefont and downloading Amaranth from https://www.1001freefonts.com/amaranth.font worked for me:

$> makefont -dst out -embed -enc ./cp1252.map ./Amaranth-Regular.ttf 
Character florin is missing
Character ellipsis is missing
Character dagger is missing
Character daggerdbl is missing
Character perthousand is missing
Character Scaron is missing
Character Zcaron is missing
Character trademark is missing
Character scaron is missing
Character zcaron is missing
Font file compressed: out/Amaranth-Regular.z
Font definition file successfully generated: out/Amaranth-Regular.json

$> ll out
total 48K
-rw-r--r-- 1 binet binet 1.4K Apr 23 11:15 Amaranth-Regular.json
-rw-r--r-- 1 binet binet  41K Apr 23 11:15 Amaranth-Regular.z

if that helps, here is what I am doing in gonum/plot to embed fonts from within the same program (w/o having to shell out):

lordofscripts commented 3 months ago

hum... are you sure you're running the expected binary ? makefont doesn't take a --dest flag (but -dst).

compiling makefont and downloading Amaranth from https://www.1001freefonts.com/amaranth.font worked for me:

$> makefont -dst out -embed -enc ./cp1252.map ./Amaranth-Regular.ttf 
Character florin is missing
Character ellipsis is missing
Character dagger is missing
Character daggerdbl is missing
Character perthousand is missing
Character Scaron is missing
Character Zcaron is missing
Character trademark is missing
Character scaron is missing
Character zcaron is missing
Font file compressed: out/Amaranth-Regular.z
Font definition file successfully generated: out/Amaranth-Regular.json

$> ll out
total 48K
-rw-r--r-- 1 binet binet 1.4K Apr 23 11:15 Amaranth-Regular.json
-rw-r--r-- 1 binet binet  41K Apr 23 11:15 Amaranth-Regular.z

if that helps, here is what I am doing in gonum/plot to embed fonts from within the same program (w/o having to shell out):

I did, typo on my OP, it is -dst the problem is not the option but the actual processing.

lordofscripts commented 3 months ago

hum... are you sure you're running the expected binary ? makefont doesn't take a --dest flag (but -dst).

compiling makefont and downloading Amaranth from https://www.1001freefonts.com/amaranth.font worked for me:

$> makefont -dst out -embed -enc ./cp1252.map ./Amaranth-Regular.ttf 
Character florin is missing
Character ellipsis is missing
Character dagger is missing
Character daggerdbl is missing
Character perthousand is missing
Character Scaron is missing
Character Zcaron is missing
Character trademark is missing
Character scaron is missing
Character zcaron is missing
Font file compressed: out/Amaranth-Regular.z
Font definition file successfully generated: out/Amaranth-Regular.json

$> ll out
total 48K
-rw-r--r-- 1 binet binet 1.4K Apr 23 11:15 Amaranth-Regular.json
-rw-r--r-- 1 binet binet  41K Apr 23 11:15 Amaranth-Regular.z

if that helps, here is what I am doing in gonum/plot to embed fonts from within the same program (w/o having to shell out):

I truly don't know what's going on. I recompiled makefont, even re-dowmloaded Amaranth from the site hou mentioned, used it as stated and still get the Unexpected EOF error. I'm on an ARMHF machine.

Is there perhaps a way you can send me those files I need to embed on GoPDF (I guess it's only the JSON file, right?). I tried generating it online but only the original PDF project has that and doesn't generate a JDON but a PHP file if I remember correctly.