Wednesday, February 26, 2014

FontLoader Fund

So was repurposing the FontLoader class from HoloEverywhere so that I could use it with appcompat library and thought I would check something. HE uses text styles to reduce the amount of fonts one has to load in the raw folder.

So I checked and HE only uses 5 text styles, but there are in fact over 11 text styles according to the javadocs for TextAttribute.

Looks like a have a contribution to the HoloEverywhere project after I finish this contribution. Why do it?

Okay, some background. In human language systems in computers we do not load the full set of fonts, we load defaults and than have fallbacks to handle the harder fonts such as Asian, etc.  So the anti-pattern everyone uses especially on mobile is to settle on one human language translation, say English and stick to Latin fonts.

Well to load custom fonts we usually use the raw folder trick and the application class. The application class onCreate method has to return fast,ie right away, so we do not want a large raw folder of fonts but instead a small raw folder of fonts nd thus full-fills this purpose.

But, we also get the benefit of new text styles with a font that maybe does not have them, which is also somewhat good as it gives us better flexibility on our font pairing match ups.