Hey Kalle. This is a pretty impressive expression. Congrats on that. But i have one question that I would like to ask. How did you get to the char_per_line calculation? I thought my math was decent, but i just can’t understand where that came from.
Not that I recall this exactly, but I think the logic was along the lines that if you consider a single character as a unit width (“1”), the full “char_count” represents a square within which the text fits. That’s why square root is the length (character count) of a single line. Because this is not a square, however, it needs to take into account both the width-to-height ratio of the actual rectangle and the leading ratio. (In hind sight I believe the leading ratio has to be experimentally derived by changing the slider, it might be a square of the actual value, rather than a scalar. Not sure any more though.)