mirror of
https://github.com/googlefonts/noto-emoji.git
synced 2025-06-08 07:47:59 +00:00
Fix display of 'parts' of sequences in the sequence column.
When relying on aliasing, a number of single character emoji can be replaced by sequence emoji (in particular, gendered variants). If these images aren't present, the current code that displays a sequence 'visually' fails to find an image for one of the parts, so bails and there's no visual presentation for those sequences. To fix this, we first canonicalize the part we're looking for, and try to find an image for that, and if we fail we check for an alias and try to find an image for that.
This commit is contained in:
parent
d4da27eef8
commit
0d36d125aa
1 changed files with 22 additions and 8 deletions
|
@ -87,17 +87,31 @@ def _generate_row_cells(key, font, aliases, dir_infos, basepaths, colors):
|
||||||
return row_cells
|
return row_cells
|
||||||
|
|
||||||
|
|
||||||
def _get_desc(key_tuple, dir_infos, basepaths):
|
def _get_desc(key_tuple, aliases, dir_infos, basepaths):
|
||||||
CELL_PREFIX = '<td>'
|
CELL_PREFIX = '<td>'
|
||||||
def _get_filepath(cp):
|
def _get_filepath(cp):
|
||||||
cp_key = tuple([cp])
|
def get_key_filepath(key):
|
||||||
for i in range(len(dir_infos)):
|
for i in range(len(dir_infos)):
|
||||||
info = dir_infos[i]
|
info = dir_infos[i]
|
||||||
if cp_key in info.filemap:
|
if key in info.filemap:
|
||||||
basepath = basepaths[i]
|
basepath = basepaths[i]
|
||||||
return path.join(basepath, info.filemap[cp_key])
|
return path.join(basepath, info.filemap[key])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
cp_key = tuple([cp])
|
||||||
|
cp_key = unicode_data.get_canonical_emoji_sequence(cp_key) or cp_key
|
||||||
|
fp = get_key_filepath(cp_key)
|
||||||
|
if not fp:
|
||||||
|
if cp_key in aliases:
|
||||||
|
fp = get_key_filepath(aliases[cp_key])
|
||||||
|
else:
|
||||||
|
print 'no alias for %s' % unicode_data.seq_to_string(cp_key)
|
||||||
|
if not fp:
|
||||||
|
print 'no part for %s in %s' % (
|
||||||
|
unicode_data.seq_to_string(cp_key),
|
||||||
|
unicode_data.seq_to_string(key_tuple))
|
||||||
|
return fp
|
||||||
|
|
||||||
def _get_part(cp):
|
def _get_part(cp):
|
||||||
if cp == 0x200d: # zwj, common so replace with '+'
|
if cp == 0x200d: # zwj, common so replace with '+'
|
||||||
return '+'
|
return '+'
|
||||||
|
@ -236,7 +250,7 @@ def _generate_content(
|
||||||
|
|
||||||
for key in keys:
|
for key in keys:
|
||||||
row = _generate_row_cells(key, font, aliases, dir_infos, basepaths, colors)
|
row = _generate_row_cells(key, font, aliases, dir_infos, basepaths, colors)
|
||||||
row.append(_get_desc(key, dir_infos, basepaths))
|
row.append(_get_desc(key, aliases, dir_infos, basepaths))
|
||||||
row.append(_get_name(key, annotations))
|
row.append(_get_name(key, annotations))
|
||||||
lines.append(''.join(row))
|
lines.append(''.join(row))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue