The plugin Flag Emojis provides support for colorful country flag emojis on Windows, since Windows doesn’t provide these.
- Credit for this solution goes to TalkJS and Mozilla, I have simply packaged it as a TW plugin.
- It doesn’t have any external dependencies, weighs 113 kB, because it contains a subset of the Twemoji font with the flags.
- I have only superficial knowledge of JS and how to use it in TW, so there might be a better way to do things, feedback welcome.
- This does not fix the emojis in the editor – a hint how to do it would be welcome, if it is at all possible.
- In order for the plugin to work,
Twemoji Country Flags
has to be the first font in the family. The plugin ships properly modified core settings for main and code font families. All explained in readme.
Non-plugin alternative: import the JS and the font (if needed) on the go, by simply placing the following code (as shown on TalkJS’ GitHub) in a tiddler tagged $:/tags/RawMarkup
:
<script type="module" defer>
import { polyfillCountryFlagEmojis } from "https://cdn.skypack.dev/country-flag-emoji-polyfill";
polyfillCountryFlagEmojis();
</script>
This is much less code stored in the wiki compared to my plugin, but it imports the JS and the font from a CDN, so it is not the most robust and secure approach. My instinct is not to do such thing in a wiki with sensitive data.
Non-TW alternatives:
- Firefox can be configured to use the built-in Twemoji font for the flags.
- There are extensions for Chrome-based browsers that fix it.
- I think there are ways to modify Windows’s Segoi UI Emoji font, so that it contains flags.
Depending on your scenario, you might not want or be able to apply these, so I thought it is nice to have a TW-sided solution.