Hacker News new | ask | show | jobs
by xfalcox 2093 days ago
At Discourse we generate a default avatar that is a circle with the first letter of the username in a colored background[^1].

When we wanted to add support for Unicode usernames, we had to include support for generating avatar images with those extra possible characters. It was quite fun creating the fallback system this blog post talks about and trying to support as many real languages as possible. The Noto project was really helpful, not only the fonts but also the pythons scripts they provide for dumping the codepoints covered by a font[^2].

You can check the fallback logic at https://github.com/discourse/letter-avatars/blob/master/lib/...

1. https://meta.discourse.org/t/switch-from-gravatar-to-html-cs...

2. https://github.com/googlei18n/nototools/blob/master/nototool...