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! :]

Community
  • 1
  • 1
Aesthetic
  • 763
  • 1
  • 14
  • 31
  • http://stackoverflow.com/questions/12128331/how-to-change-fontfamily-of-textview-in-android – Jacky Chan Mar 28 '16 at 09:18
  • SOLUTION: http://stackoverflow.com/questions/2711858/is-it-possible-to-set-a-custom-font-for-entire-of-application/16883281#16883281 – Aesthetic Apr 24 '17 at 07:04

2 Answers2

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.

Malcolm
  • 41,014
  • 11
  • 68
  • 91
  • 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. – Aesthetic Mar 28 '16 at 09:40
  • 1
    @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*. – Malcolm Mar 28 '16 at 09:43
  • This is the correct answer as it explains the answer to the original question. But for the solution I posted another answer. https://stackoverflow.com/a/53773797/2899410 – Aesthetic Dec 14 '18 at 05:08
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.

Aesthetic
  • 763
  • 1
  • 14
  • 31