| Description: |
I have a specific rectangle that I want text to appear in, with any excess text being clipped ("overflow: hidden" in CSS/HTML terms); I'm told that I can either not limit width, and the text overflows left and right, or I can limit width, and the text overflows top and bottom.
A screenshot of the problem that I'm trying to solve is attached.
It would be really nice if I could limit the width *and* the height -- if the height limit was "number of lines of wrapped text" rather than pixels then that would be easy to use and probably easier to implement (I would imagine incrementing a counter with each line wrap, then breaking out of the loop when the number of lines reaches the limit)
If the bounding box could be specified in a way that scales when canvas.scale() gets called, that would be even better.
For the moment I'm manually storing a second copy of all the bits of text on screen, then manually calculating the width and truncating the text on every rescale -- but this seems like I'm duplicating a lot work that Tk has already done (it is already storing a copy of the full text, calculating the width, and then truncating in order to wrap the text -- all I want on top of that is for it to stop rendering after one line)
|