My issue is that during smooth scaling applied to Skia canvas (with concat
method) the text appears to scale in "spurts", non-uniformly. The issue is particularly evident on Android platform with FreeType 2 back-end.
I believe this is how general text scaling works in Skia - first apply text size to font engine, then extract glyph bitmap and transform it with "remainder" matrix to achieve the desired final size. But somehow final remaining scaling is not applied which results in such spurts amidst transition between integral values of text size. The same thing with pure Java/Android canvas appears to work impeccably (text scales smoothly).
My question is how can I fix that behavior? Maybe there is some build configuration flag I could tweak, maybe SkPaint
runtime flag?
Skia revision is m59
.
Non-uniform scaling resizes selected objects in a non-uniform manner, allowing you to choose the scaling to be applied for each axis. Arcs are converted to curves and primitive surfaces to power surfaces by default. To non-uniformly scale an object:
SkiaSharp also supports using HarfBuzz to properly shape the text. The current version uses DirectWrite on Windows, as far as I know, Chrome uses Freetype.
SkiaSharp also supports using HarfBuzz to properly shape the text. The current version uses DirectWrite on Windows, as far as I know, Chrome uses Freetype. Some shared code might help to investigate this further. Sorry, something went wrong. It might also be that Chrome is making use of some of the text hinting and subpixel things...
To non-uniformly scale an object: Select the objects to scale. Tip: To scale a workplane with the objects, select the workplane after starting selecting the scale option.
I don't know Skia, but generally when I see this behavior with scaling text, it's because you're casting your scaling float to an int.
float scale = someValue;
int someOtherVar = scale;
... some scaling math on someOtherVar...
text.setScale(someOtherVar)
This will cause the described behavior
Never convert any scaling variables to int's until the very last step.
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