build_emoji: Fix the spritesheet CSS generation code.

Modify the spritesheet generation code to account for the differences
between emoji_map.json and iamcal's dataset. Due to the differences
between the two mappings, some emojis like 1️⃣, 2️⃣ etc were not
getting rendered properly in the two emoji pickers where we are using
the iamcal's spritesheets for rendering them. This was so because there
was no CSS class corresponding to the codepoints of these emojis(as
mapped using emoji_map.json) in our spritesheet CSS(generated using
iamcal's dataset).

Fixes: #4775.
This commit is contained in:
Harshit Bansal 2017-05-16 17:56:41 +00:00 committed by Tim Abbott
parent 0667297c6e
commit 0d28d5d808
1 changed files with 10 additions and 0 deletions

View File

@ -265,6 +265,16 @@ def dump_emojis(cache_path):
'pos_x': (emoji["sheet_x"] * 100) / 40,
'pos_y': (emoji["sheet_y"] * 100) / 40,
}
# Remove the code below once the migration to iamcal's dataset is complete.
emoji_name = emoji['short_name']
codepoint = emoji['unified'].lower()
if emoji_name in emoji_map and codepoint != emoji_map[emoji_name]:
emoji_positions += EMOJI_POS_INFO_TEMPLATE % {
'codepoint': emoji_map[emoji_name],
'pos_x': (emoji["sheet_x"] * 100) / 40,
'pos_y': (emoji["sheet_y"] * 100) / 40,
}
for emojiset in EMOJISETS:
sprite_sheet = os.path.join(EMOJI_DATA_PATH, 'sheet_%s_32.png' % (emojiset,))
run(['cp', sprite_sheet, cache_path], shell=True)