Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHow should users apply skin tone modifiers? #178
Comments
|
Ok I deleted my previous comment talking about trial-and-error since I found the spec. In particular, it says:
and
I think that suggests processing emojis like this. You're welcome to adopt that implementation for this library if you like, tried to heavily comment and test it both from the perspective of "does this format correctly" and "does this render correctly (on Apple platforms, at least)". One note about non-Swift implementations is that you'll probably need to look up the scalar (codepoint) properties ( |
|
The Gist linked from my previous comment doesn't support applying different modifiers to each person in a multi-person grouping. I'm currently adding support for that and will probably publish the result as a Swift package rather than continue to add to the Gist. In the meantime, I'd like to call out a limitation of the algorithm in the Gist: it won't work for extension String {
var modifiableBySkinTone: String {
switch self {
case "👭": return "\u{0001F469}\u{200D}\u{0001F91D}\u{200D}\u{0001F469}"
case "👫": return "\u{0001F469}\u{200D}\u{0001F91D}\u{200D}\u{0001F468}"
case "👬": return "\u{0001F468}\u{200D}\u{0001F91D}\u{200D}\u{0001F468}"
default: return self
}
}
}I hoped to submit some sort of PR to add these "sequence forms" to this project's database, the idea being that a capable platform¹ could only ever store and display those versions of Unfortunately, these sequences only render as single characters when they contain modifiers, at least on macOS 10.15.4. Apple probably didn't bother adding code to make the base sequences render given that they can display the single-scalar versions instead. ¹Supporting Emoji 12.0, which I think is when the sequence forms were added, per the spec—whereas the single-scalar emoji date back to Emoji 6.0, says the database. |
|
Two more gotchas I've found: Firstly, the basic algorithm may return results that won't actually render in cases where platforms haven't generally added support for rendering all the different variants. I'm specifically talking about many of the multi-person groupings. In these cases, the database correctly omits More problematic is that |
|
Thanks for sharing your finding so far! I am unable to provide advice on how to implement support for skin tone modifiers on top of gemoji since I've never done it. The library does report which emoji supports skin tone modifiers, but intentionally does not yet provide any facilities to generate or parse emoji with skin tones because we haven't figured out proper support for this yet, so the implementation is left to the users. |
I've searched through issues and examined the DB and from what I can tell, the library currently reports what emojis can accept a skin tone modifier but doesn't actually provide the modified variants, but rather, only/always the base emoji. That's fine, it seems like it should be easy to produce the variants by appending the modifiers to the base.
Unfortunately, this fails for all of the emojis that have✋ " and "🖐️ " out of ✋ " + "🏻" and get "✋🏻", but "🖐️ " + "🏻" results in "🖐 ️🏻".
U+FE0F VARIATION SELECTOR-16appended. As an example, when copying "emojis.json, I can do "It looks like this library intentionally includes the selector for certain emojis. Moreover, trying to drop the selector, then append the modifier to the remaining unicode scalars, results in correctly modified emoji for only some of the results ("🖐️ " yes; "👨🍳 " no).
Do you folks have recommendations on how to apply the modifiers?