Updating flags in Google’s Noto Emoji font

SVG
24 Nov 2023

A colleague pointed out to me that the flag we used for Martinique in one of our services was outdated, this post explains the process of updating it.

Background

The current flag for Martinique used by Google’s Noto Emoji font as of 23rd November 2023 is this one.

Current Martinique flag

However, not only is this flag incorrect but it is highly controversial.

The snake flag is highly controversial because of its historical use by French slave ships. Deputy Jean-Philippe Nilor demanded its withdrawal from public use and even compared it to the Nazi swastika that refers to the Holocaust.[25] In October 2018, the National Gendarmerie stopped using the emblem by order of President Emmanuel Macron.

Flag of Martinique - Wikipedia

Correct flag

Since 2 February 2023 the official flag of Martinique is this one.

Correct Martinique flag

Generating the assets

The process for updating these assets is not straightforward.

The Not Emoji Github repo includes a README which refers to scripts which generate optimized SVG and PNG versions of flags, but they are not located in the repo.

They currently reside in a separate repo which is mentioned in this issue.

Updating the flags

There is a script to update flags update.sh which runs some python code regions-wp.py that loops through the file SOURCES line by line and for each line

Some dependencies are required to run this script

brew install wget dos2unix optipng
./update.sh

This should then run through every flag and update the respective assets, apart from the waved svg assets.

Generating the waved SVG asset

The Google Noto Emoji repository includes an additional waved-svg directory which contains a distorted SVG version of each flag.

Again, the process to generate this asset is not immediately clear, but can be found via this issue.

Another repository Warp includes a Python script naive_warp.py which converts an SVG into a waved SVG.

To run it requires Python and some Python libraries to be installed.

pip3 install absl-py cu2qu lxml picosvg
python3 naive_warp.py MQ.svg --out_file emoji_u1f1f2_1f1f6.svg

Note that --out_file uses a unicode form for the outputted filename.

I only wanted to generate a single SVG file, but another script wave_ninja.py runs through the list wave_list.txt to generate in bulk.

Submitting a PR

With all four assets generated html, svg, png, waved-svg the final step was to submit a PR with those updated assets.

Bonus – generating wave effect PNG assets

For our own service we use 512×512px transparent PNGs with the wave effect, as can be seen on Emojipedia.

There is another script to generate these images, waveflag.c, available in the Noto Emoji repository.

This requires installing cairo.

brew install cairo

Updating the code with these changes to output a PNG larger (512px) than the default (128px).

#define SCALE 4
#define SIZE 512

Then compiling and running the script to generate the waved PNG flag.

gcc -o waveflag waveflag.c $(pkg-config --cflags --libs cairo)
./waveflag waved_ ./png/MQ.png

The final output looks like this

Waved Martinique flag (512×512px transparent PNG)
Waved Martinique flag (512×512px transparent PNG)