Calligraphy icon indicating copy to clipboard operation
Calligraphy copied to clipboard

Is there any way to use this in appwidgets?

Open mokhosh opened this issue 11 years ago • 7 comments

I tried android:fontFamily and fontFamilyPath but it doesn't seem to work in widgets.

mokhosh avatar Feb 18 '14 10:02 mokhosh

And they won't, at least with this implementation. Widgets use https://developer.android.com/reference/android/widget/RemoteViews.html and inflated by system. I'm not sure if it's possible to set custom fonts for widget TextViews at all.

RomanZhilich avatar Feb 18 '14 11:02 RomanZhilich

@safir187, @RomanZhilich is right, there is no remote way (at least through public api) to set the Typeface on the RemoteView, which is a shame, but I guess widgets are meant to be lightweight, if every widget set there own typeface then your device would crawl to a halt on startup

chrisjenx avatar Feb 18 '14 23:02 chrisjenx

@RomanZhilich thanks buddy. @chrisjenx well i needed this so i wrote a BitmapHelper class with static methods which receive Strings and draw them with custom typefaces onto Bitmaps. then i use those Bitmaps in ImageViews. i too am a performance-maniac but android already has to draw some text with some typeface and it doesn't make any difference what typeface it uses. and i don't think there are any re-draws here.

mokhosh avatar Feb 19 '14 07:02 mokhosh

@safir187 yeah that would've been my next go-to 'solution', that might be quite a cool module to add to calligraphy as an extension, you able to do a PR?

chrisjenx avatar Feb 19 '14 08:02 chrisjenx

@chrisjenx Done. Now I can check "adding a quite cool module to a nice library" off my bucket list :D

mokhosh avatar Feb 19 '14 16:02 mokhosh

That's cool! I'm currently using the same approach as @safir187, but using Calligraphy for the same task would be great.

kashban avatar Jul 07 '15 20:07 kashban

Has that "cool module" been added to the library already?

ezamelczyk avatar May 31 '16 19:05 ezamelczyk