3 ms·
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
by xfalcox 6y 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/unicode_ranges.rb#L2068-L2098 https://github.com/discourse/letter-avatars/blob/master/lib/...
1. https://meta.discourse.org/t/switch-from-gravatar-to-html-css-letters-for-no-avatar-users/15336?u=falco https://meta.discourse.org/t/switch-from-gravatar-to-html-cs...
2. https://github.com/googlei18n/nototools/blob/master/nototools/coverage.py https://github.com/googlei18n/nototools/blob/master/nototool...