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

Truncate beer/brand names based on number of glyphs #106

Open
ryanavella opened this issue Jan 9, 2019 · 2 comments · Fixed by #109
Open

Truncate beer/brand names based on number of glyphs #106

ryanavella opened this issue Jan 9, 2019 · 2 comments · Fixed by #109
Assignees
Labels
enhancement New feature or request

Comments

@ryanavella
Copy link
Collaborator

It would be nice to truncate beer/brand names based on number of glyphs, as opposed to the number of bytes or runes.

I can't find any decent libraries that can calculate the visual width of strings. Here is a quick and dirty approach we could try:

  1. Normalize the string to NFC
  2. Convert string to []rune
  3. Calculate the length of this
@bhutch29
Copy link
Owner

We need to extend this to the Menu as well, for beer name, brand name, and style name

@bhutch29 bhutch29 reopened this Jan 18, 2019
@ryanavella
Copy link
Collaborator Author

We have a lot of code duplication with regards to nicknames and truncation, maybe we ought to consider rewriting it all in a more extensible way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants