[REBOL] Re: Multiple Fonts in area
From: greggirwin:mindspring at: 24-Oct-2002 10:32
<< You draw it twice and the first only to calculate the length?
Is it not better to draw only once with the method which permit to calculate
the length?
The only reason i can see for your method is to not waste memory, but time.
>>
That's basically how Windows works though. If you want to draw text, and you
need to know how large it's going to be, you call something like
GetTextExtent, DrawText/DT_CALCRECT, or one of the more modern APIs that are
more exacting. Those function take a Device Context handle as a parameter,
which is kind of what we're missing in REBOL, though I'm not sure what the
best solution is. If you want to do things like a print preview feature,
that approach can be nice because one set of drawing commands can work for
both screen and printer. Complexity is a big downside though. I think RT can
come up with something better.
A big difference, performance wise, might be whether the text is actually
rendered, or if you can do it in a hidden face and avoid that overhead.
--Gregg