Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update splittext.go #30

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update splittext.go #30

wants to merge 2 commits into from

Conversation

adamjack
Copy link

@adamjack adamjack commented Jun 10, 2023

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 added 2 commits June 9, 2023 20:40
More careful insect the font for "character width" for each character (rune) and do not crash if the font does not have a width for the character.
Renaming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant