Calligraphy icon indicating copy to clipboard operation
Calligraphy copied to clipboard

textStyle or fontFamily in XML is not applied

Open tomrozb opened this issue 10 years ago • 8 comments

I have set custom font from assets via Application class and overridden the Activity base context callback. Now I want to customize a little one TextView. I have set different fontFamily and textStyle (bold). The TextView is not displayed correctly (textStyle and fontFamily is not applied). I'm using 0.7.2. I've done everything exactly what described in the README. What can be wrong?

tomrozb avatar Jul 03 '14 11:07 tomrozb

@tomrozb Might be textStyle I think that applies a Spannable to the Text which would mess up custom fonts.

Try turning off the textStyle and let me know. (You mean text style as in bold, italic right?)

chrisjenx avatar Jul 04 '14 13:07 chrisjenx

@tomrozb it will also print warnings to the log if the font is not found for some reason.

chrisjenx avatar Jul 04 '14 13:07 chrisjenx

Ok so: textStyle doesn't work at all fontFamily with native fonts doesn't work (as native font I mean e.g. sans-serif)

tomrozb avatar Jul 09 '14 13:07 tomrozb

OK I'll look at textStyle. (You know it won't style a custom font anyway). As for fontFamily if you set a default font in Calligraphy then that will always override fontFamily.

CJ. On 9 Jul 2014 15:32, "Tomasz Rozbicki" [email protected] wrote:

Ok so: textStyle doesn't work at all fontFamily with native fonts doesn't work (as native font I mean e.g. sans-serif)

— Reply to this email directly or view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/46#issuecomment-48469617 .

chrisjenx avatar Jul 09 '14 19:07 chrisjenx

@chrisjenx @tomrozb The reason this is significant to me is this - what if, for example, you prefer not to include Noto as a custom font when it's already in Android - how do we 'get to it'?

This problem increases with Lollipop and in the future when more fonts are built in. (DancingCursive, etc)...

So it seems like it forces you to choose between no default font (which i imagine has a different set of consequences - versus having to include, for example, Noto)

The related question - what are some known situations where having font default affects something that is hard to affect otherwise, and what workarounds?

njwandroid avatar Dec 20 '16 23:12 njwandroid

@chrisjenx Are you open to accepting a PR on textStyle attribute?, I kinda had to add support for it so I can use Calligraphy in one of my projects.

rahul-a avatar Jun 23 '17 06:06 rahul-a

As Font support is being added to Android directly this will be deprecated over the coming months.

On Fri, 23 Jun 2017, 07:32 rahul-a, [email protected] wrote:

@chrisjenx https://github.com/chrisjenx Are you open to accepting a PR on textStyle attribute?, I kinda had to add support for it so I can use Calligraphy in one of my projects.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/46#issuecomment-310583982, or mute the thread https://github.com/notifications/unsubscribe-auth/ABHRsZx43k_XgIMtWDhIrUmK2Q-qHqfMks5sG1v8gaJpZM4CJ7Mr .

chrisjenx avatar Jun 23 '17 12:06 chrisjenx

You did an awesome job filling a gap that lasted such a long time, we appreciate it

On Fri, Jun 23, 2017 at 7:05 AM, Christopher Jenkins < [email protected]> wrote:

As Font support is being added to Android directly this will be deprecated over the coming months.

On Fri, 23 Jun 2017, 07:32 rahul-a, [email protected] wrote:

@chrisjenx https://github.com/chrisjenx Are you open to accepting a PR on textStyle attribute?, I kinda had to add support for it so I can use Calligraphy in one of my projects.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/chrisjenx/Calligraphy/issues/46# issuecomment-310583982>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABHRsZx43k_ XgIMtWDhIrUmK2Q-qHqfMks5sG1v8gaJpZM4CJ7Mr>

.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/chrisjenx/Calligraphy/issues/46#issuecomment-310648360, or mute the thread https://github.com/notifications/unsubscribe-auth/ABOrdCfPBSIleLgUH_Z-i6QxGQhH_J1Lks5sG6oTgaJpZM4CJ7Mr .

njwandroid avatar Nov 07 '17 10:11 njwandroid