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

Default to UTF8 when drawing text #30

Merged
merged 1 commit into from
Nov 26, 2023
Merged

Conversation

Nycto
Copy link
Collaborator

@Nycto Nycto commented Nov 25, 2023

Nim strings are encoded with UTF8 by default, so this updates the drawText proc to also default to this. I also added an optional parameter in case this needs to be overridden.

@samdze
Copy link
Owner

samdze commented Nov 26, 2023

Makes sense.
Using UTF8 here should not bring performance penalties, I suppose.

@Nycto
Copy link
Collaborator Author

Nycto commented Nov 26, 2023

Using UTF8 here should not bring performance penalties, I suppose.

It really shouldn't. And if it does, users can still manually switch back to ascii encoding.

This is also a "principal of least surprise" kind of thing -- users are going to expect UTF8 to be the default, since it's the default in Nim. When you try to use a more complicated string right now, it spits out mojibake. This is especially salient since the default Playdate font represents things like the buttons using high order unicode characters: Ⓐ Ⓑ 🟨 ⊙ 🔒 🎣 ✛ ⬆️ ➡️ ⬇️ ⬅️

@samdze samdze merged commit 93a7e1f into samdze:main Nov 26, 2023
2 checks passed
@samdze
Copy link
Owner

samdze commented Nov 26, 2023

Thank you!

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.

2 participants