Commit 03fe2dc
committed
Fix rendering combined emoji in the PDF
Fixes https://ecamp.sentry.io/issues/6353794860/?project=5602507&query=is%3Aunresolved%20image&referrer=issue-stream
The twemoji library strips one code point from the emoji file names in some cases, see twitter/twemoji#419 (comment)
Specifically, the male mage emoji consists of [4 code points](https://apps.timwhitlock.info/unicode/inspect?s=%F0%9F%A7%99%E2%80%8D%E2%99%82%EF%B8%8F):
- 1f9d9 mage
- 200d zero width joiner
- 2642 male sign
- fe0f variation selector 16
And the correct twemoji filename is: `/twemoji/assets/72x72/1f9d9-200d-2642-fe0f.png`
On the other hand, the dove emoji consists of [2 code points](https://apps.timwhitlock.info/unicode/inspect?s=%F0%9F%95%8A%EF%B8%8F):
- 1f54a dove
- fe0f variation selector 16
And the correct twemoji filename is: `/twemoji/assets/72x72/1f54a.png` (note the omitted variation selector)
In the twemoji library, according to the linked comment, the variation selector is removed in simple emoji without a zero width joiner, but preserved in combined emoji with a zero width joiner. Therefore, we need to mirror this transformation.
Different emoji libraries can handle this differently, which is why it can't really be fixed on the react-pdf side.1 parent 27429c8 commit 03fe2dc
1 file changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
| |||
0 commit comments