map_pua_emoji: use itertools.chain() to concatenate dict.items()

pull/267/head
Cosimo Lupo 2019-10-21 16:03:06 +01:00
parent 3d5ac2aea9
commit 03e6d6e39c
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642
1 changed files with 4 additions and 2 deletions

View File

@ -19,6 +19,7 @@
__author__ = 'roozbeh@google.com (Roozbeh Pournader)'
import sys
import itertools
from fontTools import ttLib
@ -53,8 +54,9 @@ def add_pua_cmap(source_file, target_file):
"""Add PUA characters to the cmap of the first font and save as second."""
font = ttLib.TTFont(source_file)
cmap = font_data.get_cmap(font)
for pua, (ch1, ch2) in (list(add_emoji_gsub.EMOJI_KEYCAPS.items())
+ list(add_emoji_gsub.EMOJI_FLAGS.items())):
for pua, (ch1, ch2) in itertools.chain(
add_emoji_gsub.EMOJI_KEYCAPS.items(), add_emoji_gsub.EMOJI_FLAGS.items()
):
if pua not in cmap:
glyph_name = get_glyph_name_from_gsub([ch1, ch2], font)
if glyph_name is not None: