I’m trying to use setBufferedToImage() to improve UI responsiveness on iOS (it’s painfully sluggish otherwise). It does seem to help a lot in that respect, BUT there is a problem with text rendering.
Here’s an example:
The leftmost image is not using setBufferedToImage() at all and the text looks fine.
The center image has setBufferedToImage() applied at the editor level - antialising is OK, but the letters are much heavier for some reason.
The rightmost image has setBufferedToImage() called on the slider itself - text weight is OK, but it really lacks some antialiasing.
Has anyone run into this? Is there any way to fix or mitigate it?
@alexrdsp, thanks for stopping by! I don’t know about your context, but in my case g.getInternalContext().getPhysicalPixelScaleFactor() already returns 2.0f, so there would be no difference between the two.
As I mentioned, for me it was JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING that did the trick of getting rid of both extra boldness and jaggedness.
I also implemented the repaint caching thing from this thread:
which improved the responsiveness further. (There might be side-effects though, but I’ve yet to see them.)
The difference here is that on iOS font smoothing is disabled by default and isn’t a configurable user setting like on macOS. When we create the standard JUCE CoreGraphicsContext for the UIView, the value of the JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING therefore has no effect and you get text rendering like the leftmost image in the OP. However, for some reason, font smoothing can be enabled for bitmap CGContexts which are used when rendering to an image so the text rendering looks “heavier” like in the middle image when using setBufferedToImage(). I think the right thing to do here is only use the JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING flag on macOS, and simply ignore it on iOS so the CG fonts are never smoothed and the rendering is consistent between normal painting and cached component images (and with the iOS default itself). This has been added to the develop branch: