chrisjenx / Calligraphy

Custom fonts in Android the easy way...
Apache License 2.0
8.59k stars 1.09k forks source link

setting bold typeface #364

Open shakeri-mreza opened 7 years ago

shakeri-mreza commented 7 years ago

how can I set two typefaces (a normal and a bold one) ?

benju69 commented 7 years ago

You have to set a bold font to your textview : <TextView fontPath="fonts/MyFont-bold.ttf"/>

Jeff11 commented 7 years ago

When we switch between bold and regular in code, then this is not working.

adiga-maf commented 7 years ago

@benju69 , I agree that your code works:

You have to set a bold font to your textview :

But hardcoding every TextView in the app would be a problem if you have too many layouts. However, Is there any way to programmatically do it?

benju69 commented 7 years ago

There is no way to do it programmatically apparently, read the readme, you can also make a Style or a TextAppearance

ivnsch commented 7 years ago

It is possible to set it programmatically, as described in https://github.com/chrisjenx/Calligraphy/issues/87

textView.setTypeface(TypefaceUtils.load(getResources, "fonts/MyFont-Bold.ttf"));
adiga-maf commented 7 years ago

Thanks @i-schuetz ... It works well for me. I can programmatically set both Regular and Bold fonts. Issue should be closed