12

I would like to use some not-so-common diacritics and maybe some fancy Unicode characters in my Android app, but I could not find a charmap for Roboto.

What glyphs or character sets are included in Roboto Regular, Bold and Condensed fonts?

Gabriel R.
  • 1,186
  • 1
  • 15
  • 29

2 Answers2

12

After a bit more searching, I've found this reference on the Google API's site

http://commondatastorage.googleapis.com/androiddevelopers/design/Roboto_Specimen_Book_20131031.pdf

The updated reference for the latest version of the font files is here https://github.com/google/roboto/blob/master/res/glyphlist.txt
Note that this may be more recent than the version on your Android IDE or OS!

Gabriel R.
  • 1,186
  • 1
  • 15
  • 29
10

Warning: although the answer below was helpful to many people, and I will leave it up as such, it might trick you a bit, because default browser behavior is to use fallback fonts for missing characters and so you might see glyphs from other fonts in the snippet below.


Ended up hacking this script together for a quick and dirty overview:

var content = "";
var max = 65535; // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode
for (var i = 34; i < max; i++) {
  if (i % 1000 === 0) { content += '<hr>'; }
  content += "<div title='"+i+"'>" + String.fromCharCode(i) + "</div>";
}
document.body.innerHTML = content;
@import url(https://fonts.googleapis.com/css?family=Roboto);
body { font-family: 'Roboto'; font-size: 18px; padding: 5px; }
div { display: inline-block; background: #ddd; color: #111; margin: 4px; width: 1.5em; height: 1.5em; text-align: center; padding: 0.2em 0 0 0; box-sizing: border-box; }
div:hover { cursor: pointer; background: #ccc; }
Jeroen
  • 60,696
  • 40
  • 206
  • 339
  • Is there any particular reason that the loop goes up to 30000 and not further? I tried editing the code to make it run up to 200000. I'm not sure, but it seems like the same characters then just keep repeating. Is that right and why would that be? – Sámal Rasmussen Jan 04 '18 at 10:19
  • @Sammi At the time I chose 30,000 purely for browser perf reasons, I remember Firefox having some trouble back then with those numbers already. As to why it's repeating: I think [`String.fromCharCode()` MDN docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCharCode) have the answer where it is claimed that the max is `65535` (`0xFFFF`). I'm not sure how to get characters above that number tbh, if someone has a link or tip I'm happy to update the answer again. – Jeroen Jan 04 '18 at 10:52
  • 1
    Thanks a lot for the clarification. So I downloaded the [ttf version of Roboto](https://fonts.google.com/specimen/Roboto?selection.family=Roboto) and opened it in the Windows Character Map application. It shows far less characters - only latin/cyrillic/greek letters and some special characters and no chinese/japanese characters. So I did some further research and found a [stackoverflow answer](https://stackoverflow.com/questions/11395584/fallback-fonts-on-special-characters) that says that if the browser doesn't find a character in the preferred font then it will fall back to the next font. – Sámal Rasmussen Jan 05 '18 at 10:24
  • 1
    That's interesting, because that would mean that my answer is in fact _wrong_... I'll leave it up and add a note. – Jeroen Jan 05 '18 at 11:28
  • Please note that the OP question is about the Android version not the web font. – Gabriel R. Sep 24 '18 at 08:42