Calligraphy icon indicating copy to clipboard operation
Calligraphy copied to clipboard

setting bold typeface

Open shakeri-mreza opened this issue 8 years ago • 6 comments

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

shakeri-mreza avatar Feb 06 '17 11:02 shakeri-mreza

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

benju69 avatar Feb 08 '17 14:02 benju69

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

Jeff11 avatar Feb 22 '17 21:02 Jeff11

@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?

adiga-maf avatar Jul 06 '17 12:07 adiga-maf

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

benju69 avatar Jul 06 '17 13:07 benju69

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"));

ivnsch avatar Jul 09 '17 15:07 ivnsch

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

adiga-maf avatar Jul 10 '17 11:07 adiga-maf