jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.33k stars 782 forks source link

Fix for changing font byte array #318

Closed ArtemKor closed 5 years ago

ArtemKor commented 5 years ago

The situation when the library changed the used byte array of the font is fixed.

jung-kurt commented 5 years ago

Thanks, @ArtemKor. Do you know why a copy of the font is required? Also, good catch on cleaning up the non-ASCII code point in GenerateCutFont.

OlegFX commented 5 years ago

Previously font slices were loaded to GoFPDF object using pdf.AddUTF8FontFromBytes method couldn't be used for another GoFPDF object because the data in this slice changed after PDF generation. Now one font slice can be used any number of times.

ArtemKor commented 5 years ago

This hotfix resolves this error. Now the byte array font is read-only and can be used many times.

jung-kurt commented 5 years ago

Thank you, @ArtemKor!