DEV Community

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

Posted on

1

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay