Hello XDA,
This guide will show you how to add a custom font to any string of text, in any app. When done right, it can really enhance the look of any theme. For the purposes of this guide, I'm going to assume you already have the tools and basic knowledge required to decompile, modify, and recompile apk files. If not, there are plenty of threads on XDA that will teach you how.

This guide will show you how to add a custom font to any string of text, in any app. When done right, it can really enhance the look of any theme. For the purposes of this guide, I'm going to assume you already have the tools and basic knowledge required to decompile, modify, and recompile apk files. If not, there are plenty of threads on XDA that will teach you how.
**** Before proceeding, MAKE A BACKUP ****
**** I am not responsible for any loss of data, bricked devices, your wife leaving you, or any other consequences that may arise as a result of this mod. ****
**** I am not responsible for any loss of data, bricked devices, your wife leaving you, or any other consequences that may arise as a result of this mod. ****
- First, download and extract the attached zip file. The included .ttf is for example purposes, and can be replaced with any font you choose.
- Next, decompile whatever apk you want to use your font in. For this guide, I will be using SystemUI.
- In your decompiled apk folder, place your .ttf file in the 'assets' folder. If there is no 'assets' folder, create one.
- Move the included .smali file into you app's 'smali' folder. The exact location shouldn't really matter, just make a note of what that location is. In my SystemUI example, I have placed it in com/android/systemui/.*** NOTE: The .smali file I've included is named 'WurlyTextView' because the font it uses is called 'Wurly Fool'. ***
*** While not necessary, I would highly recommend renaming the smali file to something more indicative ***
*** of the font you are using, just to keep things less confusing for yourself. *** - After you have moved and renamed the .smali file, open it in Notepad++ and look at the first line:If you are using this mod in any apk other than SystemUI, you will need to change the path. For instance, if you were working in SecMms, the path would be:
Code:
.class public Lcom/android/systemui/WurlyTextView;
In Notepad++, open the find dialogue (ctrl+f), and search for "Lcom/android/systemui/" and replace every instance with the path from your apk.
Code:
.class public Lcom/android/mms/WurlyTextView;
- Next, assuming you renamed the .smali to something more descriptive of your font, search for:And again, replace every instance with whatever you renamed the .smali to. Be sure to watch the capitalization, as it is important.
Code:
WurlyTextView
- Now, search again, this time for:There should be three instances of it. Change all three to the file name of the font you placed in the 'assets' folder.
Code:
wurly.ttf
*** NOTE: If there is a space in the file name of your font, be sure to right-click it, ***
*** look at it's properties, and see what the file name is there, as it will probably not ***
*** include the space, or anything after it. This is the file name you want to use. *** - Search the .smali file one more time, this time for:Replace every instance with something descriptive of your font. Note that whatever you change it to must be all lowercase.
Code:
wurly_fool
*** NOTE: This step is only necessary if you are adding more than one custom font. ***
*** If you are only using one font, this may be left as "wurly_fool", regardless of your font's name. *** - Close your .smali file, saving changes, and navigate to your decompiled apk's res/layout folder.
- Locate and open the layout that points to the string you want your new font to be used on. For example, if you want to change the text that says "No Recent Apps" when you long-press the Home button, you would open /res/layout/tw_status_bar_no_recent_apps.
- Within that layout file, locate the line pointing to the string you want to change, and replace:with the path and name of your .smali file. For example:
Code:
<TextView
*** NOTE: Be sure to pay attention to the capitalization here, as it is important ***
Code:
com.android.systemui.WurlyTextView
- Finally, close your layout xml, saving changes, recompile your app, push to your phone, set permissions, reboot, and enjoy!

0 commentaires:
Enregistrer un commentaire