If I want to embed custom fonts in my application I have to protect them at least in some way because the license requires this. So I cannot do something like
Typeface.createFromAsset(getAssets(),"fonts/myAwesomeFont.ttf");
On iOS is used this approach that decrypts a font on the fly and makes it available in the application. Is there a similar approach possible on Android?
My hunch is using a singleton class that handles the decryption of the raw resource file and returns the typeface on demand as I set it in code on the views. Are there better approaches out there that I missed? *Is this even possible?*
Not really.
That is not possible, as there is no way for you to create a
Typefacefrom some byte array or stream.You are welcome to decrypt the font file and store it locally unencrypted, then use that. Whether this is sufficient for your license terms is a question for your attorney.