I played a bit more with KTextEditor on macOS.
It seems we are too restrictive what we use as line height.
The attached patch increases the height by the leading, both in the computation in the renderer for line height + layouting.
I still get some artifacts like in https://bugs.kde.org/show_bug.cgi?id=379727
But I think that is more likely some rendering mis-shape in Qt itself, as you get even artifacts vertically inside a line during the drawing...