Search code examples
androidfontsstylesxamarinpixate

Does Pixate Freestyle support custom fonts on Android?


Is it possible to use typeFaces with Pixate Freestyle on Android?

For example:

label{
    font-family: "MyCustomFont";
}

Remember that I'll put the font file inside the Assets folder.


Solution

  • In general, the font support is similar to what Pixate Freestyle have for iOS (see http://www.pixate.com/blog/2013-04-09-font-properties/). However, the Android version only supports the built-in font-families. The fonts (Typefaces) loading is done at the https://github.com/Pixate/pixate-freestyle-android/blob/master/pixate-freestyle/src/com/pixate/freestyle/styling/fonts/PXFontRegistry.java class, and although there is a method there to load from a resource, this method is never called. We'll need to fix that to have a custom-font support. However, it will still be tricky with the font-family detection since Android's API does not provide the font family information when loading a Typeface as an asset (we may have to do an actual reading of the ttf file to get that information, like in here - http://svn.apache.org/repos/asf/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/apps/TTFReader.java).

    In case you would like to contribute any change, you are more then welcome, as it may take some time till we can get to it.