Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bad text look on Canvas

Tags:

android

canvas

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?

like image 906
Konstantin.Efimenko Avatar asked May 28 '13 08:05

Konstantin.Efimenko


1 Answers

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

TextPaint paint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG);
like image 197
Blackbelt Avatar answered Oct 05 '22 22:10

Blackbelt