Commit Graph

27 Commits (ccf9c08be044552584f1c1c77e07636fb2fa55d6)

Author SHA1 Message Date
sunaoka 8df1e034b9 Fix unichr() to chr() 2020-08-18 15:35:42 +09:00
Rod S e604c969d3 py3 generate_emoji_html.py 2020-03-10 20:51:04 -07:00
Mike FABIAN 188ffcf08c Use Python3 explicitly 2019-07-17 10:35:02 +02:00
cclauss 4607d55e4c Modernize Python 2 code to get ready for Python 3 2017-09-14 22:18:24 +02:00
Doug Felt 94e2cde27f Fix scripts that auto-invoke python to find it correctly.
Some of our environments use python from /usr/local/bin. In these
environments using /usr/bin/python can cause unexpected behavior
since the python module search path is different.  So use env
to find python using the PATH instead.
2017-05-17 09:28:52 -07:00
Doug Felt 1e09374c16 Identify excluded images explicitly.
Formerly when we were missing an image in the standard emoji sequence
we always labeled it as 'missing'.  However, android excludes some
region flags, so we expect those to be missing and labeling them
implies an error.  Add a new category 'exclude' and populate it
using the unknown-flag alias keys.
2017-04-13 14:34:20 -07:00
Doug Felt fabd80e194 Use standard string.Template mechanism. 2017-04-12 08:47:24 -07:00
Doug Felt 0d36d125aa 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.
2017-03-07 17:54:41 -08:00
Doug Felt d4da27eef8 Canonicalize aliases.
Forgot to canonicalize the aliases, so most of them wouldn't get used
because the keys against which they're compared are canonical.  Fixed
that.

Also report unused aliases.
2017-03-07 16:59:50 -08:00
Doug Felt 0d0db39af0 Update emoji html page generation.
- Support --ignore_missing flag to skip missing data on output.
  When all_images is set, this skips sequences for which we have
  no image files.  When all_images is not set, this skips sequences
  for which we have image files but are not in the canonical
  sequence list (e.g. older sequences for which we included skin
  tone variants but which later versions of unicode decided there
  shouldn't be).
- Use alias information to add alias sequences when not using
  all_images and we have an image for the target sequence.
- Use alias information to mark missing images with '-alias-' when
  we expect an alias (note, not only when we actually have one)
- Embed tool name, date, and arguments in a comment in the generated
  html.
2017-03-07 14:28:21 -08:00
Doug Felt df9b5647b7 Support 'ok', 'warning', 'error' annotations and define some.
Formerly the annotations file created a set of sequences that would
cause the name field to display with a special background color.  This
lets you choose one of three colors by defining the 'type' of annotation
in the file.  The file format was enhanced and the code using it takes
the type of annotation into account.

This also adds a sample annotation file with annotations for a number of
situations we currently expect to encounter: missing images that we expect
to be supported by aliases to other images, flags that we expect to not
support, and new unicode 10 emoji that we might not yet have image data
for.
2017-02-22 09:58:25 -08:00
Doug Felt d24aa6dd3e Add all_emoji and emoji_sort options to generate_emoji_html.
By default, the list of emoji sequences is based on the union of
the sequences encoded in the image file names for all the directories
(or the first directory if --limit was set).  The --all_emoji option
uses the emoji sequences from nototools/unicode_data instead.

By default, the list of emoji sequences is in unicode codepoint order.
The --emoji_sort option uses the emoji sequence sort order from
nototools/unicode_data instead.

Along with this, the ordered list of sequences becomes an argument to
write_html_page, which it should have been all along.
2017-02-21 16:17:23 -08:00
Doug Felt 1f2cde6c5e Map to canonical keys when we read in file name mappings.
It's a bit cleaner to canonicalize the keys when we read the file names.
This means we can just use the one canonical key, instead of using
the original to get the file and the canonical one to render text and
show the decoding.
2017-02-21 16:17:23 -08:00
Doug Felt f68991b34b Update generate_emoji_html.
Main changes are:
- Uses correct path to the font when a font is used. With standalone, also
  copies the font to under the destination directory.
- Canonical sequences are used in text rendered by a font.  Chrome handles
  these better (though still not perfectly).
- The description column now is renamed 'Sequence' and shows the
  (canonical) codepoint sequence for all emoji.  It also continues to show
  the component images for sequences.
- The name column now always shows the sequence name using the unicode
  data.  Single character emoji that are not default emoji presentation
  now have the names prefixed by '(emoji)'.  Names for the unknown flag
  PUA char and for the combining enclosing keycaps char (not technically
  an emoji but an emoji component) are special-cased, they are not in the
  emoji sequence name data built by unicode_data.
2017-02-09 18:24:48 -08:00
Doug Felt 326621dfd0 Add color option to generate_emoji_html tool.
Now optionally takes '-c' flag to set background colors for the last
emoji set.  Colors are 6-digit rgb hex values (for css after '#').
When more than one color is specified, the last emoji set is repeated
across columns, one for each color.  '-c' with no arguments defaults
to a set of 11 colors.  Omitting the flag uses the standard background
color.
2017-01-24 11:42:51 -08:00
Doug Felt 4ec1a5fed8 Update emoji sequence check to be more flexible.
- supports checking files with other extension besides .png
- checks all files under a root directory and not just the
  files directly in a directory
- checks for duplicate files in multiple directories under a root
- reports the directory containing a file when there are problems
2017-01-18 14:48:52 -08:00
Doug Felt 1a5925a871 Add 'standalone' option to copy image data used by html page.
The generated html references images in multiple directories that
might not be in any defined location relative to the html file.
For sharing the results it's convenient if we have the images
and html file under the same parent directory.  This option computes
the necessary images and copies them to directories under the directory
into which the html file is written, and makes the html file reference
the files in these new locations.

In addition, this removes some clutter from the generated table by
using the nth-last-of-type pseudo-class selector instead of tagging
all the cells in a column with a class name.
2016-10-12 15:54:37 -07:00
Doug Felt d1a760e5e3 Add ability to highlight some emoji when generating html
This adds an argument to generate_emoji_html that specifies
a file listing codepoint sequences.  Emoji matching one of these
codepoint sequences are highlighted in the output.
2016-08-18 16:03:32 -07:00
Doug Felt 2232f4df82 Show codepoints for sequences in generate emoji html tool.
It used to be difficult to find a sequence since the codepoints weren't
provided, just the images.  This provides the codepoint list as
the 'name' of the sequence.

This also makes some other changes:
- the python template system doesn't like keyword names that have have
  hyphens, so rename font-face-style to fontFaceStyle to get around this.
  Thought this had been fixed earlier, but apparently it didn't end up in
  a pushed commit.
- no longer insert emoji variation selector after some characters.
  This was done to see what difference it made in browser behavior, but
  we think now that browsers should be able to handle these sequences
  without the selectors present.
- use a flag to pass name of output html file, rather than taking it as
  a direct arg.  other flags take multiple args, and if the html file
  name comes after one of those, it gets swallowed by the other flag,
  so it has to come first.  This lets you put the file name anywhere
  in the parameter list, the flag acts as a delimiter.
2016-07-14 13:32:40 -07:00
Doug Felt 7c719f9166 Update emoji html generation tool to show images rendered by font.
Images are shown in LTR and RTL contexts.  Chrome currently doesn't
correctly render some emoji sequences, in part this is because it is
using Unicode 8 property data.  At any rate, these are known Chrome
issues.
2016-07-11 14:53:58 -07:00
Doug Felt 5fd46ab136 Add limit option to generate_emoji_html.
By default the tool uses all sequences that appear in any of the image
sets. To make it easier to see just the changes between a smaller
set of images and a large one, this lets you limit the sequences
to just those in the first set being compared.
2016-04-15 15:07:58 -07:00
Doug Felt 8b2596d76a Generate file references relative to destination of output file.
Formerly, we wrote the file paths as given on the command line, the
assumption being that the output file was in the cwd and the paths
to the directories would be correct.

However if we want to generate the output file somewhere other than
the cwd the generated image paths don't work.  This takes the location
of the output file into account and either generates relative paths
if the files are under the output file directory, or absolute paths
otherwise.
2016-04-15 15:00:32 -07:00
Doug Felt 59e04933c0 Tweak emoji html to display images against darker color. 2016-04-14 17:40:13 -07:00
Doug Felt ae1b8331ee Tweaks to emoji build tools to deal with odds and ends. 2016-04-05 13:28:40 -07:00
Doug Felt 2a6be68841 fixes for review 2016-03-16 16:48:39 -07:00
Doug Felt 7239961d93 fix add/append mixup 2016-03-16 15:17:00 -07:00
Doug Felt a9b8e7f8e0 Add tool that generates an html file comparing emoji images.
This uses nototools to get unicode names.  It relies on new
api in nototools.unicode_data to get data/names of proposed emoji
that are not currently approved and so not in the standard data
files.
2016-01-29 14:38:07 -08:00