DEV Community

Cover image for How to draw text on Canvas using drawText API in Jetpack Compose?
Raksha for Canopas Software

Posted on

How to draw text on Canvas using drawText API in Jetpack Compose?

Exploring text on Canvas using drawText API in Jetpack Compose.

Before Compose 1.3.0, there was no drawText(). We couldn’t draw text directly on the Jetpack Compose canvas, we had to use android native canvas canvas.nativeCanvas.drawText to draw text.

The recent release of Jetpack Compose 1.3.0 introduces many new APIs. And Text on Canvas is one of them.

Please note that this API is still in the experimental state and it is likely to change in the future.

In this blog post, we’ll explore the new DrawScope.drawText() API with multiple examples.

For those who are interested in code only, here you go.

The original post is published on the Canopas blog.

Top comments (0)