2

Bold textStyle attribute of textview in xml is not working after applying custom fonts in app

I have completed developement of an android app. Now I have to change font family for whole app. I have used baskerville-old-face.ttf fonts and used Calligraphy library to apply these fonts into my app. Following is dependency I have used:

compile 'uk.co.chrisjenx:calligraphy:2.2.0'

Following is the code to initilize Calligraphy library:

CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/baskerville.ttf").setFontAttrId(R.attr.fontPath).build());

And following is the code I have used in each Avtivity to use custom fonts:

@Override
protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}

It is working fine and all fonts are changed but there is only one problem that text style (bold) is not working with xml attribute. I don't want to change each textview attribute programmatically (Using JAVA code) because there are more than 100 text views in my whole app.

I am not getting what I am doing wrong or what I am missing. Please help !

Your help will be highly appreciated. Thank you.

1 Answers1

0

I am not sure that this is the best answer but I was seen same problem. you can use the baskervilleBold.ttf font in your code instead of baskerville.ttf if there is exist.

M2016
  • 16
  • 4