emoji Swap Lib

livecode file

THE PROBLEM WE ARE SOLVING (Bug 22982 ): PDF creation on mobile fails if the text being rendered contains an emoji. This library (EmojiSwapLib) is a workaround that takes a field with emoji unicode glyphs and removes the emojis, replacing them with identical imageSource that mimics the emojis. For speed and simplicity, the current method replaces all instances of a particular emoji in one go, using the same image... this means that all instances of that emoji will inherit the same "textSize" since they all reference the same image.

There are cases where this library may not work correctly. In some cases an imageSource is rendered into the pdf with a large leading white-space (which I have been unable to find an explaination for.) And, because this library relies on comparison against a fixed string of "known" codepoints, it is possible it may fail somewhat over time if the emoji bank becomes outdated.

Suggestions and improvement code are most welcome!

Download



          version:   1.2.1

Requirements


Only tested against Livecode 9.6.x (but would expect it to work with LC versions 7 and above)

MIT license - Free: as in beer, speech (and puppies)

History



version 1.2.1  December 2020    - bug fixes  

version 1.2  December 2020    - improved accuracy and slight additional reduction to the size of the library  
version 1.1  December 2020    - simplified use, improved speed and significant reduction to the size of the library  
version 1.0.r  November 2020    - fixed several bugs, added the option of passing htmlText rather than a field reference.
version 1.0.m  November 2020     - announced
version 0.8.x  November 2020     - proof of concept


Written with Livecode - Livecode https://livecode.com

Contact




email-scott
Elementary Software
2706 Northwest Avenue
Bellingham WA 98225
ph:  1-(360)-734-4701