TextSize and TextWrap

I know that I’ve used a simple solution to this before, but I having a “senior moment.”

While I can use textSize to get the height of text, when used along with TextWrap, the function continues to return the height of a single line, no matter how many lines TextWrap generates for a long string.

What’s the simple way of determining the total height of a wrapped string? Thanks.

I think yojimbo2000 had a solution halfway down this thread

https://codea.io/talk/discussion/6733/text-new-line-help

@Mark are you sure? When I run the code that Ignatz linked to, this one, https://codea.io/talk/discussion/comment/61697/#Comment_61697
It seems to work fine, textSize accurately reports the total height of a block wrapped with textwrapwidth. Could it be a push/pop style issue? (AFAIR wrap width is included in the style stack)

Nope, but after a bit of experimentation, it seems like a combination of CORNER mode, large font size, and relatively narrow window is required to generate the issue. I can work around it so… Never mind.

Thanks for checking. I wouldn’t have realized my results were odd if someone hadn’t confirmed most situations worked fine.

may this could help:

-- draw
-- Using the text height
_, hh = textSize(str)
-- Removing the size up down
text(str, 500, 550 - hh)

@TokOut - stay out of this, you are a beginner and they are experts