The slow Print Preview problem really was bugging me. So I spent a few hours and set up a test program to implement a fast version of GetTextExtentExPoint. Spent a few more hours writing the new code and testing and timing it. This is algorithm implementation at its most complex level. I won’t go into the details. Looks good. Seems like I’m getting a 10 to 20 times speedup!
Then spent a few more hours porting that new routine into the Print Preview of RichView. Testing a file that generates a 33 page Print Preview taking 5.25 seconds (way too long) with the old routine. The critical part calls GetTextExtentExPoint 4214 times and takes 3.96 seconds. Put in my FastGetTextExtentExPoint routine and that part is down to 0.36 seconds. The whole Print Preview still takes 1.65 seconds, but that so far is down to 31% of what it took before. Pretty good, but still room for improvement. I’ll have to find out what that other 1.29 seconds is being used up on. Formatting the same info for the screen takes only about half a second and there shouldn’t be any reason why Print Preview should take any longer. But that will have to be left for another day.
Whip off an e-mail to Sergey and send him the FastGetTextExtentExPoint routine, and I’ll await to hear what he says on it.