drawText() with float precision?

In my juce Application I changed circle drawings from integer precision to float as explained by jules here:

void MyComponent::paint(juce::Graphics &g)
{
 auto area = (getLocalBounds().reduced(2)).toFloat();
 area.setCentre(area.getCentre() + juce::Point<float>(deltaX, deltaY));
 g.setColour(juce::Colours::black);
 g.drawEllipse(area, 1.0f);
 g.drawText("Some Text", area, juce::Justification::centred, false);
} 

When the circle moves accross the screen, the circle moves smoothly with nice float precision, but the text jitters inside. Am I doing something wrong?

AFAIK text is quantized to the closest Y coordinate, as otherwise it would look extremely blurry. It’s a very common and unsolved problem. Even photoshop does it for fonts under a certain size.

oh, okay thanks…

If you still need to draw text at subpixel y positions, convert the text to a path first and then offset the path. It’ll be more blurry so you can’t use very small font sizes, but it does work.

ah i see, thanks!

Just in case anyone bumps into this, here is a simple example of how to achieve that: