It looks like a fonts descent is not considered when vertically centering text from an AttributedString
in TextLayout
on iOS. See the attached screenshots. macOS renders as expected. The transparent white highlighted area is {0, area.getHeight() / 2 - font.getHeight() / 2, width, font.getHeight()}
the white line should represent the baseline and is the above rectangle getY() + font.getAscent()
. I can fix iOS rendering by doing
#if JUCE_IOS
area.translate(0.0f, -font.getDescent());
#endif
before rendering the TextLayout
in area
.
EDIT: Changed iOS screenshot for a version that doesn’t hide the problem behind JPEG compression artefacts.