7

I draw text throw TextPaint on Canvas. And in some cases it looks terible:

240*320 API 7 240*320 API 7

240*320 API 7 240*320 API 7

240*320 API 15 240*320 API 15

In some cases good:

720*1280 API 15 720*1280 API 15

I use: TextPaint paint = new TextPaint();

paint.setTextSize(height/20); 

canvas.drawText("Just text", x, y, paint);

What do I wrong?

1 Answer 1

21

set the antialiasing flag to your Paint object. The flag is ANTI_ALIAS_FLAG

TextPaint paint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); 
Sign up to request clarification or add additional context in comments.

1 Comment

It uses anti-aliasing to basically smooth out the letters on your canvas. You can read more about aliasing here en.wikipedia.org/wiki/Aliasing

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.