0

Most solutions I read for a over-all app custom-font, is to make a custom class to be used. like this [Question Link]

I'm not looking forward for that fancy solution, but rather I want to know how can I replace the fonts used by android. I am currently using

<item name="android:fontFamily">sans-serif-condensed</item>

to select a font, where there are only few options as default by Android SDK. I want to replace the file where that sans-serif-condensed are located so my the new font I placed would be the one to be parsed by android on runtime. I suspect it's on the jar file created when I created my project or maybe somwhere else since I don't really know how.

How can I replace an android default font file? also where would it be?
I would be grateful for guide or instructions provided, specially if you tried it. Thanks! :]

2

2 Answers 2

1

There is a file fonts.xml which controls the mapping of font families to the actual files. The font files usually reside in the folder /system/fonts.

Neither is really something you can control without root though, so if you want to use custom fonts in your application, custom views are still your best bet.

Sign up to request clarification or add additional context in comments.

3 Comments

I've already searched for it, and the mapping of fonts, I've found fonts inside the fonts folder of the sdk version im using, tried replacing it with a file renamed to that replaced file, and also same file type of font. It doesn't work, and since every created project of android, an android.jar file is created with the project, I suspect its there, but I'm not sure, and don't have clues to do it.
@Yawz This is because this JAR file represents the Android framework which will be provided by the device. The JAR file you have on your PC stays on your PC. Same thing with the fonts in the SDK folders. You need to replace the fonts on the device itself.
This is the correct answer as it explains the answer to the original question. But for the solution I posted another answer. stackoverflow.com/a/53773797/2899410
0

SOLUTION

I think it would be helpful to post this, though it's already been a long time. I haven't posted this as answer since someone might actually answer a solution. Also see this.

The approach in solving this problem is not the way I expected, I was about to replace font files, but as Malcolm's comment here, to do that you must replace the system's font file, which is very inefficient.

The better approach, which is actaully solved my problem is the answer here: Is it possible to set a custom font for entire of application?

It's about replacing the fonts during runtime.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.