Reputation: 4375
I don't think I really understood the ReadMe well, because I have this in my code:
@Override
public void onCreate() {
super.onCreate();
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/trado.ttf")
.setFontAttrId(R.attr.fontPath)
.build());
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
And I have trado.ttf in my assets folder. This is in my Application
class. This is all I've done, did I miss something?
Upvotes: 0
Views: 588
Reputation: 1927
1. Add below code
ViewPump.init(ViewPump.builder()
.addInterceptor(new CalligraphyInterceptor(
new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/OpenSans-Regular.ttf")
.setFontAttrId(androidx.core.R.attr.font)
.build()))
.build());
2. instead of
ViewPump.init(ViewPump.builder()
.addInterceptor(new CalligraphyInterceptor(
new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/OpenSans-Regular.ttf")
.setFontAttrId(R.attr.font)
Upvotes: 1
Reputation: 6142
attachBaseContext(...)
in your Activity
classes.initDefault(...)
stuff inside Application
onCreate()
.trado.ttf
inside assets/fonts
folder.Upvotes: 4