joypixels / emojione

[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
https://www.joypixels.com
Other
4.46k stars 536 forks source link

Lightweight JS library #616

Open redeye86 opened 5 years ago

redeye86 commented 5 years ago

Hi,

for my needs i needed a simple converter that replaces unicode-emojis with emojione svgs. As the original library would have doubled the amount of data my page visitors need to download, i decided to create an own library that uses a space efficient data structure for only that special purpose. The lib has ~38kb / ~5kb gzipped file containing both, the algorithms and data.

It's definitely not well-tested and may require some polyfills for Non-ECMAScript-6-Browsers, but if someone is interested, look at my gists:

library only: https://gist.github.com/redeye86/562b8c7c9d4aee7ff4f458b5742f1ded

generator for the actual js file (to generate file for a folder containing code-point emoji files): https://gist.github.com/redeye86/f9d8102de69606a2984b715cf7537655

sherlock1982 commented 5 years ago

This is really great. Current official implementation is huge and slow.

While shortnameToImage looks optimized toshort is not. Therefore if I simply need to convert unicode text to the image I'm stuck with converting to short names and than to image. I'm not sure anybody really needs shortnames nowadays.

I really want to see simple toImage function without shortname support. Maybe official library could be published modular I can target unicode->image and include only needed information.

Improvements were suggested in https://github.com/emojione/emojione/pull/627 and https://github.com/emojione/emojione/pull/489