Reputation: 3465
I am drawing formatted text on canvas using DynamicLayout
, and I need to implement some sort of zooming. I tried to use canvas.scale(...)
for it. But when text contains highlights, text is scaled inconsistent with background, like this:
Code which draws text is very simple:
canvas.scale(zoom, zoom);
TextPaint textPaint = new TextPaint();
textPaint.setAntiAlias(true);
DynamicLayout layout = new DynamicLayout(text, textPaint, width,
Layout.Alignment.ALIGN_NORMAL, 1.0f, 1.0f, false);
layout.draw(canvas);
How to make it right way?
Upvotes: 5
Views: 1329
Reputation: 3465
I've solved this issue, setting textPaint.setSubpixelText(true);
Upvotes: 5