I’ve noticed that in some fonts, like Hindi, the line count is incorrect when I use the code you provided. It works perfectly in latin based fonts, but for some reason other fonts don’t calculate it correctly. I’m not sure how to fix, but just wanted to add this note for anybody working with fonts that might have non-latin characters.