lollipops icon indicating copy to clipboard operation
lollipops copied to clipboard

integer divide by zero using the -U option

Open pbnjay opened this issue 2 years ago • 4 comments

Looks like there is some progress using the -U option (I no longer get "uniprot error: 400 Bad request"), but I now see the following after entering the Uniprot ID for TP53, which produces an empty .png:

Gene Symbol: TP53B_HUMAN Drawing diagram to test.png panic: runtime error: integer divide by zero

goroutine 1 [running]: github.com/golang/freetype/truetype.mulDiv(...) /Users/jeremy/src/github.com/golang/freetype/truetype/hint.go:1729 github.com/golang/freetype/truetype.(*hinter).move(0xc001c17390, 0xc001e1200c, 0x100000140) /Users/jeremy/src/github.com/golang/freetype/truetype/hint.go:1469 +0x1cf github.com/golang/freetype/truetype.(*hinter).run(0xc001c17390, 0xc00018881c, 0x24b5, 0x15aab9c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/jeremy/src/github.com/golang/freetype/truetype/hint.go:706 +0x36bd github.com/golang/freetype/truetype.(*hinter).init(0xc001c17390, 0xc00000c1e0, 0x300, 0x268, 0x4d) /Users/jeremy/src/github.com/golang/freetype/truetype/hint.go:158 +0x2e5 github.com/golang/freetype/truetype.(*GlyphBuf).Load(0xc001c17300, 0xc00000c1e0, 0x3000000300, 0x2, 0xc001c14800, 0xc001dba000) /Users/jeremy/src/github.com/golang/freetype/truetype/glyph.go:98 +0x310 github.com/golang/freetype/truetype.(*face).GlyphBounds(0xc001c14800, 0xc00000004d, 0x13ec580, 0xc001c14800, 0x409668ba2e8ba2e8) /Users/jeremy/src/github.com/golang/freetype/truetype/face.go:322 +0x6e github.com/joiningdata/lollipops/drawing.(*diagram).png(0xc0000870e0, 0x13e5a40, 0xc0000100a8) /Users/jeremy/src/github.com/joiningdata/lollipops/drawing/png.go:161 +0x81e github.com/joiningdata/lollipops/drawing.(*Settings).DrawPNG(0x15ee940, 0x13e5a40, 0xc0000100a8, 0x4052000000000000, 0xc0000b8060, 0x1, 0x1, 0xc000087020) /Users/jeremy/src/github.com/joiningdata/lollipops/drawing/png.go:61 +0x139 github.com/joiningdata/lollipops/drawing.DrawPNG(...) /Users/jeremy/src/github.com/joiningdata/lollipops/drawing/png.go:37 main.createOutput(0x2057dd955, 0x8, 0xc000087020, 0xc0000b8060, 0x1, 0x1, 0x0, 0x0) /Users/jeremy/src/github.com/joiningdata/lollipops/output.go:22 +0x1c1 main.main() /Users/jeremy/src/github.com/joiningdata/lollipops/main.go:217 +0x618

Originally posted by @mreyer93 in https://github.com/joiningdata/lollipops/issues/59#issuecomment-1170668520

pbnjay avatar Jun 30 '22 03:06 pbnjay

Can you provide the whole command you're using? This appears to be font related - are there errors about finding the Arial font file?

pbnjay avatar Jun 30 '22 03:06 pbnjay

I'm just trying the example for right now:

./lollipops -U Q12888 -f="/Library/Fonts/Arial Unicode.ttf" -o test.png R273C R175H T125 R248Q

So, I have provided the path to the font I have available

mreyer93 avatar Jun 30 '22 03:06 mreyer93

I'm able to reproduce at least, but it appears to be something deep in the font renderer and specific to the Arial font... I did make a change to pull in a known-working font at least, so if you can try the latest release (again, without the -f Arial), hopefully things will work for you then!

pbnjay avatar Jun 30 '22 05:06 pbnjay

That seems to have worked! Thanks for the fix and for your fast responses!

mreyer93 avatar Jun 30 '22 14:06 mreyer93