首页 > 解决方案 > 所有 ZWJ 序列都有效吗?

问题描述

标签: unicodefontsemoji

解决方案


There are restrictions on what can be part of ZWJ sequences and what cannot. Unicode Technical Standard #51 lays out these rules.

According to definition ED-15a, a well-formed ZWJ sequence can only consist of:

  • Emoji characters (a character with the property Emoji=True)
  • Emoji presentation sequences (an emoji character followed by U+FE0F VARIATION SELECTOR-16, all valid combinations of which are listed in this data file)
  • Emoji modifier sequences (a character with the property Emoji_Modifier_Base=True followed by a character with the property Emoji_Modifier=True)

All relevant properties can be found in this data file.

U+2605 BLACK STAR is not an emoji character (and it is obviously not one of those types of sequences either), so it would not be valid for use in ZWJ sequences as of the time of writing, but you could substitute U+2B50 WHITE MEDIUM STAR (which is an emoji) instead. Other than that, ️ and are fair game.

Side note on U+1F3F3 WAVING WHITE FLAG: This character is an emoji, but it has the property Emoji_Presentation=False, which means it is intended to display as text-style (monochrome rather than colourful) by default. To force emoji-style display, U+FE0F VARIATION SELECTOR-16 has to be appended to it. It is recommended that these variation selectors always be included for characters where Emoji_Presentation=False.

U+2B50 WHITE MEDIUM STAR is also a valid base for such emoji presentation sequences, but it has Emoji_Presentation=True by default and the variation selector is thus entirely optional. U+1F7E9 LARGE GREEN SQUARE meanwhile is not a valid base for emoji presentation sequences and therefore must never be followed by VARIATION SELECTOR-16. I know, it’s convoluted.

What all this means is that you have two choices for the precise sequence of codepoints you want to use, both of which are equally valid. Either:

️‍⭐‍ <U+1F3F3, U+FE0F, U+200D, U+2B50, U+200D, U+1F7E9>

Or:

️‍⭐️‍ <U+1F3F3, U+FE0F, U+200D, U+2B50, U+FE0F, U+200D, U+1F7E9>


推荐阅读