How to add custom fonts in AOSP

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to add custom fonts in AOSP

Shreyash Mohta
Hello Folks,

I wanted to add new custom fonts (vendor fonts) while building AOSP code.

First thing,  I do not want to modify system's fonts.xml files. I tried this and its working fine.

What I wanted is to add custom fonts without adding it in the system's font file, for this I followed


and able to generate the build with the newly created/added fonts under the product folder (check out the link).


Please check the link first: 

For example :

If I add the following code in font-customization.xml

<fonts-modification version="1">
        <family customizationType="new-named-family" name="lobster">
                <font weight="400" style="normal">Lobster-Regular.ttf</font>
        </family>
</fonts-modification>

After building the image, the font-customization file is created under /product/etc/ and Lobster-Regular.ttf is created under /product/fonts. 

 
But when I am creating a sample application and trying to use the new font, as below

In the style.xml in

<item name="android:fontFamily">lobster</item>

Its not working

Do anyone have idea related to this.

Regards,
Shreyash Mohta

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/android-platform/328f71bd-e086-4657-93c5-62efd1a98f6an%40googlegroups.com.