gofpdf icon indicating copy to clipboard operation
gofpdf copied to clipboard

Update splittext.go

Open adamjack opened this issue 1 year ago • 0 comments

More carefully inspect the font for "character width" for each character (rune) and do not crash if the font does not have a width for the character.

I was receiving this crash on line 28 when the string contained a single right apostrophe:

       panic: runtime error: index out of range [8217] with length 256

P.S. I am no expert but as I was looking around the utf8File seemed a reasonable place to look for more widths.

If it cannot find a width for the character it uses a placeholder, using underscore 'cos "wider seemed safer".

adamjack avatar Jun 10 '23 02:06 adamjack