summaryrefslogtreecommitdiff
path: root/gtk/emoji
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-08-13 15:16:11 -0400
committerMatthias Clasen <mclasen@redhat.com>2017-08-14 15:46:02 -0400
commitfdd5e9f61ee0c7c40bb99cb77bc5a35363ff003e (patch)
tree2eb4ed45a1eb92214d88891b6b76d57c60111ec5 /gtk/emoji
parent0fe396e516297355be42539abd2010c7f382adc8 (diff)
downloadgtk+-fdd5e9f61ee0c7c40bb99cb77bc5a35363ff003e.tar.gz
Redo emoji data slightly
No longer store variation sequences explicitly. Instead, put a 0 in the sequence where the modifiers will be inserted. This is more compact, and it allows us to put variations directly into the recent section. Update the type of the recent-emoji setting to match these changes.
Diffstat (limited to 'gtk/emoji')
-rw-r--r--gtk/emoji/convert-emoji.c36
-rw-r--r--gtk/emoji/emoji.databin53562 -> 36967 bytes
2 files changed, 20 insertions, 16 deletions
diff --git a/gtk/emoji/convert-emoji.c b/gtk/emoji/convert-emoji.c
index 1e1f171260..dd406a1319 100644
--- a/gtk/emoji/convert-emoji.c
+++ b/gtk/emoji/convert-emoji.c
@@ -40,7 +40,10 @@ parse_code (GVariantBuilder *b,
g_error ("failed to parse code: %s\n", strv[j]);
return FALSE;
}
- g_variant_builder_add (b, "u", u);
+ if (0x1f3fb <= u && u <= 0x1f3ff)
+ g_variant_builder_add (b, "u", 0);
+ else
+ g_variant_builder_add (b, "u", u);
}
return TRUE;
@@ -106,25 +109,25 @@ main (int argc, char *argv[])
array = json_node_get_array (root);
length = json_array_get_length (array);
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ausaau)"));
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(aus)"));
i = 0;
while (i < length)
{
JsonNode *node = json_array_get_element (array, i);
JsonObject *obj = json_node_get_object (node);
- GVariantBuilder b1, b2;
+ GVariantBuilder b1;
const char *name;
- const char *code;
+ char *code;
int j;
gboolean skip;
+ gboolean has_variations;
i++;
g_variant_builder_init (&b1, G_VARIANT_TYPE ("au"));
- g_variant_builder_init (&b2, G_VARIANT_TYPE ("aau"));
name = json_object_get_string_member (obj, "name");
- code = json_object_get_string_member (obj, "code");
+ code = g_strdup (json_object_get_string_member (obj, "code"));
if (strcmp (name, "world map") == 0)
continue;
@@ -141,16 +144,13 @@ main (int argc, char *argv[])
if (skip)
continue;
- if (!parse_code (&b1, code))
- return 1;
-
+ has_variations = FALSE;
while (i < length)
{
JsonNode *node2 = json_array_get_element (array, i);
JsonObject *obj2 = json_node_get_object (node2);
const char *name2;
const char *code2;
- GVariantBuilder b22;
name2 = json_object_get_string_member (obj2, "name");
code2 = json_object_get_string_member (obj2, "code");
@@ -158,15 +158,19 @@ main (int argc, char *argv[])
if (!strstr (name2, "skin tone") || !g_str_has_prefix (name2, name))
break;
- g_variant_builder_init (&b22, G_VARIANT_TYPE ("au"));
- if (!parse_code (&b22, code2))
- return 1;
-
- g_variant_builder_add (&b2, "au", &b22);
+ if (!has_variations)
+ {
+ has_variations = TRUE;
+ g_free (code);
+ code = g_strdup (code2);
+ }
i++;
}
- g_variant_builder_add (&builder, "(ausaau)", &b1, name, &b2);
+ if (!parse_code (&b1, code))
+ return 1;
+
+ g_variant_builder_add (&builder, "(aus)", &b1, name);
}
v = g_variant_builder_end (&builder);
diff --git a/gtk/emoji/emoji.data b/gtk/emoji/emoji.data
index 61d1af0bd9..12db9d4c40 100644
--- a/gtk/emoji/emoji.data
+++ b/gtk/emoji/emoji.data
Binary files differ