Bad text on canvas

I draw TextPaint text on canvas. And in some cases, it looks like this:

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, it’s 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);

How am I wrong?

+6
source share
1 answer

set the antialiasing flag to your Paint object. Flag ANTI_ALIAS_FLAG

 TextPaint paint = new TextPaint(TextPaint.ANTI_ALIAS_FLAG); 
+12
source

Source: https://habr.com/ru/post/945997/