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.

Oldest comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git