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?
I've solved this issue, setting textPaint.setSubpixelText(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With