getTextWidth works for what we need. Jake and Maynard are making a text subclass that displays ellipses (...) when text is clipped, although I'm thinking this should just be a feature of <text> that you can turn on.
On 2010-07-13, at 16:48, Max Carlson wrote: > No, that's correct. I thought you meant you wanted an API that can measure > height as well. > > Regards, > Max Carlson > OpenLaszlo.org > > On 7/13/10 1:46 PM, P T Withington wrote: >> Actually it looks like<text>/getTextWidth is supposed to synchronously >> measure the text. Am I confused? >> >> It is true that you cannot immediately look at<text>/width, but the method >> appears to support measuring directly. >> >> On 2010-07-13, at 16:33, Max Carlson wrote: >> >>> There isn't. Currently, you can only set the contents of a text then >>> measure its dimensions. >>> >>> Can you file an improvement? It would be nice if you could request the >>> width, height or both for efficiency... >>> >>> Regards, >>> Max Carlson >>> OpenLaszlo.org >>> >>> On 7/13/10 1:18 PM, P T Withington wrote: >>>> Is there a public LFC API that will let you measure the dimensions of a >>>> line of text? >>>> >>>> If you use a plain<text> element, you can't try to read the size in the >>>> same call that sets the text, you have to listen for 'onwidth' (because >>>> most DOM's defer layout until javascript is idle). >>>> >>>> I'm pretty sure the kernel has a way to measure text that uses some >>>> hackery to do it synchronously. Can we expose that as a public API if >>>> it's not already? >>
