Calligraphy
Calligraphy copied to clipboard
Is there any way to use this in appwidgets?
I tried android:fontFamily and fontFamilyPath but it doesn't seem to work in widgets.
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.
@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
@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.
@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 Done. Now I can check "adding a quite cool module to a nice library" off my bucket list :D
That's cool! I'm currently using the same approach as @safir187, but using Calligraphy for the same task would be great.
Has that "cool module" been added to the library already?