Minimal Version: I want to replace our default font with a prettier one. Current font on the left, and Roboto on the right:
TL;DR Version: I want to replace our default font (Deva Vu & Droid Sans) with Roboto Flex and multiple Noto fonts in a fallback stack. This will allow better customization for replacing and/or augmenting the fonts. Allow us to support more language scripts at once, up to all of them. Increase performance, decrease RAM usage, decrease our maintenance costs, and give us new output features. These new features include Variable fonts, which allow a single font file to change its appearance along multiple axes:
We currently ship with two font files, one that is fixed-pitch for the text editor and another that is proportional for most of the UI. Each font file contains approximately 54,000 characters, which is a large portion of the characters needed for many different languages.
We allow our users to select other fonts they may prefer or that handles their language better. However, when they do so it replaces ours, which means they lose access to all the other languages’ characters. In fact, there are many language-specific fonts that contain nothing but that one language’s characters and do not even contain Latin (A-Z) characters. The ideal font for their language could be completely unusable with blender.
Our font is also an old design and it is getting more difficult to add new characters to support more languages. In fact, there is a limit of 65,535 characters in a single font file, which is about half of the characters currently encoded in Unicode (143,859). Which is why I want to move to using multiple font files that work together.
At this point I can hear the odd reader saying “Wait, I’ve heard of the font called Noto that contains all the characters from every language”. No. Noto is a collection of fonts that are designed in a harmonious way so they can be displayed well together, but comprise hundreds of different font files totaling gigabytes in size.
What I’m proposing is that we support a font “stack”. If a character is not found in the first font we then look in the second, then the third, and so on. This process can actually be more memory efficient and more performant when using multiple fonts than one big one. Each font includes a table indicating which Unicode blocks it supports, and a font can be loaded only when needed. Therefore languages in our stack would never be loaded if you didn’t use them, the search for the characters you do use is faster, and your memory usage is decreased.
In our datafiles/fonts folder we currently have the two big font files, just over 11MB in size. I’d replace those with two versions of Roboto, one proportional and the other fixed, about 340k instead. Then we’d add a “Fallback” folder containing Noto fonts for each of the languages we now support, plus symbols, and icons, and then possibly a “last resort” font.
We’d no longer have to edit and maintain our own fonts. We could easily add new languages and they would stylistically match the others. And users could select any font for any unsupported language with any number of characters yet still see all the others.
Yes, this implies that while using the Text Editor we’d fallback from a monospaced font to proportional characters. This font is used almost entirely for Latin characters with occasional non-Latin characters in strings, no matter what language you are using. I have coded “proportional to mono fallback” and it works great. Narrow characters are simply centered while wide ones have their curves transformed to fit before rendering.
Any comments or concerns?