Emote icon indicating copy to clipboard operation
Emote copied to clipboard

Fix skin tone and code point issues, detect static directory location

Open lkrms opened this issue 2 years ago • 0 comments

I'm using the AUR package I maintain and can't easily build and test a snap, but given the encoding errors and code point sequence issues I found in emojis.csv and picker.py respectively (I felt like I was reliving #24 😆), it may be worth checking whether or not the sequence blocklists in emojis.py are necessary when Emote is running as a snap -- if not, #48 may not be as critical.

Fixes for inconsistent skin tones and blocklisted emoji

Before: Before

After: After

emojis.csv

  • Replace emoji in columns 1 and 12 by evaluating the UTF-16 code points in columns 2 and 13 respectively. Many contained invalid/unnecessary code points that broke when Emote appended a skin tone code point.
  • Add update-emojis shell script to automate this cleanup in future.

emojis.py

  • Implement "skin tone templates" to accommodate emoji sequences where skin tone code points appear multiple times or must precede other code points. This was the underlying cause of emoji rendering as two or more separate emoji.
  • Ignore SKINTONE_SEQUENCE_BLOCKLIST and SEQUENCE_BLOCKLIST except when running as a snap
    • [ ] TODO: test the snap with this PR and reduce or remove these lists if possible?
  • Add get_skintone_template to add support for skin tone variants in get_emoji_by_char. Necessary because stripping skin tone code points doesn't always return a valid "base" emoji.
  • Reimplement strip_char_skintone.

picker.py

  • Work around limited support for rendering skin tone modifiers as standalone emoji (e.g. my system displays them as crosshatch boxes) by displaying "waving hand" in the skintone_combo dropdown.

static/ path fix (when running outside of a snap container)

  • Set config.static_root based on the detected environment.
  • Update references to static assets to use config.static_root.

lkrms avatar Sep 25 '21 06:09 lkrms