Skip to content

Commit

Permalink
map_pua_emoji: use itertools.chain() to concatenate dict.items()
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Oct 21, 2019
1 parent 3d5ac2a commit 03e6d6e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions map_pua_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
__author__ = 'roozbeh@google.com (Roozbeh Pournader)'

import sys
import itertools

from fontTools import ttLib

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 03e6d6e

Please sign in to comment.