Android documentation says androidx.wear.watchface.complications.rendering.ComplicationDrawable
has textTypeface and titleTypeface attributes. But I have found no information how to use it.
I have tried to pass there font resource, font-family resource but that had no effect. What do I need to pass to have effect?
Is it possible to change font style in Drawable complication
?
It is POSSIBLE to apply a custom font for a complications.
Here is how I got it (use this before render you complication - when call complication.render(canvas, zonedDateTime, renderParameters)
):
ComplicationDrawable.getDrawable(context, complicationStyle)?.apply {
activeStyle.run {
//... other attributes
setTextTypeface(ResourcesCompat.getFont(context!!, R.font.your_font_resource)!!)
}
(complication.renderer as CanvasComplicationDrawable).drawable = this
}
I understand that it is not the best implementation but it is working (tested with android 11, galaxy watch 4 one ui 4.0)