drawFittedTextProblem.zip (4.3 KB) Hi!
I am trying to draw text at the very top of a rectangle.
To do that I am using drawFittedText with Justification::centredTop.
Unfortunately, the text is a bit off. I would expect the text to appear at the very top. But actually it is a few pixels down.
Here is a zoomed in version of my problem:
As you can see, the text starts a few pixels below the top of the blue rectangle.
Maybe I am picky, but I would like it to start at the very top of the blue rectangle
Here is my code:
//define area: juce::Rectangle<int> textArea(30,30, 100, 100); //draw a blue background rect into textArea: g.setColour(juce::Colours::blue); g.fillRect(textArea); //draw text into same textArea: g.setFont (juce::Font (16.0f)); g.setColour (juce::Colours::white); g.drawFittedText ("Text", textArea, juce::Justification::centredTop, 1, 1);
I am testing on JUCE 6.0.7 under OSX 11.2.2 (big sur) on an Intel Mac.
I have attached the zipped test project, which can be used to reproduce the problem (see drawFittedTextProblem.zip).