When creating an emoji font, is any sequence of ZERO WIDTH JOINER
valid?
For instance: can I use π³ββ
βπ©
(Waving White Flag
+ zwj
+ Black Star
+ zwj
+ Green Square
) to represent a white flag with a green star on it? And then render it, lets say like the Esperanto flag?
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=True
)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>