Update emoji dataset with skin tone variants (#11678) (#11763)

* Update emoji dataset with skin tone variants

Since the format of emoji that support skin tone modifiers is predictable we can add different variants into our dataset when generating it so that we can match and properly style most skin tone variants of emoji. No real code change here other than what generates the dataset and the data itself.

* use escape unicode sequence in map

Co-authored-by: techknowlogick <techknowlogick@gitea.io>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
mrsdizzie 2020-06-04 14:56:28 -04:00 committed by GitHub
parent 99058de553
commit 0ad4083cba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3155 additions and 1742 deletions

View file

@ -9,7 +9,6 @@ import (
"sort"
"strings"
"sync"
"unicode/utf8"
)
// Gemoji is a set of emoji data.
@ -21,6 +20,7 @@ type Emoji struct {
Description string
Aliases []string
UnicodeVersion string
SkinTones bool
}
var (
@ -131,11 +131,12 @@ func ReplaceAliases(s string) string {
func FindEmojiSubmatchIndex(s string) []int {
loadMap()
// if rune and string length are the same then no emoji will be present
// similar performance when there is unicode present but almost 200% faster when not
if utf8.RuneCountInString(s) == len(s) {
//see if there are any emoji in string before looking for position of specific ones
//no performance difference when there is a match but 10x faster when there are not
if s == ReplaceCodes(s) {
return nil
}
for j := range GemojiData {
i := strings.Index(s, GemojiData[j].Emoji)
if i != -1 {

File diff suppressed because it is too large Load diff