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

Support text presentation sequences #43

Merged
merged 1 commit into from
May 7, 2024

Conversation

Jules-Bertholet
Copy link
Contributor

@Jules-Bertholet Jules-Bertholet commented May 4, 2024

Adds support for text presentation sequences.

Just as emoji presentation sequences can transform non-emoji characters into emoji (potentially increasing their width),
text presentation sequences can transform emoji into non-emoji (potentially decreasing their width). For example, U+1F004 MAHJONG TILE RED DRAGON has emoji presentation by default, but with a text presentation selector it should become narrow like all the other Mahjong tile characters.

Some default-emoji characters should clearly remain wide even in text presentation, however. U+1F21A SQUARED CJK UNIFIED IDEOGRAPH-7121 is one such example.

What does Unicode say about all this? The latest draft of UAX 16 says:

In some cases, variation sequences have been defined that request a character to be displayed as wide or narrow. These variation sequences are defined in StandardizedVariants.txt [StandardizedVariants] in the [UCD], but they are identified via the description of the intended glyph style and not via a formal property of the variation sequence. Nevertheless, the presence of the respective variation selector should be considered a sufficient condition to resolve ambiguous width to either wide or narrow [...]

In other words, we're on our own. I've chosen to make default-emoji in the Enclosed Ideographic Supplement block remain wide, and have all others become ambiguous-width.

Adds 532 bytes of static data.

@Manishearth Manishearth merged commit 3aa94a5 into unicode-rs:master May 7, 2024
2 checks passed
@Jules-Bertholet Jules-Bertholet deleted the text-presentation branch May 7, 2024 00:44
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