THE PROBLEM ( Bug 22982 ) WE ARE SOLVING: 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 things may fail somewhat over time if the emoji bank becomes outdated.
Suggestions and improvement code are most welcome!