I know how to use custom font in an app, but what I want to do is adding custom fonts system-wide, just like adding a new font on Windows. If there's no official way, which module of android source code should I read? I have to change android source code and build it to support custom fonts.
Here are steps to add custom font into Android build-in system:
Copy custom font .ttf into frameworks/base/data/fonts
Modify frameworks/base/data/fonts/Android.mk
Add your custom font into list of 'font_src_files'
font_src_files :=
Roboto-Regular.ttf
....
AndroidClock_Solid.ttf
<custom_font>.ttf \
Modify frameworks/base/data/fonts/fonts.mk
Add your custom font into list of PRODUCT_PACKAGES
PRODUCT_PACKAGES :=
DroidSansFallback.ttf
...
AndroidClock_Solid.ttf
<custom_font>.ttf \
Rebuild
NOTE: Check if your custom font exists in out/target/product/generic/system/fonts or not. If yes, your custom font have already included in system. If no, recheck your modification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With